Skip to content

Commit f17601b

Browse files
committed
[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
1 parent 9f72df7 commit f17601b

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

llvm/lib/Target/ARM/ARMInstrNEON.td

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6396,6 +6396,10 @@ def VGETLNi32 : NVGetLane<{1,1,1,0,0,0,?,1}, 0b1011, 0b00,
63966396
Requires<[HasFPRegs, HasFastVGETLNi32]> {
63976397
let Inst{21} = lane{0};
63986398
}
6399+
// VGETLNi32 is also legal as just vmov r0,d0[0] without the .32 suffix
6400+
def : InstAlias<"vmov${p} $R, $V$lane",
6401+
(VGETLNi32 GPR:$R, DPR:$V, VectorIndex32:$lane, pred:$p), 0>,
6402+
Requires<VGETLNi32.Predicates>;
63996403
let Predicates = [HasNEON] in {
64006404
// def VGETLNf32: see FMRDH and FMRDL in ARMInstrVFP.td
64016405
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),
65386542
let isInsertSubreg = 1;
65396543
}
65406544
}
6545+
// VSETLNi32 is also legal as just vmov d0[0],r0 without the .32 suffix
6546+
def : InstAlias<"vmov${p} $V$lane, $R",
6547+
(VSETLNi32 DPR:$V, GPR:$R, VectorIndex32:$lane, pred:$p), 0>,
6548+
Requires<VSETLNi32.Predicates>;
65416549

65426550
// TODO: for odd lanes we could optimize this a bit by using the VINS
65436551
// FullFP16 instruction when it is available

llvm/test/MC/ARM/neon-mov-encoding.s

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,23 +110,27 @@
110110
vmov.u8 r0, d16[1]
111111
vmov.u16 r0, d16[1]
112112
vmov.32 r0, d16[1]
113+
vmov r0, d16[1]
113114
vmov.8 d16[1], r1
114115
vmov.16 d16[1], r1
115116
vmov.32 d16[1], r1
116117
vmov.8 d18[1], r1
117118
vmov.16 d18[1], r1
118119
vmov.32 d18[1], r1
120+
vmov d18[1], r1
119121

120122
@ CHECK: vmov.s8 r0, d16[1] @ encoding: [0xb0,0x0b,0x50,0xee]
121123
@ CHECK: vmov.s16 r0, d16[1] @ encoding: [0xf0,0x0b,0x10,0xee]
122124
@ CHECK: vmov.u8 r0, d16[1] @ encoding: [0xb0,0x0b,0xd0,0xee]
123125
@ CHECK: vmov.u16 r0, d16[1] @ encoding: [0xf0,0x0b,0x90,0xee]
124126
@ CHECK: vmov.32 r0, d16[1] @ encoding: [0x90,0x0b,0x30,0xee]
127+
@ CHECK: vmov.32 r0, d16[1] @ encoding: [0x90,0x0b,0x30,0xee]
125128
@ CHECK: vmov.8 d16[1], r1 @ encoding: [0xb0,0x1b,0x40,0xee]
126129
@ CHECK: vmov.16 d16[1], r1 @ encoding: [0xf0,0x1b,0x00,0xee]
127130
@ CHECK: vmov.32 d16[1], r1 @ encoding: [0x90,0x1b,0x20,0xee]
128131
@ CHECK: vmov.8 d18[1], r1 @ encoding: [0xb0,0x1b,0x42,0xee]
129132
@ CHECK: vmov.16 d18[1], r1 @ encoding: [0xf0,0x1b,0x02,0xee]
133+
@ CHECK: vmov.32 d18[1], r1 @ encoding: [0x90,0x1b,0x22,0xee]
130134
@ CHECK: vmov.32 d18[1], r1 @ encoding: [0x90,0x1b,0x22,0xee]
131135

132136

0 commit comments

Comments
 (0)