From patchwork Wed Dec 23 06:01:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 346972 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp5943683jai; Tue, 22 Dec 2020 22:10:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJxFzz4TPdqDIOcOcLIf3z2iVvLNuoxJqRVjsaqpDuCTwlz7UmamjvzYNxTaQJS/yCEy/9nV X-Received: by 2002:a25:5c3:: with SMTP id 186mr34814919ybf.131.1608703828332; Tue, 22 Dec 2020 22:10:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608703828; cv=none; d=google.com; s=arc-20160816; b=SrVHS4gyIpRGntqC3yTXwh654Ttsq0/wTtcqM8zzRPm7AtzNdNBHeAYkVd6VOB9SyA EZFkuBzIufZTADzpCYfgsnl0wXU4yDLiGNVLBBa19PtqQqvmq8YsyeoeowhfVeMKxPB3 adY/+wPKrN39AJO6r0ey5uufgb/Af+d59ItP0zV49vUfnZHdC7KPaE77HOyl7Px+PEZB kzkvo/tanilV0ljNR6KWRATeadSbrX0ztuBbm+5O/yCR/55UrruZXXITluNLxnMg59KY 1Akv7310ObqflJh6k7aqkbczr1UaNdwv6RwkIY4TpCbsMLxxh3PWUWz09LWu20K8gnCn w9hA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=zGMNyIm+K/W3aZHsjQzBQ/qpcbywBXoHa8cbHlQEpxs=; b=GjnB/gw2DRweeGOyxmcDXmT6WZUb6/ndt7qHKJ1FYw0zNTiPb52rwNGo9mvFCpeBYE /L5Ii+0iuDYUgzsWT8AS8juHXoCu7OP93khTTo3qv78/p9RugC19LPuNCGdAELxcCKf8 SO+hHhGYlRVqxoi2yJnFhvepWLyLAp6SVc4VtNIGtIFTOwhHjdg/VYBZtVrJvwLbqASz 1LjMX41lxEFrumD5oM3zJ3kkAm2cWYJcc7ah+Gbw1ZwnSaVbus1Ia8aAY+QbalfDR2nY DKB5iQ1tH62/flFOPszov+/Xilx6qJX6R6201pOjjcNo1NaTRS41VEOllWjK6+CPOaYs nqGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cRFinEUE; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c2si22035742ybe.400.2020.12.22.22.10.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 22 Dec 2020 22:10:28 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cRFinEUE; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:38782 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1krxLv-00075O-F6 for patch@linaro.org; Wed, 23 Dec 2020 01:10:27 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39216) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1krxDz-0008P0-1J for qemu-devel@nongnu.org; Wed, 23 Dec 2020 01:02:16 -0500 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]:43329) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1krxDv-0000Kw-Kv for qemu-devel@nongnu.org; Wed, 23 Dec 2020 01:02:14 -0500 Received: by mail-pf1-x434.google.com with SMTP id c12so9757276pfo.10 for ; Tue, 22 Dec 2020 22:02:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=zGMNyIm+K/W3aZHsjQzBQ/qpcbywBXoHa8cbHlQEpxs=; b=cRFinEUEnaaOyBNCL6bIgGjkVR8WRQ57xQm6lCRFAT+xhIiWua1Em9Ne6WdAb9Ia0M bwz8StynpWlz2n1uxbF34pZQl3pAyqwYKJ8Nb7xKwFPWSrb8O/obHhUALos2IrNIeOE7 bdySv01yNqXW0cKy/fUVOH9JH+a9esF7ldc0tnEibhDlHPxxJkiQKzwOIF6pDbPonpcg KDvqUyEYQVUBtLICrH2QhOF8U7ZPZd+0hZJMg8nOaiXqIGnBrTvDueqiDbmwbOSPQhl8 8cels7ZtbYIAascdCcgKjy+/5vsytp/l1H8YDvUsDb/r2cPZPqLh4ANm4nFApPHZiY/d 4THA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zGMNyIm+K/W3aZHsjQzBQ/qpcbywBXoHa8cbHlQEpxs=; b=Rm+Xs69B8JB84NCDXvb1187/UtHAQvQTgiyJ83Ww84or+f/lDfRjjQT1VfsOqMUvvs to4UFQqGoolfsU6xYdW9ld6q9kVHvChWFfHCCbWlyVHLBClZ34NbaDT/GA6VMVfmqz/O hGvZTkSJzqUbK2BfQgYNxsny0Sw3Qab1JQAmN0sOZZL6QHS634kz+LAfJjhsVSZCqLwy /dHMBZuBxAlKbQxdPTbSIine4IBOi+/HH+t0D412mNcTh+se8iX6g2EkQNInY3Scxynj zo0S5tgMGRMfEABoWB/x4YxXB2Qa7RpeWHc7LN+gS64h1LjyDG+sjU+obPYvD+knhGDQ cDcQ== X-Gm-Message-State: AOAM531wFWUAdvMygGGo9Re4BnSyxD4FXuGIEQucjDivP4qw54MDORG+ 6Je+TdzVjMyjOvZAsBekbk342U9VE9KLYA== X-Received: by 2002:a63:5d5f:: with SMTP id o31mr23444902pgm.295.1608703328421; Tue, 22 Dec 2020 22:02:08 -0800 (PST) Received: from localhost.localdomain (174-21-139-177.tukw.qwest.net. [174.21.139.177]) by smtp.gmail.com with ESMTPSA id s1sm21943620pfb.103.2020.12.22.22.02.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Dec 2020 22:02:07 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 02/22] tcg/i386: Move constraint type check to tcg_target_const_match Date: Tue, 22 Dec 2020 22:01:44 -0800 Message-Id: <20201223060204.576856-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201223060204.576856-1-richard.henderson@linaro.org> References: <20201223060204.576856-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::434; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x434.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Rather than check the type when filling in the constraint, check it when matching the constant. This removes the only use of the type argument to target_parse_constraint. Signed-off-by: Richard Henderson --- tcg/i386/tcg-target.c.inc | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) -- 2.25.1 diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc index d8797ed398..b73873f715 100644 --- a/tcg/i386/tcg-target.c.inc +++ b/tcg/i386/tcg-target.c.inc @@ -254,13 +254,13 @@ static const char *target_parse_constraint(TCGArgConstraint *ct, break; case 'e': - ct->ct |= (type == TCG_TYPE_I32 ? TCG_CT_CONST : TCG_CT_CONST_S32); + ct->ct |= TCG_CT_CONST_S32; break; case 'Z': - ct->ct |= (type == TCG_TYPE_I32 ? TCG_CT_CONST : TCG_CT_CONST_U32); + ct->ct |= TCG_CT_CONST_U32; break; case 'I': - ct->ct |= (type == TCG_TYPE_I32 ? TCG_CT_CONST : TCG_CT_CONST_I32); + ct->ct |= TCG_CT_CONST_I32; break; default: @@ -277,14 +277,20 @@ static inline int tcg_target_const_match(tcg_target_long val, TCGType type, if (ct & TCG_CT_CONST) { return 1; } - if ((ct & TCG_CT_CONST_S32) && val == (int32_t)val) { - return 1; - } - if ((ct & TCG_CT_CONST_U32) && val == (uint32_t)val) { - return 1; - } - if ((ct & TCG_CT_CONST_I32) && ~val == (int32_t)~val) { - return 1; + if (TCG_TARGET_REG_BITS == 32 || type == TCG_TYPE_I32) { + if (ct & (TCG_CT_CONST_S32 | TCG_CT_CONST_U32 | TCG_CT_CONST_I32)) { + return 1; + } + } else { + if ((ct & TCG_CT_CONST_S32) && val == (int32_t)val) { + return 1; + } + if ((ct & TCG_CT_CONST_U32) && val == (uint32_t)val) { + return 1; + } + if ((ct & TCG_CT_CONST_I32) && ~val == (int32_t)~val) { + return 1; + } } if ((ct & TCG_CT_CONST_WSZ) && val == (type == TCG_TYPE_I32 ? 32 : 64)) { return 1;