[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 02/22] tcg/i386: Move constraint type check to tcg_target_const_m
From: |
Richard Henderson |
Subject: |
[PATCH 02/22] tcg/i386: Move constraint type check to tcg_target_const_match |
Date: |
Tue, 22 Dec 2020 22:01:44 -0800 |
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.
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 d8797ed398..b73873f715 100644
--- a/tcg/i386/tcg-target.c.inc
+++ b/tcg/i386/tcg-target.c.inc
@@ -254,13 +254,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:
@@ -277,14 +277,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 (TCG_TARGET_REG_BITS == 32 || 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
- [PATCH 00/22] tcg: backend constraints cleanup, Richard Henderson, 2020/12/23
- [PATCH 01/22] tcg/tci: Drop L and S constraints, Richard Henderson, 2020/12/23
- [PATCH 05/22] tcg/aarch64: Convert to tcg-target-constr.h, Richard Henderson, 2020/12/23
- [PATCH 03/22] tcg: Split out target constraints to tcg-target-constr.h, Richard Henderson, 2020/12/23
- [PATCH 13/22] tcg: Split out constraint sets to tcg-target-conset.h, Richard Henderson, 2020/12/23
- [PATCH 02/22] tcg/i386: Move constraint type check to tcg_target_const_match,
Richard Henderson <=
- [PATCH 04/22] tcg/arm: Convert to tcg-target-constr.h, Richard Henderson, 2020/12/23
- [PATCH 09/22] tcg/riscv: Convert to tcg-target-constr.h, Richard Henderson, 2020/12/23
- [PATCH 10/22] tcg/s390: Convert to tcg-target-constr.h, Richard Henderson, 2020/12/23
- [PATCH 07/22] tcg/tci: Convert to tcg-target-constr.h, Richard Henderson, 2020/12/23
- [PATCH 06/22] tcg/ppc: Convert to tcg-target-constr.h, Richard Henderson, 2020/12/23
- [PATCH 16/22] tcg/mips: Convert to tcg-target-conset.h, Richard Henderson, 2020/12/23
- [PATCH 22/22] tcg: Remove TCG_TARGET_CONSET_H, Richard Henderson, 2020/12/23
- [PATCH 17/22] tcg/ppc: Convert to tcg-target-conset.h, Richard Henderson, 2020/12/23
- [PATCH 11/22] tcg/sparc: Convert to tcg-target-constr.h, Richard Henderson, 2020/12/23
- [PATCH 15/22] tcg/arm: Convert to tcg-target-conset.h, Richard Henderson, 2020/12/23