|
From: | Richard Henderson |
Subject: | Re: [PATCH v3 14/37] target/ppc: implement vstri[bh][lr] |
Date: | Fri, 11 Feb 2022 16:00:46 +1100 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 |
On 2/10/22 23:34, matheus.ferst@eldorado.org.br wrote:
+#define VSTRI(NAME, ELEM, NUM_ELEMS, LEFT) \ +void helper_##NAME(CPUPPCState *env, ppc_avr_t *t, ppc_avr_t *b, \ + target_ulong rc) \ +{ \ + bool null_found = false; \ + int i, idx; \ + \ + for (i = 0; i < NUM_ELEMS; i++) { \ + idx = LEFT ? i : NUM_ELEMS - i - 1; \ + if (b->Vsr##ELEM(idx)) { \ + t->Vsr##ELEM(idx) = b->Vsr##ELEM(idx); \ + } else { \ + null_found = true; \ + break; \ + } \ + } \ + \ + for (; i < NUM_ELEMS; i++) { \ + idx = LEFT ? i : NUM_ELEMS - i - 1; \ + t->Vsr##ELEM(idx) = 0; \ + } \ + \ + if (rc) { \ + env->crf[6] = null_found ? 0b0010 : 0; \ + } \ +}
The only reason you're passing in env is for crf[6], which requires you to pass in a second argument. And you're not using the return value.
It would be better to always return the rc value, and only conditionally assign it. E.g. if (a->rc) { gen_helper(cpu_crf[6], vrt, vrb); } else { TCGv_i32 discard = tcg_temp_new_i32(); gen_helper(discard, vrt, vrb); tcg_temp_free_i32(discard); } r~
[Prev in Thread] | Current Thread | [Next in Thread] |