Skip to content

Commit 37f92d7

Browse files
committed
[ARM] Reject fixed-point VCVT with different registers
These instructions only have one register field in their encoding, so both registers in the assembly must be the same.
1 parent ac158aa commit 37f92d7

File tree

2 files changed

+82
-0
lines changed

2 files changed

+82
-0
lines changed

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

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8652,6 +8652,37 @@ bool ARMAsmParser::validateInstruction(MCInst &Inst,
86528652
"coprocessor must be configured as GCP");
86538653
break;
86548654
}
8655+
8656+
case ARM::VTOSHH:
8657+
case ARM::VTOUHH:
8658+
case ARM::VTOSLH:
8659+
case ARM::VTOULH:
8660+
case ARM::VTOSHS:
8661+
case ARM::VTOUHS:
8662+
case ARM::VTOSLS:
8663+
case ARM::VTOULS:
8664+
case ARM::VTOSHD:
8665+
case ARM::VTOUHD:
8666+
case ARM::VTOSLD:
8667+
case ARM::VTOULD:
8668+
case ARM::VSHTOH:
8669+
case ARM::VUHTOH:
8670+
case ARM::VSLTOH:
8671+
case ARM::VULTOH:
8672+
case ARM::VSHTOS:
8673+
case ARM::VUHTOS:
8674+
case ARM::VSLTOS:
8675+
case ARM::VULTOS:
8676+
case ARM::VSHTOD:
8677+
case ARM::VUHTOD:
8678+
case ARM::VSLTOD:
8679+
case ARM::VULTOD: {
8680+
if (Operands[MnemonicOpsEndInd]->getReg() !=
8681+
Operands[MnemonicOpsEndInd + 1]->getReg())
8682+
return Error(Operands[MnemonicOpsEndInd]->getStartLoc(),
8683+
"source and destination registers must be the same");
8684+
break;
8685+
}
86558686
}
86568687

86578688
return false;
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
// RUN: not llvm-mc -triple=armv8a-none-eabi -mattr=+fullfp16 < %s 2>&1 | FileCheck %s
2+
3+
vcvt.u16.f16 s0, s1, #1
4+
// CHECK: [[@LINE-1]]{{.*}}error: source and destination registers must be the same
5+
vcvt.s16.f16 s0, s1, #1
6+
// CHECK: [[@LINE-1]]{{.*}}error: source and destination registers must be the same
7+
vcvt.u32.f16 s0, s1, #1
8+
// CHECK: [[@LINE-1]]{{.*}}error: source and destination registers must be the same
9+
vcvt.s32.f16 s0, s1, #1
10+
// CHECK: [[@LINE-1]]{{.*}}error: source and destination registers must be the same
11+
vcvt.u16.f32 s0, s1, #1
12+
// CHECK: [[@LINE-1]]{{.*}}error: source and destination registers must be the same
13+
vcvt.s16.f32 s0, s1, #1
14+
// CHECK: [[@LINE-1]]{{.*}}error: source and destination registers must be the same
15+
vcvt.u32.f32 s0, s1, #1
16+
// CHECK: [[@LINE-1]]{{.*}}error: source and destination registers must be the same
17+
vcvt.s32.f32 s0, s1, #1
18+
// CHECK: [[@LINE-1]]{{.*}}error: source and destination registers must be the same
19+
vcvt.u16.f64 d0, d1, #1
20+
// CHECK: [[@LINE-1]]{{.*}}error: source and destination registers must be the same
21+
vcvt.s16.f64 d0, d1, #1
22+
// CHECK: [[@LINE-1]]{{.*}}error: source and destination registers must be the same
23+
vcvt.u32.f64 d0, d1, #1
24+
// CHECK: [[@LINE-1]]{{.*}}error: source and destination registers must be the same
25+
vcvt.s32.f64 d0, d1, #1
26+
// CHECK: [[@LINE-1]]{{.*}}error: source and destination registers must be the same
27+
vcvt.f16.u16 s0, s1, #1
28+
// CHECK: [[@LINE-1]]{{.*}}error: source and destination registers must be the same
29+
vcvt.f16.s16 s0, s1, #1
30+
// CHECK: [[@LINE-1]]{{.*}}error: source and destination registers must be the same
31+
vcvt.f16.u32 s0, s1, #1
32+
// CHECK: [[@LINE-1]]{{.*}}error: source and destination registers must be the same
33+
vcvt.f16.s32 s0, s1, #1
34+
// CHECK: [[@LINE-1]]{{.*}}error: source and destination registers must be the same
35+
vcvt.f32.u16 s0, s1, #1
36+
// CHECK: [[@LINE-1]]{{.*}}error: source and destination registers must be the same
37+
vcvt.f32.s16 s0, s1, #1
38+
// CHECK: [[@LINE-1]]{{.*}}error: source and destination registers must be the same
39+
vcvt.f32.u32 s0, s1, #1
40+
// CHECK: [[@LINE-1]]{{.*}}error: source and destination registers must be the same
41+
vcvt.f32.s32 s0, s1, #1
42+
// CHECK: [[@LINE-1]]{{.*}}error: source and destination registers must be the same
43+
vcvt.f64.u16 d0, d1, #1
44+
// CHECK: [[@LINE-1]]{{.*}}error: source and destination registers must be the same
45+
vcvt.f64.s16 d0, d1, #1
46+
// CHECK: [[@LINE-1]]{{.*}}error: source and destination registers must be the same
47+
vcvt.f64.u32 d0, d1, #1
48+
// CHECK: [[@LINE-1]]{{.*}}error: source and destination registers must be the same
49+
vcvt.f64.s32 d0, d1, #1
50+
// CHECK: [[@LINE-1]]{{.*}}error: source and destination registers must be the same
51+

0 commit comments

Comments
 (0)