Skip to contentSkip to conversation

target-mips: Fix Loongson pandn instruction.

PATCH In review Heiher 2 participants 2 messages Oct 13, 2016

lore
Share & tools
lore

Heiher

author
#0 lore raw

PATCH 1/1 target-mips: Fix Loongson pandn instruction.

From: Heiher <[email protected]>

pandn FD, FS, FT
Operation: FD = ((NOT FS) AND FT)

---
 target-mips/translate.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
target-mips/translate.c +3 -1
index 55c2ca0..ed67180 100644
@@ -3880,6 +3880,8 @@ static void gen_loongson_multimedia(DisasContext *ctx, int rd, int rs, int rt)
     case OPC_##UP: gen_helper_##LO(t0, t0); break
 #define LMI_DIRECT(UP, LO, OP) \
     case OPC_##UP: tcg_gen_##OP##_i64(t0, t0, t1); break
+#define LMI_DIRECT_SWAP(UP, LO, OP) \
+    case OPC_##UP: tcg_gen_##OP##_i64(t0, t1, t0); break
 
     switch (opc) {
     LMI_HELPER(PADDSH, paddsh);
@@ -3945,8 +3947,8 @@ static void gen_loongson_multimedia(DisasContext *ctx, int rd, int rs, int rt)
     LMI_DIRECT(XOR_CP2, xor, xor);
     LMI_DIRECT(NOR_CP2, nor, nor);
     LMI_DIRECT(AND_CP2, and, and);
-    LMI_DIRECT(PANDN, pandn, andc);
     LMI_DIRECT(OR, or, or);
+    LMI_DIRECT_SWAP(PANDN, pandn, andc);
 
     case OPC_PINSRH_0:
         tcg_gen_deposit_i64(t0, t0, t1, 0, 16);
Signature · 1 line
2.10.0
#1 lore raw
Quoted 16 lines · Heiher

From: Heiher <[email protected]>

pandn FD, FS, FT
Operation: FD = ((NOT FS) AND FT)

---
 target-mips/translate.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
target-mips/translate.c +0 -0
index 55c2ca0..ed67180 100644

target-mips/translate.c static void gen_loongson_multimedia(DisasContext *ctx, int rd, int rs, int rt) · line 3884

Quoted 5 lines
target-mips/translate.c +2 -0
@@ -3880,6 +3880,8 @@ static void gen_loongson_multimedia(DisasContext *ctx, int rd, int rs, int rt)
     case OPC_##UP: gen_helper_##LO(t0, t0); break
 #define LMI_DIRECT(UP, LO, OP) \
     case OPC_##UP: tcg_gen_##OP##_i64(t0, t0, t1); break
+#define LMI_DIRECT_SWAP(UP, LO, OP) \
+    case OPC_##UP: tcg_gen_##OP##_i64(t0, t1, t0); break

It is used only once. No need to make it as a macro.

target-mips/translate.c static void gen_loongson_multimedia(DisasContext *ctx, int rd, int rs, int rt) · line 3951

Quoted 10 lines
target-mips/translate.c +1 -1
     switch (opc) {
     LMI_HELPER(PADDSH, paddsh);
@@ -3945,8 +3947,8 @@ static void gen_loongson_multimedia(DisasContext *ctx, int rd, int rs, int rt)
     LMI_DIRECT(XOR_CP2, xor, xor);
     LMI_DIRECT(NOR_CP2, nor, nor);
     LMI_DIRECT(AND_CP2, and, and);
-    LMI_DIRECT(PANDN, pandn, andc);
     LMI_DIRECT(OR, or, or);
+    LMI_DIRECT_SWAP(PANDN, pandn, andc);

case OPC_PANDN: tcg_gen_andc_i64(t0, t1, t0); break; Would it be sufficient?

target-mips/translate.c static void gen_loongson_multimedia(DisasContext *ctx, int rd, int rs, int rt)

Quoted 4 lines
target-mips/translate.c +0 -0
     case OPC_PINSRH_0:
         tcg_gen_deposit_i64(t0, t0, t1, 0, 16);
 

Thanks for the fix.

Regards,
Yongbok