target/arm: Use tcg_op_supported

Do not reference TCG_TARGET_HAS_* directly.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
Richard Henderson 2024-12-24 17:08:31 -08:00
parent 09246b1797
commit 3a4fb57013
3 changed files with 8 additions and 6 deletions

View File

@ -8219,6 +8219,7 @@ static bool trans_CCMP(DisasContext *s, arg_CCMP *a)
TCGv_i64 tcg_rn, tcg_y; TCGv_i64 tcg_rn, tcg_y;
DisasCompare c; DisasCompare c;
unsigned nzcv; unsigned nzcv;
bool has_andc;
/* Set T0 = !COND. */ /* Set T0 = !COND. */
arm_test_cc(&c, a->cond); arm_test_cc(&c, a->cond);
@ -8249,17 +8250,18 @@ static bool trans_CCMP(DisasContext *s, arg_CCMP *a)
tcg_gen_subi_i32(tcg_t2, tcg_t0, 1); tcg_gen_subi_i32(tcg_t2, tcg_t0, 1);
nzcv = a->nzcv; nzcv = a->nzcv;
has_andc = tcg_op_supported(INDEX_op_andc_i32, TCG_TYPE_I32, 0);
if (nzcv & 8) { /* N */ if (nzcv & 8) { /* N */
tcg_gen_or_i32(cpu_NF, cpu_NF, tcg_t1); tcg_gen_or_i32(cpu_NF, cpu_NF, tcg_t1);
} else { } else {
if (TCG_TARGET_HAS_andc_i32) { if (has_andc) {
tcg_gen_andc_i32(cpu_NF, cpu_NF, tcg_t1); tcg_gen_andc_i32(cpu_NF, cpu_NF, tcg_t1);
} else { } else {
tcg_gen_and_i32(cpu_NF, cpu_NF, tcg_t2); tcg_gen_and_i32(cpu_NF, cpu_NF, tcg_t2);
} }
} }
if (nzcv & 4) { /* Z */ if (nzcv & 4) { /* Z */
if (TCG_TARGET_HAS_andc_i32) { if (has_andc) {
tcg_gen_andc_i32(cpu_ZF, cpu_ZF, tcg_t1); tcg_gen_andc_i32(cpu_ZF, cpu_ZF, tcg_t1);
} else { } else {
tcg_gen_and_i32(cpu_ZF, cpu_ZF, tcg_t2); tcg_gen_and_i32(cpu_ZF, cpu_ZF, tcg_t2);
@ -8270,7 +8272,7 @@ static bool trans_CCMP(DisasContext *s, arg_CCMP *a)
if (nzcv & 2) { /* C */ if (nzcv & 2) { /* C */
tcg_gen_or_i32(cpu_CF, cpu_CF, tcg_t0); tcg_gen_or_i32(cpu_CF, cpu_CF, tcg_t0);
} else { } else {
if (TCG_TARGET_HAS_andc_i32) { if (has_andc) {
tcg_gen_andc_i32(cpu_CF, cpu_CF, tcg_t1); tcg_gen_andc_i32(cpu_CF, cpu_CF, tcg_t1);
} else { } else {
tcg_gen_and_i32(cpu_CF, cpu_CF, tcg_t2); tcg_gen_and_i32(cpu_CF, cpu_CF, tcg_t2);
@ -8279,7 +8281,7 @@ static bool trans_CCMP(DisasContext *s, arg_CCMP *a)
if (nzcv & 1) { /* V */ if (nzcv & 1) { /* V */
tcg_gen_or_i32(cpu_VF, cpu_VF, tcg_t1); tcg_gen_or_i32(cpu_VF, cpu_VF, tcg_t1);
} else { } else {
if (TCG_TARGET_HAS_andc_i32) { if (has_andc) {
tcg_gen_andc_i32(cpu_VF, cpu_VF, tcg_t1); tcg_gen_andc_i32(cpu_VF, cpu_VF, tcg_t1);
} else { } else {
tcg_gen_and_i32(cpu_VF, cpu_VF, tcg_t2); tcg_gen_and_i32(cpu_VF, cpu_VF, tcg_t2);

View File

@ -622,7 +622,7 @@ static void gen_bsl2n_i64(TCGv_i64 d, TCGv_i64 n, TCGv_i64 m, TCGv_i64 k)
* = | ~(m | k) * = | ~(m | k)
*/ */
tcg_gen_and_i64(n, n, k); tcg_gen_and_i64(n, n, k);
if (TCG_TARGET_HAS_orc_i64) { if (tcg_op_supported(INDEX_op_orc_i64, TCG_TYPE_I64, 0)) {
tcg_gen_or_i64(m, m, k); tcg_gen_or_i64(m, m, k);
tcg_gen_orc_i64(d, n, m); tcg_gen_orc_i64(d, n, m);
} else { } else {

View File

@ -493,7 +493,7 @@ static void gen_add_CC(TCGv_i32 dest, TCGv_i32 t0, TCGv_i32 t1)
static void gen_adc_CC(TCGv_i32 dest, TCGv_i32 t0, TCGv_i32 t1) static void gen_adc_CC(TCGv_i32 dest, TCGv_i32 t0, TCGv_i32 t1)
{ {
TCGv_i32 tmp = tcg_temp_new_i32(); TCGv_i32 tmp = tcg_temp_new_i32();
if (TCG_TARGET_HAS_add2_i32) { if (tcg_op_supported(INDEX_op_add2_i32, TCG_TYPE_I32, 0)) {
tcg_gen_movi_i32(tmp, 0); tcg_gen_movi_i32(tmp, 0);
tcg_gen_add2_i32(cpu_NF, cpu_CF, t0, tmp, cpu_CF, tmp); tcg_gen_add2_i32(cpu_NF, cpu_CF, t0, tmp, cpu_CF, tmp);
tcg_gen_add2_i32(cpu_NF, cpu_CF, cpu_NF, cpu_CF, t1, tmp); tcg_gen_add2_i32(cpu_NF, cpu_CF, cpu_NF, cpu_CF, t1, tmp);