Skip to content

Commit 97d51e3

Browse files
quic-akaryakiKrzysztof Parzyszek
authored andcommitted
[Hexagon] Disallow using the same register for Vy/Vx in vdeal/vshuff
Non-assignment forms of vshuff and vdeal use the first two registers (Vy, Vx) as both inputs and outputs. It is not valid to use the same register for both Vy and Vx. The double-write error was not detected previously because of a special case, which is not actually necessary. Differential Revision: https://reviews.llvm.org/D142251
1 parent 3dcbbdd commit 97d51e3

File tree

4 files changed

+18
-8
lines changed

4 files changed

+18
-8
lines changed

llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCChecker.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,6 @@ void HexagonMCChecker::init(MCInst const &MCI) {
178178
// TODO: relies on the impossibility of a current and a temporary loads
179179
// in the same packet.
180180
TmpDefs.insert(*SRI);
181-
else if (i <= 1 && HexagonMCInstrInfo::hasNewValue2(MCII, MCI))
182-
// vshuff(Vx, Vy, Rx) <- Vx(0) and Vy(1) are both source and
183-
// destination registers with this instruction. same for vdeal(Vx,Vy,Rx)
184-
Uses.insert(*SRI);
185181
else if (!IgnoreTmpDst)
186182
Defs[*SRI].insert(PredSense(PredReg, isTrue));
187183
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# RUN: not llvm-mc -arch=hexagon -mv65 -mhvx -filetype=obj -o 1.o %s 2>&1 | FileCheck --implicit-check-not=error %s
2+
3+
{ v1 = v2; vshuff(v1,v3,r0) }
4+
# CHECK: error: register `V1' modified more than once
5+
6+
{ v4 = v3; vdeal(v6,v4,r0) }
7+
# CHECK: error: register `V4' modified more than once
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# RUN: not llvm-mc -arch=hexagon -mv65 -mhvx -filetype=obj %s 2>&1 | FileCheck %s
2+
3+
{ vshuff(v0,v0,r0) }
4+
# CHECK: error: register `V0' modified more than once
5+
6+
{ vdeal(v1,v1,r0) }
7+
# CHECK: error: register `V1' modified more than once

llvm/test/MC/Hexagon/extensions/v67_hvx.s

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1241,8 +1241,8 @@
12411241

12421242
// V6_vdeal
12431243
// vdeal(Vy32,Vx32,Rt32)
1244-
vdeal(v0,v0,r0)
1245-
# CHECK-NEXT: 19e0e040 { vdeal(v0,v0,r0) }
1244+
vdeal(v0,v1,r0)
1245+
# CHECK-NEXT: 19e0e041 { vdeal(v0,v1,r0) }
12461246

12471247
// V6_vdealb
12481248
// Vd32.b=vdeal(Vu32.b)
@@ -2461,8 +2461,8 @@
24612461

24622462
// V6_vshuff
24632463
// vshuff(Vy32,Vx32,Rt32)
2464-
vshuff(v0,v0,r0)
2465-
# CHECK-NEXT: 19e0e020 { vshuff(v0,v0,r0) }
2464+
vshuff(v0,v1,r0)
2465+
# CHECK-NEXT: 19e0e021 { vshuff(v0,v1,r0) }
24662466

24672467
// V6_vshuffb
24682468
// Vd32.b=vshuff(Vu32.b)

0 commit comments

Comments
 (0)