mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-09 10:34:58 -06:00
tcg/ppc: Tidy up tcg_target_const_match
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
740f1d40e5
commit
2f2faef6b0
1 changed files with 16 additions and 11 deletions
|
@ -282,31 +282,36 @@ static bool reloc_pc34(tcg_insn_unit *src_rw, const tcg_insn_unit *target)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* test if a constant matches the constraint */
|
/* test if a constant matches the constraint */
|
||||||
static bool tcg_target_const_match(int64_t val, int ct,
|
static bool tcg_target_const_match(int64_t sval, int ct,
|
||||||
TCGType type, TCGCond cond, int vece)
|
TCGType type, TCGCond cond, int vece)
|
||||||
{
|
{
|
||||||
|
uint64_t uval = sval;
|
||||||
|
|
||||||
if (ct & TCG_CT_CONST) {
|
if (ct & TCG_CT_CONST) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The only 32-bit constraint we use aside from
|
|
||||||
TCG_CT_CONST is TCG_CT_CONST_S16. */
|
|
||||||
if (type == TCG_TYPE_I32) {
|
if (type == TCG_TYPE_I32) {
|
||||||
val = (int32_t)val;
|
uval = (uint32_t)sval;
|
||||||
|
sval = (int32_t)sval;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ct & TCG_CT_CONST_S16) && val == (int16_t)val) {
|
if ((ct & TCG_CT_CONST_S16) && sval == (int16_t)sval) {
|
||||||
return 1;
|
return 1;
|
||||||
} else if ((ct & TCG_CT_CONST_S32) && val == (int32_t)val) {
|
}
|
||||||
|
if ((ct & TCG_CT_CONST_S32) && sval == (int32_t)sval) {
|
||||||
return 1;
|
return 1;
|
||||||
} else if ((ct & TCG_CT_CONST_U32) && val == (uint32_t)val) {
|
}
|
||||||
|
if ((ct & TCG_CT_CONST_U32) && uval == (uint32_t)uval) {
|
||||||
return 1;
|
return 1;
|
||||||
} else if ((ct & TCG_CT_CONST_ZERO) && val == 0) {
|
}
|
||||||
|
if ((ct & TCG_CT_CONST_ZERO) && sval == 0) {
|
||||||
return 1;
|
return 1;
|
||||||
} else if ((ct & TCG_CT_CONST_MONE) && val == -1) {
|
}
|
||||||
|
if ((ct & TCG_CT_CONST_MONE) && sval == -1) {
|
||||||
return 1;
|
return 1;
|
||||||
} else if ((ct & TCG_CT_CONST_WSZ)
|
}
|
||||||
&& val == (type == TCG_TYPE_I32 ? 32 : 64)) {
|
if ((ct & TCG_CT_CONST_WSZ) && sval == (type == TCG_TYPE_I32 ? 32 : 64)) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue