1; RUN: llc -march=xcore < %s | FileCheck %s
2
3declare i8 addrspace(1)* @llvm.xcore.getr.p1i8(i32 %type)
4declare void @llvm.xcore.freer.p1i8(i8 addrspace(1)* %r)
5declare i32 @llvm.xcore.in.p1i8(i8 addrspace(1)* %r)
6declare i32 @llvm.xcore.int.p1i8(i8 addrspace(1)* %r)
7declare i32 @llvm.xcore.inct.p1i8(i8 addrspace(1)* %r)
8declare void @llvm.xcore.out.p1i8(i8 addrspace(1)* %r, i32 %value)
9declare void @llvm.xcore.outt.p1i8(i8 addrspace(1)* %r, i32 %value)
10declare void @llvm.xcore.outct.p1i8(i8 addrspace(1)* %r, i32 %value)
11declare void @llvm.xcore.chkct.p1i8(i8 addrspace(1)* %r, i32 %value)
12declare i32 @llvm.xcore.testct.p1i8(i8 addrspace(1)* %r)
13declare i32 @llvm.xcore.testwct.p1i8(i8 addrspace(1)* %r)
14declare void @llvm.xcore.setd.p1i8(i8 addrspace(1)* %r, i32 %value)
15declare void @llvm.xcore.setc.p1i8(i8 addrspace(1)* %r, i32 %value)
16declare i32 @llvm.xcore.inshr.p1i8(i8 addrspace(1)* %r, i32 %value)
17declare i32 @llvm.xcore.outshr.p1i8(i8 addrspace(1)* %r, i32 %value)
18declare void @llvm.xcore.clrpt.p1i8(i8 addrspace(1)* %r)
19declare void @llvm.xcore.setpt.p1i8(i8 addrspace(1)* %r, i32 %value)
20declare i32 @llvm.xcore.getts.p1i8(i8 addrspace(1)* %r)
21declare void @llvm.xcore.syncr.p1i8(i8 addrspace(1)* %r)
22declare void @llvm.xcore.settw.p1i8(i8 addrspace(1)* %r, i32 %value)
23declare void @llvm.xcore.setv.p1i8(i8 addrspace(1)* %r, i8* %p)
24declare void @llvm.xcore.setev.p1i8(i8 addrspace(1)* %r, i8* %p)
25declare void @llvm.xcore.edu.p1i8(i8 addrspace(1)* %r)
26declare void @llvm.xcore.eeu.p1i8(i8 addrspace(1)* %r)
27declare void @llvm.xcore.setclk.p1i8.p1i8(i8 addrspace(1)* %a, i8 addrspace(1)* %b)
28declare void @llvm.xcore.setrdy.p1i8.p1i8(i8 addrspace(1)* %a, i8 addrspace(1)* %b)
29declare void @llvm.xcore.setpsc.p1i8(i8 addrspace(1)* %r, i32 %value)
30declare i32 @llvm.xcore.peek.p1i8(i8 addrspace(1)* %r)
31declare i32 @llvm.xcore.endin.p1i8(i8 addrspace(1)* %r)
32
33define i8 addrspace(1)* @getr() {
34; CHECK-LABEL: getr:
35; CHECK: getr r0, 5
36	%result = call i8 addrspace(1)* @llvm.xcore.getr.p1i8(i32 5)
37	ret i8 addrspace(1)* %result
38}
39
40define void @freer(i8 addrspace(1)* %r) {
41; CHECK-LABEL: freer:
42; CHECK: freer res[r0]
43	call void @llvm.xcore.freer.p1i8(i8 addrspace(1)* %r)
44	ret void
45}
46
47define i32 @in(i8 addrspace(1)* %r) {
48; CHECK-LABEL: in:
49; CHECK: in r0, res[r0]
50	%result = call i32 @llvm.xcore.in.p1i8(i8 addrspace(1)* %r)
51	ret i32 %result
52}
53
54define i32 @int(i8 addrspace(1)* %r) {
55; CHECK-LABEL: int:
56; CHECK: int r0, res[r0]
57	%result = call i32 @llvm.xcore.int.p1i8(i8 addrspace(1)* %r)
58	ret i32 %result
59}
60
61define i32 @inct(i8 addrspace(1)* %r) {
62; CHECK-LABEL: inct:
63; CHECK: inct r0, res[r0]
64	%result = call i32 @llvm.xcore.inct.p1i8(i8 addrspace(1)* %r)
65	ret i32 %result
66}
67
68define void @out(i8 addrspace(1)* %r, i32 %value) {
69; CHECK-LABEL: out:
70; CHECK: out res[r0], r1
71	call void @llvm.xcore.out.p1i8(i8 addrspace(1)* %r, i32 %value)
72	ret void
73}
74
75define void @outt(i8 addrspace(1)* %r, i32 %value) {
76; CHECK-LABEL: outt:
77; CHECK: outt res[r0], r1
78	call void @llvm.xcore.outt.p1i8(i8 addrspace(1)* %r, i32 %value)
79	ret void
80}
81
82define void @outct(i8 addrspace(1)* %r, i32 %value) {
83; CHECK-LABEL: outct:
84; CHECK: outct res[r0], r1
85	call void @llvm.xcore.outct.p1i8(i8 addrspace(1)* %r, i32 %value)
86	ret void
87}
88
89define void @outcti(i8 addrspace(1)* %r) {
90; CHECK-LABEL: outcti:
91; CHECK: outct res[r0], 11
92	call void @llvm.xcore.outct.p1i8(i8 addrspace(1)* %r, i32 11)
93	ret void
94}
95
96define void @chkct(i8 addrspace(1)* %r, i32 %value) {
97; CHECK-LABEL: chkct:
98; CHECK: chkct res[r0], r1
99	call void @llvm.xcore.chkct.p1i8(i8 addrspace(1)* %r, i32 %value)
100	ret void
101}
102
103define void @chkcti(i8 addrspace(1)* %r) {
104; CHECK-LABEL: chkcti:
105; CHECK: chkct res[r0], 11
106	call void @llvm.xcore.chkct.p1i8(i8 addrspace(1)* %r, i32 11)
107	ret void
108}
109
110define void @setd(i8 addrspace(1)* %r, i32 %value) {
111; CHECK-LABEL: setd:
112; CHECK: setd res[r0], r1
113	call void @llvm.xcore.setd.p1i8(i8 addrspace(1)* %r, i32 %value)
114	ret void
115}
116
117define void @setc(i8 addrspace(1)* %r, i32 %value) {
118; CHECK-LABEL: setc:
119; CHECK: setc res[r0], r1
120	call void @llvm.xcore.setc.p1i8(i8 addrspace(1)* %r, i32 %value)
121	ret void
122}
123
124define void @setci(i8 addrspace(1)* %r) {
125; CHECK-LABEL: setci:
126; CHECK: setc res[r0], 2
127	call void @llvm.xcore.setc.p1i8(i8 addrspace(1)* %r, i32 2)
128	ret void
129}
130
131define i32 @inshr(i32 %value, i8 addrspace(1)* %r) {
132; CHECK-LABEL: inshr:
133; CHECK: inshr r0, res[r1]
134	%result = call i32 @llvm.xcore.inshr.p1i8(i8 addrspace(1)* %r, i32 %value)
135	ret i32 %result
136}
137
138define i32 @outshr(i32 %value, i8 addrspace(1)* %r) {
139; CHECK-LABEL: outshr:
140; CHECK: outshr res[r1], r0
141	%result = call i32 @llvm.xcore.outshr.p1i8(i8 addrspace(1)* %r, i32 %value)
142	ret i32 %result
143}
144
145define void @clrpt(i8 addrspace(1)* %r) {
146; CHECK-LABEL: clrpt:
147; CHECK: clrpt res[r0]
148	call void @llvm.xcore.clrpt.p1i8(i8 addrspace(1)* %r)
149	ret void
150}
151
152define void @setpt(i8 addrspace(1)* %r, i32 %value) {
153; CHECK-LABEL: setpt:
154; CHECK: setpt res[r0], r1
155	call void @llvm.xcore.setpt.p1i8(i8 addrspace(1)* %r, i32 %value)
156	ret void
157}
158
159define i32 @getts(i8 addrspace(1)* %r) {
160; CHECK-LABEL: getts:
161; CHECK: getts r0, res[r0]
162	%result = call i32 @llvm.xcore.getts.p1i8(i8 addrspace(1)* %r)
163	ret i32 %result
164}
165
166define void @syncr(i8 addrspace(1)* %r) {
167; CHECK-LABEL: syncr:
168; CHECK: syncr res[r0]
169	call void @llvm.xcore.syncr.p1i8(i8 addrspace(1)* %r)
170	ret void
171}
172
173define void @settw(i8 addrspace(1)* %r, i32 %value) {
174; CHECK-LABEL: settw:
175; CHECK: settw res[r0], r1
176	call void @llvm.xcore.settw.p1i8(i8 addrspace(1)* %r, i32 %value)
177	ret void
178}
179
180define void @setv(i8 addrspace(1)* %r, i8* %p) {
181; CHECK-LABEL: setv:
182; CHECK: mov r11, r1
183; CHECK-NEXT: setv res[r0], r11
184	call void @llvm.xcore.setv.p1i8(i8 addrspace(1)* %r, i8* %p)
185	ret void
186}
187
188define void @setev(i8 addrspace(1)* %r, i8* %p) {
189; CHECK-LABEL: setev:
190; CHECK: mov r11, r1
191; CHECK-NEXT: setev res[r0], r11
192	call void @llvm.xcore.setev.p1i8(i8 addrspace(1)* %r, i8* %p)
193	ret void
194}
195
196define void @edu(i8 addrspace(1)* %r) {
197; CHECK-LABEL: edu:
198; CHECK: edu res[r0]
199	call void @llvm.xcore.edu.p1i8(i8 addrspace(1)* %r)
200	ret void
201}
202
203define void @eeu(i8 addrspace(1)* %r) {
204; CHECK-LABEL: eeu:
205; CHECK: eeu res[r0]
206	call void @llvm.xcore.eeu.p1i8(i8 addrspace(1)* %r)
207	ret void
208}
209
210define void @setclk(i8 addrspace(1)* %a, i8 addrspace(1)* %b) {
211; CHECK: setclk
212; CHECK: setclk res[r0], r1
213	call void @llvm.xcore.setclk.p1i8.p1i8(i8 addrspace(1)* %a, i8 addrspace(1)* %b)
214	ret void
215}
216
217define void @setrdy(i8 addrspace(1)* %a, i8 addrspace(1)* %b) {
218; CHECK: setrdy
219; CHECK: setrdy res[r0], r1
220	call void @llvm.xcore.setrdy.p1i8.p1i8(i8 addrspace(1)* %a, i8 addrspace(1)* %b)
221	ret void
222}
223
224define void @setpsc(i8 addrspace(1)* %r, i32 %value) {
225; CHECK: setpsc
226; CHECK: setpsc res[r0], r1
227	call void @llvm.xcore.setpsc.p1i8(i8 addrspace(1)* %r, i32 %value)
228	ret void
229}
230
231define i32 @peek(i8 addrspace(1)* %r) {
232; CHECK-LABEL: peek:
233; CHECK: peek r0, res[r0]
234	%result = call i32 @llvm.xcore.peek.p1i8(i8 addrspace(1)* %r)
235	ret i32 %result
236}
237
238define i32 @endin(i8 addrspace(1)* %r) {
239; CHECK-LABEL: endin:
240; CHECK: endin r0, res[r0]
241	%result = call i32 @llvm.xcore.endin.p1i8(i8 addrspace(1)* %r)
242	ret i32 %result
243}
244
245define i32 @testct(i8 addrspace(1)* %r) {
246; CHECK-LABEL: testct:
247; CHECK: testct r0, res[r0]
248	%result = call i32 @llvm.xcore.testct.p1i8(i8 addrspace(1)* %r)
249	ret i32 %result
250}
251
252define i32 @testwct(i8 addrspace(1)* %r) {
253; CHECK-LABEL: testwct:
254; CHECK: testwct r0, res[r0]
255	%result = call i32 @llvm.xcore.testwct.p1i8(i8 addrspace(1)* %r)
256	ret i32 %result
257}
258