[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 07/41] target/mips: Use dup_const() to simplify
From: |
Philippe Mathieu-Daudé |
Subject: |
[PULL 07/41] target/mips: Use dup_const() to simplify |
Date: |
Tue, 2 Nov 2021 14:42:06 +0100 |
The dup_const() helper makes the code easier to follow, use it.
Suggested-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20211028210843.2120802-5-f4bug@amsat.org>
---
target/mips/tcg/msa_translate.c | 23 +++--------------------
1 file changed, 3 insertions(+), 20 deletions(-)
diff --git a/target/mips/tcg/msa_translate.c b/target/mips/tcg/msa_translate.c
index 3aa15e147c2..b135c58fd4f 100644
--- a/target/mips/tcg/msa_translate.c
+++ b/target/mips/tcg/msa_translate.c
@@ -315,28 +315,11 @@ static void gen_check_zero_element(TCGv tresult, uint8_t
df, uint8_t wt,
{
/* generates tcg ops to check if any element is 0 */
/* Note this function only works with MSA_WRLEN = 128 */
- uint64_t eval_zero_or_big = 0;
- uint64_t eval_big = 0;
+ uint64_t eval_zero_or_big = dup_const(df, 1);
+ uint64_t eval_big = eval_zero_or_big << ((8 << df) - 1);
TCGv_i64 t0 = tcg_temp_new_i64();
TCGv_i64 t1 = tcg_temp_new_i64();
- switch (df) {
- case DF_BYTE:
- eval_zero_or_big = 0x0101010101010101ULL;
- eval_big = 0x8080808080808080ULL;
- break;
- case DF_HALF:
- eval_zero_or_big = 0x0001000100010001ULL;
- eval_big = 0x8000800080008000ULL;
- break;
- case DF_WORD:
- eval_zero_or_big = 0x0000000100000001ULL;
- eval_big = 0x8000000080000000ULL;
- break;
- case DF_DOUBLE:
- eval_zero_or_big = 0x0000000000000001ULL;
- eval_big = 0x8000000000000000ULL;
- break;
- }
+
tcg_gen_subi_i64(t0, msa_wr_d[wt << 1], eval_zero_or_big);
tcg_gen_andc_i64(t0, t0, msa_wr_d[wt << 1]);
tcg_gen_andi_i64(t0, t0, eval_big);
--
2.31.1
- [PULL 00/41] MIPS patches for 2021-11-02, Philippe Mathieu-Daudé, 2021/11/02
- [PULL 01/41] MAINTAINERS: Add MIPS general architecture support entry, Philippe Mathieu-Daudé, 2021/11/02
- [PULL 02/41] MAINTAINERS: Add entries to cover MIPS CPS / GIC hardware, Philippe Mathieu-Daudé, 2021/11/02
- [PULL 03/41] MAINTAINERS: Split MIPS TCG frontend vs MIPS machines/hardware, Philippe Mathieu-Daudé, 2021/11/02
- [PULL 04/41] target/mips: Fix MSA MADDV.B opcode, Philippe Mathieu-Daudé, 2021/11/02
- [PULL 05/41] target/mips: Fix MSA MSUBV.B opcode, Philippe Mathieu-Daudé, 2021/11/02
- [PULL 06/41] target/mips: Adjust style in msa_translate_init(), Philippe Mathieu-Daudé, 2021/11/02
- [PULL 07/41] target/mips: Use dup_const() to simplify,
Philippe Mathieu-Daudé <=
- [PULL 08/41] target/mips: Have check_msa_access() return a boolean, Philippe Mathieu-Daudé, 2021/11/02
- [PULL 09/41] target/mips: Use enum definitions from CPUMIPSMSADataFormat enum, Philippe Mathieu-Daudé, 2021/11/02
- [PULL 10/41] target/mips: Rename sa16 -> sa, bz_df -> bz -> bz_v, Philippe Mathieu-Daudé, 2021/11/02
- [PULL 11/41] target/mips: Convert MSA LDI opcode to decodetree, Philippe Mathieu-Daudé, 2021/11/02
- [PULL 12/41] target/mips: Convert MSA I5 instruction format to decodetree, Philippe Mathieu-Daudé, 2021/11/02
- [PULL 13/41] target/mips: Convert MSA BIT instruction format to decodetree, Philippe Mathieu-Daudé, 2021/11/02
- [PULL 14/41] target/mips: Convert MSA SHF opcode to decodetree, Philippe Mathieu-Daudé, 2021/11/02
- [PULL 15/41] target/mips: Convert MSA I8 instruction format to decodetree, Philippe Mathieu-Daudé, 2021/11/02
- [PULL 16/41] target/mips: Convert MSA load/store instruction format to decodetree, Philippe Mathieu-Daudé, 2021/11/02
- [PULL 17/41] target/mips: Convert MSA 2RF instruction format to decodetree, Philippe Mathieu-Daudé, 2021/11/02