[llvm] f17601b - [ARM] Permit VGETLNi32 and VSETLNi32 without mnemonic suffix.
Simon Tatham via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 3 05:21:22 PDT 2023
Author: Simon Tatham
Date: 2023-08-03T13:20:56+01:00
New Revision: f17601b9a7376564b689083477a76a26c7dff7e8
URL: https://github.com/llvm/llvm-project/commit/f17601b9a7376564b689083477a76a26c7dff7e8
DIFF: https://github.com/llvm/llvm-project/commit/f17601b9a7376564b689083477a76a26c7dff7e8.diff
LOG: [ARM] Permit VGETLNi32 and VSETLNi32 without mnemonic suffix.
These instructions transfer 32 bits of data between an integer
register and half of a d-register. Currently LLVM accepts them only
with the syntax `vmov.32 r0, d0[0]` or `vmov.32 d0[0], r0`. But the
ARMARM says that the `.32` suffix on the mnemonic should be optional.
Added a pair of NEONInstAlias to accept the bare `vmov` version, and
checked that the result is the same as with `.32`.
This only adds new syntax accepted in assembly. The existing explicit
version is still used when disassembling these instructions.
Reviewed By: dmgreen
Differential Revision: https://reviews.llvm.org/D156868
Added:
Modified:
llvm/lib/Target/ARM/ARMInstrNEON.td
llvm/test/MC/ARM/neon-mov-encoding.s
Removed:
################################################################################
diff --git a/llvm/lib/Target/ARM/ARMInstrNEON.td b/llvm/lib/Target/ARM/ARMInstrNEON.td
index 32c6843026dd52..9cc083a220c015 100644
--- a/llvm/lib/Target/ARM/ARMInstrNEON.td
+++ b/llvm/lib/Target/ARM/ARMInstrNEON.td
@@ -6396,6 +6396,10 @@ def VGETLNi32 : NVGetLane<{1,1,1,0,0,0,?,1}, 0b1011, 0b00,
Requires<[HasFPRegs, HasFastVGETLNi32]> {
let Inst{21} = lane{0};
}
+// VGETLNi32 is also legal as just vmov r0,d0[0] without the .32 suffix
+def : InstAlias<"vmov${p} $R, $V$lane",
+ (VGETLNi32 GPR:$R, DPR:$V, VectorIndex32:$lane, pred:$p), 0>,
+ Requires<VGETLNi32.Predicates>;
let Predicates = [HasNEON] in {
// def VGETLNf32: see FMRDH and FMRDL in ARMInstrVFP.td
def : Pat<(ARMvgetlanes (v16i8 QPR:$src), imm:$lane),
@@ -6538,6 +6542,10 @@ def VSETLNi32 : NVSetLane<{1,1,1,0,0,0,?,0}, 0b1011, 0b00, (outs DPR:$V),
let isInsertSubreg = 1;
}
}
+// VSETLNi32 is also legal as just vmov d0[0],r0 without the .32 suffix
+def : InstAlias<"vmov${p} $V$lane, $R",
+ (VSETLNi32 DPR:$V, GPR:$R, VectorIndex32:$lane, pred:$p), 0>,
+ Requires<VSETLNi32.Predicates>;
// TODO: for odd lanes we could optimize this a bit by using the VINS
// FullFP16 instruction when it is available
diff --git a/llvm/test/MC/ARM/neon-mov-encoding.s b/llvm/test/MC/ARM/neon-mov-encoding.s
index ba66d7e14be1df..bb9bfbe799c698 100644
--- a/llvm/test/MC/ARM/neon-mov-encoding.s
+++ b/llvm/test/MC/ARM/neon-mov-encoding.s
@@ -110,23 +110,27 @@
vmov.u8 r0, d16[1]
vmov.u16 r0, d16[1]
vmov.32 r0, d16[1]
+ vmov r0, d16[1]
vmov.8 d16[1], r1
vmov.16 d16[1], r1
vmov.32 d16[1], r1
vmov.8 d18[1], r1
vmov.16 d18[1], r1
vmov.32 d18[1], r1
+ vmov d18[1], r1
@ CHECK: vmov.s8 r0, d16[1] @ encoding: [0xb0,0x0b,0x50,0xee]
@ CHECK: vmov.s16 r0, d16[1] @ encoding: [0xf0,0x0b,0x10,0xee]
@ CHECK: vmov.u8 r0, d16[1] @ encoding: [0xb0,0x0b,0xd0,0xee]
@ CHECK: vmov.u16 r0, d16[1] @ encoding: [0xf0,0x0b,0x90,0xee]
@ CHECK: vmov.32 r0, d16[1] @ encoding: [0x90,0x0b,0x30,0xee]
+@ CHECK: vmov.32 r0, d16[1] @ encoding: [0x90,0x0b,0x30,0xee]
@ CHECK: vmov.8 d16[1], r1 @ encoding: [0xb0,0x1b,0x40,0xee]
@ CHECK: vmov.16 d16[1], r1 @ encoding: [0xf0,0x1b,0x00,0xee]
@ CHECK: vmov.32 d16[1], r1 @ encoding: [0x90,0x1b,0x20,0xee]
@ CHECK: vmov.8 d18[1], r1 @ encoding: [0xb0,0x1b,0x42,0xee]
@ CHECK: vmov.16 d18[1], r1 @ encoding: [0xf0,0x1b,0x02,0xee]
+@ CHECK: vmov.32 d18[1], r1 @ encoding: [0x90,0x1b,0x22,0xee]
@ CHECK: vmov.32 d18[1], r1 @ encoding: [0x90,0x1b,0x22,0xee]
More information about the llvm-commits
mailing list