Skip to content

Commit ee81051

Browse files
committed
[ARM] Relax constraints on operands of VQxDMLxDH instructions
Summary: According to a recently updated Armv8-M spec (https://static.docs.arm.com/ddi0553/bh/DDI0553B_h_armv8m_arm.pdf) the 32-bit width versions of the following instructions: * VQDMLADH * VQDMLADHX * VQRDMLADH * VQRDMLADHX * VQDMLSDH * VQDMLSDHX * VQRDMLSDH * VQRDMLSDHX are no longer unpredictable when their output register is the same as one of the input registers. This patch updates the assembler parser and the corresponding tests and also removes @earlyclobber from the instruction constraints. Reviewers: simon_tatham, ostannard, dmgreen, SjoerdMeijer, samparker Reviewed By: simon_tatham Subscribers: javed.absar, kristof.beyls, hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D64250 llvm-svn: 365306
1 parent 77d4a8f commit ee81051

File tree

3 files changed

+14
-21
lines changed

3 files changed

+14
-21
lines changed

llvm/lib/Target/ARM/ARMInstrMVE.td

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2834,13 +2834,10 @@ class MVE_qDest_qSrc<string iname, string suffix, dag oops, dag iops,
28342834
}
28352835

28362836
class MVE_VQxDMLxDH<string iname, bit exch, bit round, bit subtract,
2837-
string suffix, bits<2> size, bit earlyclobber,
2838-
list<dag> pattern=[]>
2837+
string suffix, bits<2> size, list<dag> pattern=[]>
28392838
: MVE_qDest_qSrc<iname, suffix, (outs MQPR:$Qd),
28402839
(ins MQPR:$Qd_src, MQPR:$Qn, MQPR:$Qm), "$Qd, $Qn, $Qm",
2841-
vpred_n,
2842-
!if(earlyclobber, "@earlyclobber $Qd,", "") # "$Qd = $Qd_src",
2843-
pattern> {
2840+
vpred_n, "$Qd = $Qd_src", pattern> {
28442841
bits<4> Qn;
28452842

28462843
let Inst{28} = subtract;
@@ -2855,9 +2852,9 @@ class MVE_VQxDMLxDH<string iname, bit exch, bit round, bit subtract,
28552852

28562853
multiclass MVE_VQxDMLxDH_multi<string iname, bit exch,
28572854
bit round, bit subtract> {
2858-
def s8 : MVE_VQxDMLxDH<iname, exch, round, subtract, "s8", 0b00, 0b0>;
2859-
def s16 : MVE_VQxDMLxDH<iname, exch, round, subtract, "s16", 0b01, 0b0>;
2860-
def s32 : MVE_VQxDMLxDH<iname, exch, round, subtract, "s32", 0b10, 0b1>;
2855+
def s8 : MVE_VQxDMLxDH<iname, exch, round, subtract, "s8", 0b00>;
2856+
def s16 : MVE_VQxDMLxDH<iname, exch, round, subtract, "s16", 0b01>;
2857+
def s32 : MVE_VQxDMLxDH<iname, exch, round, subtract, "s32", 0b10>;
28612858
}
28622859

28632860
defm MVE_VQDMLADH : MVE_VQxDMLxDH_multi<"vqdmladh", 0b0, 0b0, 0b0>;

llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7865,15 +7865,7 @@ bool ARMAsmParser::validateInstruction(MCInst &Inst,
78657865
case ARM::MVE_VMULLs32bh:
78667866
case ARM::MVE_VMULLs32th:
78677867
case ARM::MVE_VMULLu32bh:
7868-
case ARM::MVE_VMULLu32th:
7869-
case ARM::MVE_VQDMLADHs32:
7870-
case ARM::MVE_VQDMLADHXs32:
7871-
case ARM::MVE_VQRDMLADHs32:
7872-
case ARM::MVE_VQRDMLADHXs32:
7873-
case ARM::MVE_VQDMLSDHs32:
7874-
case ARM::MVE_VQDMLSDHXs32:
7875-
case ARM::MVE_VQRDMLSDHs32:
7876-
case ARM::MVE_VQRDMLSDHXs32: {
7868+
case ARM::MVE_VMULLu32th: {
78777869
if (Operands[3]->getReg() == Operands[4]->getReg()) {
78787870
return Error (Operands[3]->getStartLoc(),
78797871
"Qd register and Qn register can't be identical");

llvm/test/MC/ARM/mve-qdest-qsrc.s

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,12 @@ vqrdmladhx.s16 q0, q0, q1
6060
# CHECK-NOFP: vqrdmladhx.s32 q1, q0, q4 @ encoding: [0x20,0xee,0x09,0x3e]
6161
vqrdmladhx.s32 q1, q0, q4
6262

63-
# ERROR: [[@LINE+1]]:{{[0-9]+}}: {{error|note}}: Qd register and Qn register can't be identical
63+
# CHECK: vqrdmladhx.s32 q1, q1, q0 @ encoding: [0x22,0xee,0x01,0x3e]
64+
# CHECK-NOFP: vqrdmladhx.s32 q1, q1, q0 @ encoding: [0x22,0xee,0x01,0x3e]
6465
vqrdmladhx.s32 q1, q1, q0
6566

66-
# ERROR: [[@LINE+1]]:{{[0-9]+}}: {{error|note}}: Qd register and Qm register can't be identical
67+
# CHECK: vqrdmladhx.s32 q1, q0, q1 @ encoding: [0x20,0xee,0x03,0x3e]
68+
# CHECK-NOFP: vqrdmladhx.s32 q1, q0, q1 @ encoding: [0x20,0xee,0x03,0x3e]
6769
vqrdmladhx.s32 q1, q0, q1
6870

6971
# CHECK: vqrdmladh.s8 q0, q6, q2 @ encoding: [0x0c,0xee,0x05,0x0e]
@@ -126,10 +128,12 @@ vqrdmlsdh.s16 q0, q7, q4
126128
# CHECK-NOFP: vqrdmlsdh.s32 q0, q6, q7 @ encoding: [0x2c,0xfe,0x0f,0x0e]
127129
vqrdmlsdh.s32 q0, q6, q7
128130

129-
# ERROR: [[@LINE+1]]:{{[0-9]+}}: {{error|note}}: Qd register and Qn register can't be identical
131+
# CHECK: vqrdmlsdh.s32 q0, q0, q7 @ encoding: [0x20,0xfe,0x0f,0x0e]
132+
# CHECK-NOFP: vqrdmlsdh.s32 q0, q0, q7 @ encoding: [0x20,0xfe,0x0f,0x0e]
130133
vqrdmlsdh.s32 q0, q0, q7
131134

132-
# ERROR: [[@LINE+1]]:{{[0-9]+}}: {{error|note}}: Qd register and Qm register can't be identical
135+
# CHECK: vqrdmlsdh.s32 q0, q6, q0 @ encoding: [0x2c,0xfe,0x01,0x0e]
136+
# CHECK-NOFP: vqrdmlsdh.s32 q0, q6, q0 @ encoding: [0x2c,0xfe,0x01,0x0e]
133137
vqrdmlsdh.s32 q0, q6, q0
134138

135139
# CHECK: vcmul.f16 q0, q1, q2, #90 @ encoding: [0x32,0xee,0x05,0x0e]

0 commit comments

Comments
 (0)