Skip to content

Commit 907b7d0

Browse files
authored
[ARM] Fix inline asm register validation for vector types (#152175)
Patch allows following piece of code to be successfully compiled: ``` register uint8x8_t V asm("d3") = vdup_n_u8(0xff); ```
1 parent df34eac commit 907b7d0

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

llvm/lib/Target/ARM/ARMISelLowering.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20350,7 +20350,8 @@ static bool isIncompatibleReg(const MCPhysReg &PR, MVT VT) {
2035020350
if (PR == 0 || VT == MVT::Other)
2035120351
return false;
2035220352
return (ARM::SPRRegClass.contains(PR) && VT != MVT::f32 && VT != MVT::i32) ||
20353-
(ARM::DPRRegClass.contains(PR) && VT != MVT::f64);
20353+
(ARM::DPRRegClass.contains(PR) && VT != MVT::f64 &&
20354+
!VT.is64BitVector());
2035420355
}
2035520356

2035620357
using RCPair = std::pair<unsigned, const TargetRegisterClass *>;

llvm/test/CodeGen/ARM/bad-constraint.ll

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
; RUN: not llc -filetype=obj %s -o /dev/null 2>&1 | FileCheck %s
22
; CHECK: error: couldn't allocate input reg for constraint '{d2}'
33
; CHECK-NEXT: error: couldn't allocate input reg for constraint '{s2}'
4+
; CHECK-NEXT: error: couldn't allocate input reg for constraint '{d3}'
45

56
target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
67
target triple = "armv8a-unknown-linux-gnueabihf"
@@ -23,3 +24,8 @@ entry:
2324
ret void
2425
}
2526

27+
define void @_Z1dv() local_unnamed_addr {
28+
entry:
29+
tail call void asm sideeffect "", "{d3}"(<16 x i8> splat (i8 -1))
30+
ret void
31+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
; RUN: llc %s -filetype=asm -o - | FileCheck %s
2+
3+
; CHECK: vmov.i8 d3, #0xff
4+
5+
target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
6+
target triple = "armv8a-unknown-linux-gnueabihf"
7+
8+
; Function Attrs: mustprogress noimplicitfloat nounwind
9+
define void @cvt_vec() local_unnamed_addr {
10+
entry:
11+
tail call void asm sideeffect "", "{d3}"(<8 x i8> splat (i8 -1))
12+
ret void
13+
}
14+

0 commit comments

Comments
 (0)