[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 03/15] tcg/optimize: Fold eqv with immediate to xor
From: |
Richard Henderson |
Subject: |
[PATCH 03/15] tcg/optimize: Fold eqv with immediate to xor |
Date: |
Tue, 12 Mar 2024 04:38:27 -1000 |
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/optimize.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/tcg/optimize.c b/tcg/optimize.c
index 5729433548..c6b0ab35c8 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -1687,6 +1687,15 @@ static bool fold_eqv(OptContext *ctx, TCGOp *op)
return true;
}
+ /* Fold eqv r,x,i to xor r,x,~i. */
+ if (arg_is_const(op->args[2])) {
+ uint64_t val = ~arg_info(op->args[2])->val;
+
+ op->opc = (ctx->type == TCG_TYPE_I32
+ ? INDEX_op_xor_i32 : INDEX_op_xor_i64);
+ op->args[2] = arg_new_constant(ctx, val);
+ }
+
ctx->s_mask = arg_info(op->args[1])->s_mask
& arg_info(op->args[2])->s_mask;
return false;
--
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, 2024/03/12
- [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 <=
- [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
- [PATCH 09/15] tcg/s390x: Do not accept immediate operand for andc, orc, Richard Henderson, 2024/03/12
- [PATCH 14/15] tcg: Use arg_is_const_val in fold_sub_to_neg, Richard Henderson, 2024/03/12