[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 13/20] target/mips: Demacro LMI decoder
From: |
Aleksandar Markovic |
Subject: |
[PULL 13/20] target/mips: Demacro LMI decoder |
Date: |
Fri, 25 Oct 2019 18:44:15 +0200 |
From: Aleksandar Markovic <address@hidden>
This makes searches for instances of opcode usages easier.
Reviewed-by: Aleksandar Rikalo <address@hidden>
Signed-off-by: Aleksandar Markovic <address@hidden>
Message-Id: <address@hidden>
---
target/mips/translate.c | 248 +++++++++++++++++++++++++++++++++---------------
1 file changed, 174 insertions(+), 74 deletions(-)
diff --git a/target/mips/translate.c b/target/mips/translate.c
index 20c69d2..4bff585 100644
--- a/target/mips/translate.c
+++ b/target/mips/translate.c
@@ -5546,78 +5546,181 @@ static void gen_loongson_multimedia(DisasContext *ctx,
int rd, int rs, int rt)
gen_load_fpr64(ctx, t0, rs);
gen_load_fpr64(ctx, t1, rt);
-#define LMI_HELPER(UP, LO) \
- case OPC_##UP: gen_helper_##LO(t0, t0, t1); break
-#define LMI_HELPER_1(UP, LO) \
- 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
-
switch (opc) {
- LMI_HELPER(PADDSH, paddsh);
- LMI_HELPER(PADDUSH, paddush);
- LMI_HELPER(PADDH, paddh);
- LMI_HELPER(PADDW, paddw);
- LMI_HELPER(PADDSB, paddsb);
- LMI_HELPER(PADDUSB, paddusb);
- LMI_HELPER(PADDB, paddb);
-
- LMI_HELPER(PSUBSH, psubsh);
- LMI_HELPER(PSUBUSH, psubush);
- LMI_HELPER(PSUBH, psubh);
- LMI_HELPER(PSUBW, psubw);
- LMI_HELPER(PSUBSB, psubsb);
- LMI_HELPER(PSUBUSB, psubusb);
- LMI_HELPER(PSUBB, psubb);
-
- LMI_HELPER(PSHUFH, pshufh);
- LMI_HELPER(PACKSSWH, packsswh);
- LMI_HELPER(PACKSSHB, packsshb);
- LMI_HELPER(PACKUSHB, packushb);
-
- LMI_HELPER(PUNPCKLHW, punpcklhw);
- LMI_HELPER(PUNPCKHHW, punpckhhw);
- LMI_HELPER(PUNPCKLBH, punpcklbh);
- LMI_HELPER(PUNPCKHBH, punpckhbh);
- LMI_HELPER(PUNPCKLWD, punpcklwd);
- LMI_HELPER(PUNPCKHWD, punpckhwd);
-
- LMI_HELPER(PAVGH, pavgh);
- LMI_HELPER(PAVGB, pavgb);
- LMI_HELPER(PMAXSH, pmaxsh);
- LMI_HELPER(PMINSH, pminsh);
- LMI_HELPER(PMAXUB, pmaxub);
- LMI_HELPER(PMINUB, pminub);
-
- LMI_HELPER(PCMPEQW, pcmpeqw);
- LMI_HELPER(PCMPGTW, pcmpgtw);
- LMI_HELPER(PCMPEQH, pcmpeqh);
- LMI_HELPER(PCMPGTH, pcmpgth);
- LMI_HELPER(PCMPEQB, pcmpeqb);
- LMI_HELPER(PCMPGTB, pcmpgtb);
-
- LMI_HELPER(PSLLW, psllw);
- LMI_HELPER(PSLLH, psllh);
- LMI_HELPER(PSRLW, psrlw);
- LMI_HELPER(PSRLH, psrlh);
- LMI_HELPER(PSRAW, psraw);
- LMI_HELPER(PSRAH, psrah);
-
- LMI_HELPER(PMULLH, pmullh);
- LMI_HELPER(PMULHH, pmulhh);
- LMI_HELPER(PMULHUH, pmulhuh);
- LMI_HELPER(PMADDHW, pmaddhw);
-
- LMI_HELPER(PASUBUB, pasubub);
- LMI_HELPER_1(BIADD, biadd);
- LMI_HELPER_1(PMOVMSKB, pmovmskb);
-
- LMI_DIRECT(PADDD, paddd, add);
- LMI_DIRECT(PSUBD, psubd, sub);
- LMI_DIRECT(XOR_CP2, xor, xor);
- LMI_DIRECT(NOR_CP2, nor, nor);
- LMI_DIRECT(AND_CP2, and, and);
- LMI_DIRECT(OR_CP2, or, or);
+ case OPC_PADDSH:
+ gen_helper_paddsh(t0, t0, t1);
+ break;
+ case OPC_PADDUSH:
+ gen_helper_paddush(t0, t0, t1);
+ break;
+ case OPC_PADDH:
+ gen_helper_paddh(t0, t0, t1);
+ break;
+ case OPC_PADDW:
+ gen_helper_paddw(t0, t0, t1);
+ break;
+ case OPC_PADDSB:
+ gen_helper_paddsb(t0, t0, t1);
+ break;
+ case OPC_PADDUSB:
+ gen_helper_paddusb(t0, t0, t1);
+ break;
+ case OPC_PADDB:
+ gen_helper_paddb(t0, t0, t1);
+ break;
+
+ case OPC_PSUBSH:
+ gen_helper_psubsh(t0, t0, t1);
+ break;
+ case OPC_PSUBUSH:
+ gen_helper_psubush(t0, t0, t1);
+ break;
+ case OPC_PSUBH:
+ gen_helper_psubh(t0, t0, t1);
+ break;
+ case OPC_PSUBW:
+ gen_helper_psubw(t0, t0, t1);
+ break;
+ case OPC_PSUBSB:
+ gen_helper_psubsb(t0, t0, t1);
+ break;
+ case OPC_PSUBUSB:
+ gen_helper_psubusb(t0, t0, t1);
+ break;
+ case OPC_PSUBB:
+ gen_helper_psubb(t0, t0, t1);
+ break;
+
+ case OPC_PSHUFH:
+ gen_helper_pshufh(t0, t0, t1);
+ break;
+ case OPC_PACKSSWH:
+ gen_helper_packsswh(t0, t0, t1);
+ break;
+ case OPC_PACKSSHB:
+ gen_helper_packsshb(t0, t0, t1);
+ break;
+ case OPC_PACKUSHB:
+ gen_helper_packushb(t0, t0, t1);
+ break;
+
+ case OPC_PUNPCKLHW:
+ gen_helper_punpcklhw(t0, t0, t1);
+ break;
+ case OPC_PUNPCKHHW:
+ gen_helper_punpckhhw(t0, t0, t1);
+ break;
+ case OPC_PUNPCKLBH:
+ gen_helper_punpcklbh(t0, t0, t1);
+ break;
+ case OPC_PUNPCKHBH:
+ gen_helper_punpckhbh(t0, t0, t1);
+ break;
+ case OPC_PUNPCKLWD:
+ gen_helper_punpcklwd(t0, t0, t1);
+ break;
+ case OPC_PUNPCKHWD:
+ gen_helper_punpckhwd(t0, t0, t1);
+ break;
+
+ case OPC_PAVGH:
+ gen_helper_pavgh(t0, t0, t1);
+ break;
+ case OPC_PAVGB:
+ gen_helper_pavgb(t0, t0, t1);
+ break;
+ case OPC_PMAXSH:
+ gen_helper_pmaxsh(t0, t0, t1);
+ break;
+ case OPC_PMINSH:
+ gen_helper_pminsh(t0, t0, t1);
+ break;
+ case OPC_PMAXUB:
+ gen_helper_pmaxub(t0, t0, t1);
+ break;
+ case OPC_PMINUB:
+ gen_helper_pminub(t0, t0, t1);
+ break;
+
+ case OPC_PCMPEQW:
+ gen_helper_pcmpeqw(t0, t0, t1);
+ break;
+ case OPC_PCMPGTW:
+ gen_helper_pcmpgtw(t0, t0, t1);
+ break;
+ case OPC_PCMPEQH:
+ gen_helper_pcmpeqh(t0, t0, t1);
+ break;
+ case OPC_PCMPGTH:
+ gen_helper_pcmpgth(t0, t0, t1);
+ break;
+ case OPC_PCMPEQB:
+ gen_helper_pcmpeqb(t0, t0, t1);
+ break;
+ case OPC_PCMPGTB:
+ gen_helper_pcmpgtb(t0, t0, t1);
+ break;
+
+ case OPC_PSLLW:
+ gen_helper_psllw(t0, t0, t1);
+ break;
+ case OPC_PSLLH:
+ gen_helper_psllh(t0, t0, t1);
+ break;
+ case OPC_PSRLW:
+ gen_helper_psrlw(t0, t0, t1);
+ break;
+ case OPC_PSRLH:
+ gen_helper_psrlh(t0, t0, t1);
+ break;
+ case OPC_PSRAW:
+ gen_helper_psraw(t0, t0, t1);
+ break;
+ case OPC_PSRAH:
+ gen_helper_psrah(t0, t0, t1);
+ break;
+
+ case OPC_PMULLH:
+ gen_helper_pmullh(t0, t0, t1);
+ break;
+ case OPC_PMULHH:
+ gen_helper_pmulhh(t0, t0, t1);
+ break;
+ case OPC_PMULHUH:
+ gen_helper_pmulhuh(t0, t0, t1);
+ break;
+ case OPC_PMADDHW:
+ gen_helper_pmaddhw(t0, t0, t1);
+ break;
+
+ case OPC_PASUBUB:
+ gen_helper_pasubub(t0, t0, t1);
+ break;
+ case OPC_BIADD:
+ gen_helper_biadd(t0, t0);
+ break;
+ case OPC_PMOVMSKB:
+ gen_helper_pmovmskb(t0, t0);
+ break;
+
+ case OPC_PADDD:
+ tcg_gen_add_i64(t0, t0, t1);
+ break;
+ case OPC_PSUBD:
+ tcg_gen_sub_i64(t0, t0, t1);
+ break;
+ case OPC_XOR_CP2:
+ tcg_gen_xor_i64(t0, t0, t1);
+ break;
+ case OPC_NOR_CP2:
+ tcg_gen_nor_i64(t0, t0, t1);
+ break;
+ case OPC_AND_CP2:
+ tcg_gen_and_i64(t0, t0, t1);
+ break;
+ case OPC_OR_CP2:
+ tcg_gen_or_i64(t0, t0, t1);
+ break;
case OPC_PANDN:
tcg_gen_andc_i64(t0, t1, t0);
@@ -5770,9 +5873,6 @@ static void gen_loongson_multimedia(DisasContext *ctx,
int rd, int rs, int rt)
return;
}
-#undef LMI_HELPER
-#undef LMI_DIRECT
-
gen_store_fpr64(ctx, t0, rd);
tcg_temp_free_i64(t0);
--
2.7.4
- [PULL 00/20] MIPS queue for October 24th, 2019 - v2, Aleksandar Markovic, 2019/10/25
- [PULL 01/20] target/mips: Clean up helper.c, Aleksandar Markovic, 2019/10/25
- [PULL 03/20] MAINTAINERS: Update mail address of Aleksandar Rikalo, Aleksandar Markovic, 2019/10/25
- [PULL 04/20] target/mips: msa: Split helpers for <MAX|MIN>_A.<B|H|W|D>, Aleksandar Markovic, 2019/10/25
- [PULL 10/20] target/mips: msa: Split helpers for PCK<EV|OD>.<B|H|W|D>, Aleksandar Markovic, 2019/10/25
- [PULL 07/20] target/mips: msa: Split helpers for ADD<_A|S_A|S_S|S_U|V>.<B|H|W|D>, Aleksandar Markovic, 2019/10/25
- [PULL 11/20] target/mips: msa: Split helpers for HSUB_<S|U>.<H|W|D>, Aleksandar Markovic, 2019/10/25
- [PULL 08/20] target/mips: msa: Split helpers for HADD_<S|U>.<H|W|D>, Aleksandar Markovic, 2019/10/25
- [PULL 13/20] target/mips: Demacro LMI decoder,
Aleksandar Markovic <=
- [PULL 12/20] target/mips: msa: Split helpers for ASUB_<S|U>.<B|H|W|D>, Aleksandar Markovic, 2019/10/25
- [PULL 16/20] tests/ssh_linux_malta: Run tests using a snapshot image, Aleksandar Markovic, 2019/10/25
- [PULL 05/20] target/mips: msa: Split helpers for <MAX|MIN>_<S|U>.<B|H|W|D>, Aleksandar Markovic, 2019/10/25
- [PULL 17/20] tests/ssh_linux_malta: Remove duplicated test, Aleksandar Markovic, 2019/10/25
- [PULL 18/20] tests/ssh_linux_malta: Match stricter console output, Aleksandar Markovic, 2019/10/25
- [PULL 09/20] target/mips: msa: Split helpers for S<LL|RA|RAR|RL|RLR>.<B|H|W|D>, Aleksandar Markovic, 2019/10/25
- [PULL 06/20] target/mips: msa: Split helpers for ILV<EV|OD|L|R>.<B|H|W|D>, Aleksandar Markovic, 2019/10/25
- [PULL 19/20] tests/ssh_linux_malta: Refactor how to get image/kernel info, Aleksandar Markovic, 2019/10/25
- [PULL 20/20] tests/ssh_linux_malta: Fix 64-bit target tests, Aleksandar Markovic, 2019/10/25
- [PULL 02/20] target/mips: Clean up op_helper.c, Aleksandar Markovic, 2019/10/25