From 06058ef648d9d6161ca00ace3f9bbd3e2b314ce5 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Fri, 24 May 2019 18:42:38 -0400 Subject: [PATCH] tcg/aarch64: Use MVNI in tcg_out_dupi_vec The compliment of a subset of immediates can be computed with a single instruction. Backports commit 7e308e003e5b6ddd3130e09711e1d33693230696 from qemu --- qemu/tcg/aarch64/tcg-target.inc.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/qemu/tcg/aarch64/tcg-target.inc.c b/qemu/tcg/aarch64/tcg-target.inc.c index 90751fe2..78f42a1e 100644 --- a/qemu/tcg/aarch64/tcg-target.inc.c +++ b/qemu/tcg/aarch64/tcg-target.inc.c @@ -491,6 +491,7 @@ typedef enum { /* AdvSIMD modified immediate */ I3606_MOVI = 0x0f000400, + I3606_MVNI = 0x2f000400, /* AdvSIMD shift by immediate */ I3614_SSHR = 0x0f000400, @@ -835,8 +836,13 @@ static void tcg_out_dupi_vec(TCGContext *s, TCGType type, tcg_out_insn(s, 3606, MOVI, q, rd, 0, cmode, imm8); return; } + if (is_shimm16(~v16, &cmode, &imm8)) { + tcg_out_insn(s, 3606, MVNI, q, rd, 0, cmode, imm8); + return; + } } else if (v64 == dup_const(MO_32, v64)) { uint32_t v32 = v64; + uint32_t n32 = ~v32; if (is_shimm32(v32, &cmode, &imm8) || is_soimm32(v32, &cmode, &imm8) || @@ -844,6 +850,11 @@ static void tcg_out_dupi_vec(TCGContext *s, TCGType type, tcg_out_insn(s, 3606, MOVI, q, rd, 0, cmode, imm8); return; } + if (is_shimm32(n32, &cmode, &imm8) || + is_soimm32(n32, &cmode, &imm8)) { + tcg_out_insn(s, 3606, MVNI, q, rd, 0, cmode, imm8); + return; + } } else if (is_fimm64(v64, &cmode, &imm8)) { tcg_out_insn(s, 3606, MOVI, q, rd, 1, cmode, imm8); return;