[PATCH] target/mips: Simplify gen_msa_BxZ() 'if' condition

Philippe Mathieu-Daudé posted 1 patch 4 years, 11 months ago
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20201204225953.2755588-1-f4bug@amsat.org
Maintainers: Aurelien Jarno <aurelien@aurel32.net>, Aleksandar Rikalo <aleksandar.rikalo@syrmia.com>, Jiaxun Yang <jiaxun.yang@flygoat.com>, "Philippe Mathieu-Daudé" <f4bug@amsat.org>
target/mips/translate.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
[PATCH] target/mips: Simplify gen_msa_BxZ() 'if' condition
Posted by Philippe Mathieu-Daudé 4 years, 11 months ago
As gen_check_zero_element() already produces a boolean,
replace 'if (x) tcg_gen_setcondi_tl()' by tcg_gen_xori_tl(x)
which already contains the if (x).

Suggested-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
Based-on: <20201202184415.1434484-1-f4bug@amsat.org>
---
 target/mips/translate.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/target/mips/translate.c b/target/mips/translate.c
index 8a35d4d0d03..112a5becfbb 100644
--- a/target/mips/translate.c
+++ b/target/mips/translate.c
@@ -28778,9 +28778,7 @@ static bool gen_msa_BxZ(DisasContext *ctx, int df, int wt, int s16, bool if_not)
     }
 
     gen_check_zero_element(bcond, df, wt);
-    if (if_not) {
-        tcg_gen_setcondi_tl(TCG_COND_EQ, bcond, bcond, 0);
-    }
+    tcg_gen_xori_tl(bcond, bcond, if_not);
 
     ctx->btarget = ctx->base.pc_next + (s16 << 2) + 4;
     ctx->hflags |= MIPS_HFLAG_BC;
-- 
2.26.2