xref: /llvm-project/llvm/test/CodeGen/LoongArch/intrinsic-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
4declare void @llvm.loongarch.dbar(i32)
5declare void @llvm.loongarch.ibar(i32)
6declare void @llvm.loongarch.break(i32)
7declare void @llvm.loongarch.movgr2fcsr(i32, i32)
8declare i32 @llvm.loongarch.movfcsr2gr(i32)
9declare void @llvm.loongarch.syscall(i32)
10declare i32 @llvm.loongarch.csrrd.w(i32 immarg)
11declare i32 @llvm.loongarch.csrwr.w(i32, i32 immarg)
12declare i32 @llvm.loongarch.csrxchg.w(i32, i32, i32 immarg)
13
14define void @dbar_imm_out_of_hi_range() #0 {
15; CHECK: llvm.loongarch.dbar: argument out of range.
16entry:
17  call void @llvm.loongarch.dbar(i32 32769)
18  ret void
19}
20
21define void @dbar_imm_out_of_lo_range() #0 {
22; CHECK: llvm.loongarch.dbar: argument out of range.
23entry:
24  call void @llvm.loongarch.dbar(i32 -1)
25  ret void
26}
27
28define void @ibar_imm_out_of_hi_range() #0 {
29; CHECK: llvm.loongarch.ibar: argument out of range.
30entry:
31  call void @llvm.loongarch.ibar(i32 32769)
32  ret void
33}
34
35define void @ibar_imm_out_of_lo_range() #0 {
36; CHECK: llvm.loongarch.ibar: argument out of range.
37entry:
38  call void @llvm.loongarch.ibar(i32 -1)
39  ret void
40}
41
42define void @break_imm_out_of_hi_range() #0 {
43; CHECK: llvm.loongarch.break: argument out of range.
44entry:
45  call void @llvm.loongarch.break(i32 32769)
46  ret void
47}
48
49define void @break_imm_out_of_lo_range() #0 {
50; CHECK: llvm.loongarch.break: argument out of range.
51entry:
52  call void @llvm.loongarch.break(i32 -1)
53  ret void
54}
55
56define void @movgr2fcsr(i32 %a) nounwind {
57; LA32: llvm.loongarch.movgr2fcsr: requires basic 'f' target feature.
58entry:
59  call void @llvm.loongarch.movgr2fcsr(i32 1, i32 %a)
60  ret void
61}
62
63define void @movgr2fcsr_imm_out_of_hi_range(i32 %a) #0 {
64; CHECK: llvm.loongarch.movgr2fcsr: argument out of range.
65entry:
66  call void @llvm.loongarch.movgr2fcsr(i32 32, i32 %a)
67  ret void
68}
69
70define void @movgr2fcsr_imm_out_of_lo_range(i32 %a) #0 {
71; CHECK: llvm.loongarch.movgr2fcsr: argument out of range.
72entry:
73  call void @llvm.loongarch.movgr2fcsr(i32 -1, i32 %a)
74  ret void
75}
76
77define i32 @movfcsr2gr() nounwind {
78; LA32: llvm.loongarch.movfcsr2gr: requires basic 'f' target feature.
79entry:
80  %res = call i32 @llvm.loongarch.movfcsr2gr(i32 1)
81  ret i32 %res
82}
83
84define i32 @movfcsr2gr_imm_out_of_hi_range() #0 {
85; CHECK: llvm.loongarch.movfcsr2gr: argument out of range.
86entry:
87  %res = call i32 @llvm.loongarch.movfcsr2gr(i32 32)
88  ret i32 %res
89}
90
91define i32 @movfcsr2gr_imm_out_of_lo_range() #0 {
92; CHECK: llvm.loongarch.movfcsr2gr: argument out of range.
93entry:
94  %res = call i32 @llvm.loongarch.movfcsr2gr(i32 -1)
95  ret i32 %res
96}
97
98define void @syscall_imm_out_of_hi_range() #0 {
99; CHECK: llvm.loongarch.syscall: argument out of range.
100entry:
101  call void @llvm.loongarch.syscall(i32 32769)
102  ret void
103}
104
105define void @syscall_imm_out_of_lo_range() #0 {
106; CHECK: llvm.loongarch.syscall: argument out of range.
107entry:
108  call void @llvm.loongarch.syscall(i32 -1)
109  ret void
110}
111
112define i32 @csrrd_w_imm_out_of_hi_range() #0 {
113; CHECK: llvm.loongarch.csrrd.w: argument out of range.
114entry:
115  %0 = call i32 @llvm.loongarch.csrrd.w(i32 16384)
116  ret i32 %0
117}
118
119define i32 @csrrd_w_imm_out_of_lo_range() #0 {
120; CHECK: llvm.loongarch.csrrd.w: argument out of range.
121entry:
122  %0 = call i32 @llvm.loongarch.csrrd.w(i32 -1)
123  ret i32 %0
124}
125
126define i32 @csrwr_w_imm_out_of_hi_range(i32 %a) #0 {
127; CHECK: llvm.loongarch.csrwr.w: argument out of range.
128entry:
129  %0 = call i32 @llvm.loongarch.csrwr.w(i32 %a, i32 16384)
130  ret i32 %0
131}
132
133define i32 @csrwr_w_imm_out_of_lo_range(i32 %a) #0 {
134; CHECK: llvm.loongarch.csrwr.w: argument out of range.
135entry:
136  %0 = call i32 @llvm.loongarch.csrwr.w(i32 %a, i32 -1)
137  ret i32 %0
138}
139
140define i32 @csrxchg_w_imm_out_of_hi_range(i32 %a, i32 %b) #0 {
141; CHECK: llvm.loongarch.csrxchg.w: argument out of range.
142entry:
143  %0 = call i32 @llvm.loongarch.csrxchg.w(i32 %a, i32 %b, i32 16384)
144  ret i32 %0
145}
146
147define i32 @csrxchg_w_imm_out_of_lo_range(i32 %a, i32 %b) #0 {
148; CHECK: llvm.loongarch.csrxchg.w: argument out of range.
149entry:
150  %0 = call i32 @llvm.loongarch.csrxchg.w(i32 %a, i32 %b, i32 -1)
151  ret i32 %0
152}
153
154attributes #0 = { nounwind "target-features"="+f" }
155