[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 08/15] tcg/loongarch64: Do not accept immediate operand for andc,
From: |
Richard Henderson |
Subject: |
[PATCH 08/15] tcg/loongarch64: Do not accept immediate operand for andc, orc |
Date: |
Tue, 12 Mar 2024 04:38:32 -1000 |
The transformations with inverted immediate are now done
generically and need not be handled by the backend.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
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:
--
2.34.1
- [PATCH for-9.1 00/15] tcg: Canonicalize operations during optimize, Richard Henderson, 2024/03/12
- [PATCH 01/15] tcg/optimize: Fold andc with immediate to and, Richard Henderson, 2024/03/12
- [PATCH 06/15] tcg/arm: Do not accept immediate operand for andc, Richard Henderson, 2024/03/12
- [PATCH 08/15] tcg/loongarch64: Do not accept immediate operand for andc, orc,
Richard Henderson <=
- [PATCH 11/15] tcg/riscv: Do not accept immediate operands for sub, Richard Henderson, 2024/03/12
- [PATCH 02/15] tcg/optimize: Fold orc with immediate to or, Richard Henderson, 2024/03/12
- [PATCH 03/15] tcg/optimize: Fold eqv with immediate to xor, Richard Henderson, 2024/03/12
- [PATCH 05/15] tcg/aarch64: Do not accept immediate operand for andc, orc, eqv, Richard Henderson, 2024/03/12
- [PATCH 04/15] tcg/i386: Do not accept immediate operand for andc, Richard Henderson, 2024/03/12
- [PATCH 10/15] tcg/riscv: Do not accept immediate operand for andc, orc, eqv, Richard Henderson, 2024/03/12
- [PATCH 15/15] tcg/optimize: Lower unsupported deposit during optimize, Richard Henderson, 2024/03/12
- [PATCH 07/15] tcg/ppc: Do not accept immediate operand for andc, orc, eqv, Richard Henderson, 2024/03/12
- [PATCH 13/15] tcg/optimize: Fold and to extu during optimize, Richard Henderson, 2024/03/12
- [PATCH 12/15] tcg/riscv: Do not accept zero operands for logicals, multiply or divide, Richard Henderson, 2024/03/12