[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 03/24] tcg/i386: Move constraint type check to tcg_target_const_ma
From: |
Richard Henderson |
Subject: |
[PULL 03/24] tcg/i386: Move constraint type check to tcg_target_const_match |
Date: |
Tue, 2 Feb 2021 16:15:29 -1000 |
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.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/i386/tcg-target.c.inc | 28 +++++++++++++++++-----------
1 file changed, 17 insertions(+), 11 deletions(-)
diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc
index 050f3cb0b1..540debdf34 100644
--- a/tcg/i386/tcg-target.c.inc
+++ b/tcg/i386/tcg-target.c.inc
@@ -263,13 +263,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:
@@ -286,14 +286,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 (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;
--
2.25.1
- [PULL 00/24] tcg patch queue, Richard Henderson, 2021/02/02
- [PULL 01/24] tcg/tci: Drop L and S constraints, Richard Henderson, 2021/02/02
- [PULL 03/24] tcg/i386: Move constraint type check to tcg_target_const_match,
Richard Henderson <=
- [PULL 02/24] tcg/tci: Remove TCG_TARGET_HAS_* ifdefs, Richard Henderson, 2021/02/02
- [PULL 04/24] tcg/i386: Tidy register constraint definitions, Richard Henderson, 2021/02/02
- [PULL 05/24] tcg/i386: Split out target constraints to tcg-target-con-str.h, Richard Henderson, 2021/02/02
- [PULL 07/24] tcg/aarch64: Split out target constraints to tcg-target-con-str.h, Richard Henderson, 2021/02/02
- [PULL 06/24] tcg/arm: Split out target constraints to tcg-target-con-str.h, Richard Henderson, 2021/02/02
- [PULL 10/24] tcg/mips: Split out target constraints to tcg-target-con-str.h, Richard Henderson, 2021/02/02
- [PULL 11/24] tcg/riscv: Split out target constraints to tcg-target-con-str.h, Richard Henderson, 2021/02/02
- [PULL 08/24] tcg/ppc: Split out target constraints to tcg-target-con-str.h, Richard Henderson, 2021/02/02
- [PULL 12/24] tcg/s390: Split out target constraints to tcg-target-con-str.h, Richard Henderson, 2021/02/02
- [PULL 09/24] tcg/tci: Split out target constraints to tcg-target-con-str.h, Richard Henderson, 2021/02/02