From patchwork Tue Mar 12 14:38:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 779758 Delivered-To: patch@linaro.org Received: by 2002:a5d:604e:0:b0:33e:7753:30bd with SMTP id j14csp2058069wrt; Tue, 12 Mar 2024 07:44:47 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVKL+gU/UELyBcb3ITOhTStVumIa9eM6DWeQcgNkvzqXH8gaJSbVv5YA+LJHsHUH51ejioKe+g6/BRaXv0BNnkJ X-Google-Smtp-Source: AGHT+IGSYc2U5wDAzi7+WLcJKgcGHpHAcZHspH82A1k2pvzLk6dlAyrON/5qB6Hf7TmyxCQV6Kdv X-Received: by 2002:a05:6808:2f0c:b0:3c2:266e:4e38 with SMTP id gu12-20020a0568082f0c00b003c2266e4e38mr2533281oib.25.1710254687577; Tue, 12 Mar 2024 07:44:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710254687; cv=none; d=google.com; s=arc-20160816; b=iNUip02dKZxEo1ZMFQRs2BXJD/0feYC27PUpIMXIczPdkuO8JP7oGoWpu7BDp1FuqC jIuR5MJwwSmb4xBOccS6uGpo25uDeY2RZlHrp25ibydL6777onKrH8EQSzTn1wqp70yG 4yJJAe3VZkveZH+nQVPFrGP+m9Hpld3GyDVNVfefDgNqMfELlhBDlmwGOek+vgdBSczA 89R3ZmSH8La0iUKTCl9bik7JWHxBt2BlALwblRUog08m618HSYh2TddavaPke2nHJMam 3I28cruTk3/WwPi2rIr/MdiCj8K5DOTjQ/ow+ID/6SIRm3zEgY26A96/qBQ/oSRN4+2a h4LA== 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=jbNLo5y1YUnPREukd4mIwrgqxX0R9HS5MZo8QZlenPA=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=W+XKDbmRsiEpPuVspzs54SP257xCuymn8ygWfj5OF1KJR1YxlF+HBrrmtQP7xaISCk l1na7CLHwQQjjD+WDqqIGcLBnOobpO1tmk/sN4GOC7VjG4tXbh+ZsbU6Sy6MCcBnaE1x WQ9aeb/lVT2uskqXbVZ93sVMjC5Z8eS9A00jM0zB6sewSrYh5/KSQ0iRMNjq8WHCigXn WOdr2AsypgTx1I1n2J5LfHspOSjOQJreh3odmxPxpxVIXxBh9nG5iI8eiBwCX1KIRQWW qt5LyCTk2Pa/iluL1RfOm/Kqtmq+DENguqNQeSHTqLzMcx4X7LFBV796msVubjfPFBhr 4ppA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EyMHQIRO; 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 l20-20020a05622a051400b0042ef54b193csi7898891qtx.668.2024.03.12.07.44.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Mar 2024 07:44:47 -0700 (PDT) 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=EyMHQIRO; 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 1rk3I1-0003eb-4O; Tue, 12 Mar 2024 10:39:37 -0400 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 1rk3Ha-0003Xb-Ll for qemu-devel@nongnu.org; Tue, 12 Mar 2024 10:39:12 -0400 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rk3HL-0007kK-Rq for qemu-devel@nongnu.org; Tue, 12 Mar 2024 10:39:09 -0400 Received: by mail-pj1-x102d.google.com with SMTP id 98e67ed59e1d1-29c14800a7fso1409131a91.2 for ; Tue, 12 Mar 2024 07:38:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710254334; x=1710859134; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=jbNLo5y1YUnPREukd4mIwrgqxX0R9HS5MZo8QZlenPA=; b=EyMHQIROka49yu0z6FCyh9iWfivz0aJvFOVJDT897Nz0Lbi9nrPUVdViaS3Rguq5OK lr2uN9ZosPpleiFxtScNGRMhYYFJPhEV0ZF5orR4dKBtAIaGx57DJyj4euOjxJxwlG+W kSJ3yZblpu4Oawpu94qys8jDbyWyyh9r5EPoR9vB7PnTDALITphS+sHwhX7w1PIPsUGu /DcN711UtfpN4Xu5azWh/XcTM4+d0BdtFjhyJDuU+LNPdX48NXAEtkxL8fKhuhgqxyaQ MTA3ZeO4lVuz3KvxslfUdiOqP9NPBG/Eti7OMxyUm3WL7nwit1lue5UvaIpKXwIgKZfA 4EvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710254334; x=1710859134; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jbNLo5y1YUnPREukd4mIwrgqxX0R9HS5MZo8QZlenPA=; b=hprl1sdYgVCCawH5cXFLbj+TYjVxoRgVuwAGnNqFq/eeIfBITwb3sYcP4K0iOOc+VK ApW/XaIszmK35O9dZneChp/UYjw4Ue+gdwZMfl+K7CKqxMENEdBQ3GFHBhvU5/TJj6B2 Dmtn5f1UlAxMIDID9UFCjpG995C+oGqz4whV1vAKnIdzHNCxT3DqbGIyqUZsEaz15Wtf 91IChrgr3T0AYsKc7sCTFjEChEKtq67fZJq7/2/ANJDEMkzxRZbkXoa0QUAbP2Llb8gz GtgbH3ArUfSvm6BbzxVI2yPoPv/IHSWNx86HEwECKOek+FRdCM3F05YKM2kLnWeLMnVk nddA== X-Gm-Message-State: AOJu0YwiMKjU0PwRfk6ll6T0gMG0+xeXHynF1Zddt3LYKIp2SXg4P9Du RxLLvmdNMum2tIbvOUWlqGrJJlmSZHDv5wq3HWzdiqvg8kprRP4L4S0iVTZuN+BwPveQLVbMNIe g X-Received: by 2002:a17:90b:4c87:b0:29b:3cae:c50d with SMTP id my7-20020a17090b4c8700b0029b3caec50dmr2221819pjb.0.1710254334606; Tue, 12 Mar 2024 07:38:54 -0700 (PDT) Received: from stoup.. (173-197-098-125.biz.spectrum.com. [173.197.98.125]) by smtp.gmail.com with ESMTPSA id jx15-20020a17090b46cf00b0029baa0b1a6csm7492214pjb.24.2024.03.12.07.38.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 07:38:54 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 08/15] tcg/loongarch64: Do not accept immediate operand for andc, orc Date: Tue, 12 Mar 2024 04:38:32 -1000 Message-Id: <20240312143839.136408-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240312143839.136408-1-richard.henderson@linaro.org> References: <20240312143839.136408-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102d; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102d.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 The transformations with inverted immediate are now done generically and need not be handled by the backend. Signed-off-by: Richard Henderson --- tcg/loongarch64/tcg-target-con-set.h | 2 +- tcg/loongarch64/tcg-target-con-str.h | 1 - tcg/loongarch64/tcg-target.c.inc | 31 ++++++---------------------- 3 files changed, 7 insertions(+), 27 deletions(-) diff --git a/tcg/loongarch64/tcg-target-con-set.h b/tcg/loongarch64/tcg-target-con-set.h index cae6c2aad6..272f33c1e4 100644 --- a/tcg/loongarch64/tcg-target-con-set.h +++ b/tcg/loongarch64/tcg-target-con-set.h @@ -22,7 +22,7 @@ C_O0_I3(r, r, r) C_O1_I1(r, r) C_O1_I1(w, r) C_O1_I1(w, w) -C_O1_I2(r, r, rC) +C_O1_I2(r, r, r) C_O1_I2(r, r, ri) C_O1_I2(r, r, rI) C_O1_I2(r, r, rJ) diff --git a/tcg/loongarch64/tcg-target-con-str.h b/tcg/loongarch64/tcg-target-con-str.h index 2ba9c135ac..e7d2686db3 100644 --- a/tcg/loongarch64/tcg-target-con-str.h +++ b/tcg/loongarch64/tcg-target-con-str.h @@ -24,7 +24,6 @@ CONST('I', TCG_CT_CONST_S12) CONST('J', TCG_CT_CONST_S32) CONST('U', TCG_CT_CONST_U12) CONST('Z', TCG_CT_CONST_ZERO) -CONST('C', TCG_CT_CONST_C12) CONST('W', TCG_CT_CONST_WSZ) CONST('M', TCG_CT_CONST_VCMP) CONST('A', TCG_CT_CONST_VADD) diff --git a/tcg/loongarch64/tcg-target.c.inc b/tcg/loongarch64/tcg-target.c.inc index 69c5b8ac4f..e343d33dba 100644 --- a/tcg/loongarch64/tcg-target.c.inc +++ b/tcg/loongarch64/tcg-target.c.inc @@ -169,10 +169,9 @@ static TCGReg tcg_target_call_oarg_reg(TCGCallReturnKind kind, int slot) #define TCG_CT_CONST_S12 0x200 #define TCG_CT_CONST_S32 0x400 #define TCG_CT_CONST_U12 0x800 -#define TCG_CT_CONST_C12 0x1000 -#define TCG_CT_CONST_WSZ 0x2000 -#define TCG_CT_CONST_VCMP 0x4000 -#define TCG_CT_CONST_VADD 0x8000 +#define TCG_CT_CONST_WSZ 0x1000 +#define TCG_CT_CONST_VCMP 0x2000 +#define TCG_CT_CONST_VADD 0x4000 #define ALL_GENERAL_REGS MAKE_64BIT_MASK(0, 32) #define ALL_VECTOR_REGS MAKE_64BIT_MASK(32, 32) @@ -201,9 +200,6 @@ static bool tcg_target_const_match(int64_t val, int ct, if ((ct & TCG_CT_CONST_U12) && val >= 0 && val <= 0xfff) { return true; } - if ((ct & TCG_CT_CONST_C12) && ~val >= 0 && ~val <= 0xfff) { - return true; - } if ((ct & TCG_CT_CONST_WSZ) && val == (type == TCG_TYPE_I32 ? 32 : 64)) { return true; } @@ -1236,22 +1232,12 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, case INDEX_op_andc_i32: case INDEX_op_andc_i64: - if (c2) { - /* guaranteed to fit due to constraint */ - tcg_out_opc_andi(s, a0, a1, ~a2); - } else { - tcg_out_opc_andn(s, a0, a1, a2); - } + tcg_out_opc_andn(s, a0, a1, a2); break; case INDEX_op_orc_i32: case INDEX_op_orc_i64: - if (c2) { - /* guaranteed to fit due to constraint */ - tcg_out_opc_ori(s, a0, a1, ~a2); - } else { - tcg_out_opc_orn(s, a0, a1, a2); - } + tcg_out_opc_orn(s, a0, a1, a2); break; case INDEX_op_and_i32: @@ -2120,12 +2106,7 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) case INDEX_op_andc_i64: case INDEX_op_orc_i32: case INDEX_op_orc_i64: - /* - * LoongArch insns for these ops don't have reg-imm forms, but we - * can express using andi/ori if ~constant satisfies - * TCG_CT_CONST_U12. - */ - return C_O1_I2(r, r, rC); + return C_O1_I2(r, r, r); case INDEX_op_shl_i32: case INDEX_op_shl_i64: