From patchwork Wed Jan 10 22:44:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 761487 Delivered-To: patch@linaro.org Received: by 2002:a5d:6e02:0:b0:337:62d3:c6d5 with SMTP id h2csp2112864wrz; Wed, 10 Jan 2024 14:48:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IGT26XakjpL+qn2yYJA0HR4BinZ+RVjYGqmoEKH+3cUmwCAyBX/WioHRJQt2YkS7Odra01z X-Received: by 2002:ad4:5d6e:0:b0:67a:3506:afdf with SMTP id fn14-20020ad45d6e000000b0067a3506afdfmr221212qvb.61.1704926885227; Wed, 10 Jan 2024 14:48:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704926885; cv=none; d=google.com; s=arc-20160816; b=rF+kqKwFUvUKcsjtX5BJ8HCucfgcLFTt7JSWGUS1UjBAveeRYCZYWuNz4Ioj/skNH1 G0Tpl63heg6Kc6HSb5JyG7rwthHT0B0VVcnYy7lUj4a6gq0s0gBsmV1d08j3Uvp8ou9n RUSAFzfc7rZxbpNpKve9aXw7wIyxDaELUhJcxaw0fv2Bi3suO5MGZ4N0iB+A1X3NLppS COerctfzUXxWfOZ4y/i3JBMLIDQsKs6Fx6dQVbub6dZZ9RnL3wu39e4LKcG3uUrimEh4 wpRsprr9HJWjXl18Y9UrjtErXqkzSYt35HAHB9wTelsnaRxG+3tj7OtZztbZ9aSV6xPx Oy0w== 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:cc:to :from:dkim-signature; bh=l6wrsnSxRLOGGrrUU+5wUcOLIX0LsFSMqYGfjSPgVvg=; fh=GbSB792CRg76qyQfASHmg380JBauy2gTuYi49sbOwBU=; b=BmjnJ1P3WdSwL375VNcOXhrvYPY1xIM8HFsIdhmNXj5lXlUWsqU1Pifux+Am9FJdl2 cD6eocl9hKytwNNJK6lW6zVxVEhjZDmPJpgVakbxelP1m9emyrsp6i1rhqZ1rGGHJIIF IR4Yf6XApDanngXkQKkcWjatJTlIWVEkgdcT4s+DtMJY8m4Mp4SXsn6yMuMPdClIavcH zwK5V4XVDZxlPT/IZzORco/TXqupVh8tXFENtfaTEj3WeugTxpQRKbr2NFX8+0KfrgbE +uPFekwpnxvRSl1VvB5GrFbN25zt0EKASE69DUKzZjUE6vMJuDgKGKCWFvI0s1BDox1i GBWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ggFbARp8; 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 x12-20020a0c8e8c000000b00680640b9976si5177881qvb.549.2024.01.10.14.48.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 10 Jan 2024 14:48:05 -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=ggFbARp8; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rNhLa-0000iK-04; Wed, 10 Jan 2024 17:46:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rNhLT-0008O7-3N for qemu-devel@nongnu.org; Wed, 10 Jan 2024 17:46:47 -0500 Received: from mail-qt1-x835.google.com ([2607:f8b0:4864:20::835]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rNhLR-0003eh-0e for qemu-devel@nongnu.org; Wed, 10 Jan 2024 17:46:46 -0500 Received: by mail-qt1-x835.google.com with SMTP id d75a77b69052e-4299f424e55so13856471cf.1 for ; Wed, 10 Jan 2024 14:46:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704926804; x=1705531604; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=l6wrsnSxRLOGGrrUU+5wUcOLIX0LsFSMqYGfjSPgVvg=; b=ggFbARp8NPvInqFOwGI5nHC0vFTLa36s3vWpz6isQtkVfzjzJCV4zro3TJ70xUMHna qjqwkOwCliguvY3EWxnj8n5FNQccG3coDrIcfMLKEMfPqzq7dGTyvNSglxn48b2crU0v G2nBiHtmif05hWZIGz3VKfo2GKcfIyztk0L3lR1QhCuT59warXhNxdjP1igDkQQtaK+s Rc777fIk1f1zAGRjZ5tGTLS5drWE7JQKXAPc29Vnipvym2l0dFkJJkviO9B7JpmVAUWV B5uiDZ2aBhMPMNGzAQNk+qkzeKxqCqUSBkpjh8v2q2OcSv9vDK9RRTCu1fBwNZvnQydf axSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704926804; x=1705531604; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=l6wrsnSxRLOGGrrUU+5wUcOLIX0LsFSMqYGfjSPgVvg=; b=N3CPFD72RBgigbGn5Zx0gIjbRziPiBj8Yzaq4AejIp7RjNmpRoQsoQUybPl05++9Uu 5QossCJcXNAtUSPfjRINTZeMyLx3Ej3yjGyVPHBK7wFsjYHv1jokenVP/GjndGb+OTO4 +987LowWaFKHTcSFooa/AfqPDouJrn9r7/LmNlr2QnLf3a0mcA2ImkKy6LiDPDEGjURz uMvqQYBvibA/zUARJ6/4VAyizSoL8l82Oat5FgqjGMwMyRjLe0vWTlhty3C79EXo+RDA YACOlXhBbcCf2TLQIh5kKVFpxryncQ7OcBwMas32ORB2LMuJBm6j+reOpB1IsLc1IiMU kEVQ== X-Gm-Message-State: AOJu0Yy9sJj08flJE7RPyTWJNnMNA41fzlN5hEiJUuvr76YiJxPELsyg kmgC9bP6X21+dA3j9OjTvd2+AFaXODWYTjX/seMeahSfU4+x5iF5 X-Received: by 2002:ac8:7f10:0:b0:429:9b17:5910 with SMTP id f16-20020ac87f10000000b004299b175910mr296003qtk.136.1704926804016; Wed, 10 Jan 2024 14:46:44 -0800 (PST) Received: from stoup.. ([172.58.27.160]) by smtp.gmail.com with ESMTPSA id ks23-20020ac86217000000b0042987f6874bsm2092281qtb.92.2024.01.10.14.46.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 14:46:43 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: philmd@linaro.org, pbonzini@redhat.com Subject: [PATCH v3 32/38] tcg/ppc: Tidy up tcg_target_const_match Date: Thu, 11 Jan 2024 09:44:02 +1100 Message-Id: <20240110224408.10444-33-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240110224408.10444-1-richard.henderson@linaro.org> References: <20240110224408.10444-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::835; envelope-from=richard.henderson@linaro.org; helo=mail-qt1-x835.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+patch=linaro.org@nongnu.org Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- tcg/ppc/tcg-target.c.inc | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index b9323baa86..26e0bc31d7 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -282,31 +282,36 @@ static bool reloc_pc34(tcg_insn_unit *src_rw, const tcg_insn_unit *target) } /* test if a constant matches the constraint */ -static bool tcg_target_const_match(int64_t val, int ct, +static bool tcg_target_const_match(int64_t sval, int ct, TCGType type, TCGCond cond, int vece) { + uint64_t uval = sval; + if (ct & TCG_CT_CONST) { return 1; } - /* The only 32-bit constraint we use aside from - TCG_CT_CONST is TCG_CT_CONST_S16. */ if (type == TCG_TYPE_I32) { - val = (int32_t)val; + uval = (uint32_t)sval; + sval = (int32_t)sval; } - if ((ct & TCG_CT_CONST_S16) && val == (int16_t)val) { + if ((ct & TCG_CT_CONST_S16) && sval == (int16_t)sval) { return 1; - } else if ((ct & TCG_CT_CONST_S32) && val == (int32_t)val) { + } + if ((ct & TCG_CT_CONST_S32) && sval == (int32_t)sval) { return 1; - } else if ((ct & TCG_CT_CONST_U32) && val == (uint32_t)val) { + } + if ((ct & TCG_CT_CONST_U32) && uval == (uint32_t)uval) { return 1; - } else if ((ct & TCG_CT_CONST_ZERO) && val == 0) { + } + if ((ct & TCG_CT_CONST_ZERO) && sval == 0) { return 1; - } else if ((ct & TCG_CT_CONST_MONE) && val == -1) { + } + if ((ct & TCG_CT_CONST_MONE) && sval == -1) { return 1; - } else if ((ct & TCG_CT_CONST_WSZ) - && val == (type == TCG_TYPE_I32 ? 32 : 64)) { + } + if ((ct & TCG_CT_CONST_WSZ) && sval == (type == TCG_TYPE_I32 ? 32 : 64)) { return 1; } return 0;