xref: /llvm-project/llvm/test/CodeGen/LoongArch/inline-asm-constraint-error.ll (revision 1897bf61f0bc85c8637997d0f2aa7d94d375d787)
1; RUN: not llc --mtriple=loongarch32 < %s 2>&1 | FileCheck %s --check-prefixes=CHECK,LA32
2; RUN: not llc --mtriple=loongarch64 < %s 2>&1 | FileCheck %s
3
4define void @constraint_l() {
5; CHECK: error: value out of range for constraint 'l'
6  tail call void asm sideeffect "lu12i.w $$a0, $0", "l"(i32 32768)
7; CHECK: error: value out of range for constraint 'l'
8  tail call void asm sideeffect "lu12i.w $$a0, $0", "l"(i32 -32769)
9  ret void
10}
11
12define void @constraint_I() {
13; CHECK: error: value out of range for constraint 'I'
14  tail call void asm sideeffect "addi.w $$a0, $$a0, $0", "I"(i32 2048)
15; CHECK: error: value out of range for constraint 'I'
16  tail call void asm sideeffect "addi.w $$a0, $$a0, $0", "I"(i32 -2049)
17  ret void
18}
19
20define void @constraint_J() {
21; CHECK: error: value out of range for constraint 'J'
22  tail call void asm sideeffect "addi.w $$a0, $$a0, $$0", "J"(i32 1)
23  ret void
24}
25
26define void @constraint_K() {
27; CHECK: error: value out of range for constraint 'K'
28  tail call void asm sideeffect "andi.w $$a0, $$a0, $0", "K"(i32 4096)
29; CHECK: error: value out of range for constraint 'K'
30  tail call void asm sideeffect "andi.w $$a0, $$a0, $0", "K"(i32 -1)
31  ret void
32}
33
34define void @constraint_f() nounwind {
35; LA32: error: couldn't allocate input reg for constraint 'f'
36  tail call void asm "fadd.s $$fa0, $$fa0, $0", "f"(float 0.0)
37; LA32: error: couldn't allocate input reg for constraint 'f'
38  tail call void asm "fadd.s $$fa0, $$fa0, $0", "f"(double 0.0)
39  ret void
40}
41
42define void @constraint_r_vec() nounwind {
43; CHECK: error: couldn't allocate input reg for constraint 'r'
44  tail call void asm "add.w $$a0, $$a0, $0", "r"(<4 x i32> zeroinitializer)
45  ret void
46}
47