1*f4a2713aSLionel Sambuc // REQUIRES: mips-registered-target
2*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -triple mips-unknown-linux-gnu -emit-llvm %s -o - \
3*f4a2713aSLionel Sambuc // RUN:   | FileCheck %s
4*f4a2713aSLionel Sambuc 
5*f4a2713aSLionel Sambuc typedef int q31;
6*f4a2713aSLionel Sambuc typedef int i32;
7*f4a2713aSLionel Sambuc typedef unsigned int ui32;
8*f4a2713aSLionel Sambuc typedef long long a64;
9*f4a2713aSLionel Sambuc 
10*f4a2713aSLionel Sambuc typedef signed char v4i8 __attribute__ ((vector_size(4)));
11*f4a2713aSLionel Sambuc typedef signed char v4q7 __attribute__ ((vector_size(4)));
12*f4a2713aSLionel Sambuc typedef short v2i16 __attribute__ ((vector_size(4)));
13*f4a2713aSLionel Sambuc typedef short v2q15 __attribute__ ((vector_size(4)));
14*f4a2713aSLionel Sambuc 
foo()15*f4a2713aSLionel Sambuc void foo() {
16*f4a2713aSLionel Sambuc   v2q15 v2q15_r, v2q15_a, v2q15_b, v2q15_c;
17*f4a2713aSLionel Sambuc   v2i16 v2i16_r, v2i16_a, v2i16_b, v2i16_c;
18*f4a2713aSLionel Sambuc   v4q7 v4q7_r, v4q7_a, v4q7_b;
19*f4a2713aSLionel Sambuc   v4i8 v4i8_r, v4i8_a, v4i8_b, v4i8_c;
20*f4a2713aSLionel Sambuc   q31 q31_r, q31_a, q31_b, q31_c;
21*f4a2713aSLionel Sambuc   i32 i32_r, i32_a, i32_b, i32_c;
22*f4a2713aSLionel Sambuc   ui32 ui32_r, ui32_a, ui32_b, ui32_c;
23*f4a2713aSLionel Sambuc   a64 a64_r, a64_a, a64_b;
24*f4a2713aSLionel Sambuc 
25*f4a2713aSLionel Sambuc   // MIPS DSP Rev 1
26*f4a2713aSLionel Sambuc 
27*f4a2713aSLionel Sambuc   v4i8_a = (v4i8) {1, 2, 3, 0xFF};
28*f4a2713aSLionel Sambuc   v4i8_b = (v4i8) {2, 4, 6, 8};
29*f4a2713aSLionel Sambuc   v4i8_r = __builtin_mips_addu_qb(v4i8_a, v4i8_b);
30*f4a2713aSLionel Sambuc // CHECK: call <4 x i8> @llvm.mips.addu.qb
31*f4a2713aSLionel Sambuc   v4i8_r = __builtin_mips_addu_s_qb(v4i8_a, v4i8_b);
32*f4a2713aSLionel Sambuc // CHECK: call <4 x i8> @llvm.mips.addu.s.qb
33*f4a2713aSLionel Sambuc   v4i8_r = __builtin_mips_subu_qb(v4i8_a, v4i8_b);
34*f4a2713aSLionel Sambuc // CHECK: call <4 x i8> @llvm.mips.subu.qb
35*f4a2713aSLionel Sambuc   v4i8_r = __builtin_mips_subu_s_qb(v4i8_a, v4i8_b);
36*f4a2713aSLionel Sambuc // CHECK: call <4 x i8> @llvm.mips.subu.s.qb
37*f4a2713aSLionel Sambuc 
38*f4a2713aSLionel Sambuc   v2q15_a = (v2q15) {0x0000, 0x8000};
39*f4a2713aSLionel Sambuc   v2q15_b = (v2q15) {0x8000, 0x8000};
40*f4a2713aSLionel Sambuc   v2q15_r = __builtin_mips_addq_ph(v2q15_a, v2q15_b);
41*f4a2713aSLionel Sambuc // CHECK: call <2 x i16> @llvm.mips.addq.ph
42*f4a2713aSLionel Sambuc   v2q15_r = __builtin_mips_addq_s_ph(v2q15_a, v2q15_b);
43*f4a2713aSLionel Sambuc // CHECK: call <2 x i16> @llvm.mips.addq.s.ph
44*f4a2713aSLionel Sambuc   v2q15_r = __builtin_mips_subq_ph(v2q15_a, v2q15_b);
45*f4a2713aSLionel Sambuc // CHECK: call <2 x i16> @llvm.mips.subq.ph
46*f4a2713aSLionel Sambuc   v2q15_r = __builtin_mips_subq_s_ph(v2q15_a, v2q15_b);
47*f4a2713aSLionel Sambuc // CHECK: call <2 x i16> @llvm.mips.subq.s.ph
48*f4a2713aSLionel Sambuc 
49*f4a2713aSLionel Sambuc   a64_a = 0x12345678;
50*f4a2713aSLionel Sambuc   i32_b = 0x80000000;
51*f4a2713aSLionel Sambuc   i32_c = 0x11112222;
52*f4a2713aSLionel Sambuc   a64_r = __builtin_mips_madd(a64_a, i32_b, i32_c);
53*f4a2713aSLionel Sambuc // CHECK: call i64 @llvm.mips.madd
54*f4a2713aSLionel Sambuc   a64_a = 0x12345678;
55*f4a2713aSLionel Sambuc   ui32_b = 0x80000000;
56*f4a2713aSLionel Sambuc   ui32_c = 0x11112222;
57*f4a2713aSLionel Sambuc   a64_r = __builtin_mips_maddu(a64_a, ui32_b, ui32_c);
58*f4a2713aSLionel Sambuc // CHECK: call i64 @llvm.mips.maddu
59*f4a2713aSLionel Sambuc   a64_a = 0x12345678;
60*f4a2713aSLionel Sambuc   i32_b = 0x80000000;
61*f4a2713aSLionel Sambuc   i32_c = 0x11112222;
62*f4a2713aSLionel Sambuc   a64_r = __builtin_mips_msub(a64_a, i32_b, i32_c);
63*f4a2713aSLionel Sambuc // CHECK: call i64 @llvm.mips.msub
64*f4a2713aSLionel Sambuc   a64_a = 0x12345678;
65*f4a2713aSLionel Sambuc   ui32_b = 0x80000000;
66*f4a2713aSLionel Sambuc   ui32_c = 0x11112222;
67*f4a2713aSLionel Sambuc   a64_r = __builtin_mips_msubu(a64_a, ui32_b, ui32_c);
68*f4a2713aSLionel Sambuc // CHECK: call i64 @llvm.mips.msubu
69*f4a2713aSLionel Sambuc 
70*f4a2713aSLionel Sambuc   q31_a = 0x12345678;
71*f4a2713aSLionel Sambuc   q31_b = 0x7FFFFFFF;
72*f4a2713aSLionel Sambuc   q31_r = __builtin_mips_addq_s_w(q31_a, q31_b);
73*f4a2713aSLionel Sambuc // CHECK: call i32 @llvm.mips.addq.s.w
74*f4a2713aSLionel Sambuc   q31_r = __builtin_mips_subq_s_w(q31_a, q31_b);
75*f4a2713aSLionel Sambuc // CHECK: call i32 @llvm.mips.subq.s.w
76*f4a2713aSLionel Sambuc 
77*f4a2713aSLionel Sambuc   i32_a = 0xFFFFFFFF;
78*f4a2713aSLionel Sambuc   i32_b = 1;
79*f4a2713aSLionel Sambuc   i32_r = __builtin_mips_addsc(i32_a, i32_b);
80*f4a2713aSLionel Sambuc // CHECK: call i32 @llvm.mips.addsc
81*f4a2713aSLionel Sambuc   i32_a = 0;
82*f4a2713aSLionel Sambuc   i32_b = 1;
83*f4a2713aSLionel Sambuc   i32_r = __builtin_mips_addwc(i32_a, i32_b);
84*f4a2713aSLionel Sambuc // CHECK: call i32 @llvm.mips.addwc
85*f4a2713aSLionel Sambuc 
86*f4a2713aSLionel Sambuc   i32_a = 20;
87*f4a2713aSLionel Sambuc   i32_b = 0x1402;
88*f4a2713aSLionel Sambuc   i32_r = __builtin_mips_modsub(i32_a, i32_b);
89*f4a2713aSLionel Sambuc // CHECK: call i32 @llvm.mips.modsub
90*f4a2713aSLionel Sambuc 
91*f4a2713aSLionel Sambuc   v4i8_a = (v4i8) {1, 2, 3, 4};
92*f4a2713aSLionel Sambuc   i32_r = __builtin_mips_raddu_w_qb(v4i8_a);
93*f4a2713aSLionel Sambuc // CHECK: call i32 @llvm.mips.raddu.w.qb
94*f4a2713aSLionel Sambuc 
95*f4a2713aSLionel Sambuc   v2q15_a = (v2q15) {0xFFFF, 0x8000};
96*f4a2713aSLionel Sambuc   v2q15_r = __builtin_mips_absq_s_ph(v2q15_a);
97*f4a2713aSLionel Sambuc // CHECK: call <2 x i16> @llvm.mips.absq.s.ph
98*f4a2713aSLionel Sambuc   q31_a = 0x80000000;
99*f4a2713aSLionel Sambuc   q31_r = __builtin_mips_absq_s_w(q31_a);
100*f4a2713aSLionel Sambuc // CHECK: call i32 @llvm.mips.absq.s.w
101*f4a2713aSLionel Sambuc 
102*f4a2713aSLionel Sambuc   v2q15_a = (v2q15) {0x1234, 0x5678};
103*f4a2713aSLionel Sambuc   v2q15_b = (v2q15) {0x1111, 0x2222};
104*f4a2713aSLionel Sambuc   v4i8_r = __builtin_mips_precrq_qb_ph(v2q15_a, v2q15_b);
105*f4a2713aSLionel Sambuc // CHECK: call <4 x i8> @llvm.mips.precrq.qb.ph
106*f4a2713aSLionel Sambuc 
107*f4a2713aSLionel Sambuc   v2q15_a = (v2q15) {0x7F79, 0xFFFF};
108*f4a2713aSLionel Sambuc   v2q15_b = (v2q15) {0x7F81, 0x2000};
109*f4a2713aSLionel Sambuc   v4i8_r = __builtin_mips_precrqu_s_qb_ph(v2q15_a, v2q15_b);
110*f4a2713aSLionel Sambuc // CHECK: call <4 x i8> @llvm.mips.precrqu.s.qb.ph
111*f4a2713aSLionel Sambuc   q31_a = 0x12345678;
112*f4a2713aSLionel Sambuc   q31_b = 0x11112222;
113*f4a2713aSLionel Sambuc   v2q15_r = __builtin_mips_precrq_ph_w(q31_a, q31_b);
114*f4a2713aSLionel Sambuc // CHECK: call <2 x i16> @llvm.mips.precrq.ph.w
115*f4a2713aSLionel Sambuc   q31_a = 0x7000FFFF;
116*f4a2713aSLionel Sambuc   q31_b = 0x80000000;
117*f4a2713aSLionel Sambuc   v2q15_r = __builtin_mips_precrq_rs_ph_w(q31_a, q31_b);
118*f4a2713aSLionel Sambuc // CHECK: call <2 x i16> @llvm.mips.precrq.rs.ph.w
119*f4a2713aSLionel Sambuc   v2q15_a = (v2q15) {0x1234, 0x5678};
120*f4a2713aSLionel Sambuc   q31_r = __builtin_mips_preceq_w_phl(v2q15_a);
121*f4a2713aSLionel Sambuc // CHECK: call i32 @llvm.mips.preceq.w.phl
122*f4a2713aSLionel Sambuc   q31_r = __builtin_mips_preceq_w_phr(v2q15_a);
123*f4a2713aSLionel Sambuc // CHECK: call i32 @llvm.mips.preceq.w.phr
124*f4a2713aSLionel Sambuc   v4i8_a = (v4i8) {0x12, 0x34, 0x56, 0x78};
125*f4a2713aSLionel Sambuc   v2q15_r = __builtin_mips_precequ_ph_qbl(v4i8_a);
126*f4a2713aSLionel Sambuc // CHECK: call <2 x i16> @llvm.mips.precequ.ph.qbl
127*f4a2713aSLionel Sambuc   v2q15_r = __builtin_mips_precequ_ph_qbr(v4i8_a);
128*f4a2713aSLionel Sambuc // CHECK: call <2 x i16> @llvm.mips.precequ.ph.qbr
129*f4a2713aSLionel Sambuc   v2q15_r = __builtin_mips_precequ_ph_qbla(v4i8_a);
130*f4a2713aSLionel Sambuc // CHECK: call <2 x i16> @llvm.mips.precequ.ph.qbla
131*f4a2713aSLionel Sambuc   v2q15_r = __builtin_mips_precequ_ph_qbra(v4i8_a);
132*f4a2713aSLionel Sambuc // CHECK: call <2 x i16> @llvm.mips.precequ.ph.qbra
133*f4a2713aSLionel Sambuc   v2q15_r = __builtin_mips_preceu_ph_qbl(v4i8_a);
134*f4a2713aSLionel Sambuc // CHECK: call <2 x i16> @llvm.mips.preceu.ph.qbl
135*f4a2713aSLionel Sambuc   v2q15_r = __builtin_mips_preceu_ph_qbr(v4i8_a);
136*f4a2713aSLionel Sambuc // CHECK: call <2 x i16> @llvm.mips.preceu.ph.qbr
137*f4a2713aSLionel Sambuc   v2q15_r = __builtin_mips_preceu_ph_qbla(v4i8_a);
138*f4a2713aSLionel Sambuc // CHECK: call <2 x i16> @llvm.mips.preceu.ph.qbla
139*f4a2713aSLionel Sambuc   v2q15_r = __builtin_mips_preceu_ph_qbra(v4i8_a);
140*f4a2713aSLionel Sambuc // CHECK: call <2 x i16> @llvm.mips.preceu.ph.qbra
141*f4a2713aSLionel Sambuc 
142*f4a2713aSLionel Sambuc   v4i8_a = (v4i8) {1, 2, 3, 4};
143*f4a2713aSLionel Sambuc   v4i8_r = __builtin_mips_shll_qb(v4i8_a, 2);
144*f4a2713aSLionel Sambuc // CHECK: call <4 x i8> @llvm.mips.shll.qb
145*f4a2713aSLionel Sambuc   v4i8_a = (v4i8) {128, 64, 32, 16};
146*f4a2713aSLionel Sambuc   v4i8_r = __builtin_mips_shrl_qb(v4i8_a, 2);
147*f4a2713aSLionel Sambuc // CHECK: call <4 x i8> @llvm.mips.shrl.qb
148*f4a2713aSLionel Sambuc   v2q15_a = (v2q15) {0x0001, 0x8000};
149*f4a2713aSLionel Sambuc   v2q15_r = __builtin_mips_shll_ph(v2q15_a, 2);
150*f4a2713aSLionel Sambuc // CHECK: call <2 x i16> @llvm.mips.shll.ph
151*f4a2713aSLionel Sambuc   v2q15_r = __builtin_mips_shll_s_ph(v2q15_a, 2);
152*f4a2713aSLionel Sambuc // CHECK: call <2 x i16> @llvm.mips.shll.s.ph
153*f4a2713aSLionel Sambuc   v2q15_a = (v2q15) {0x7FFF, 0x8000};
154*f4a2713aSLionel Sambuc   v2q15_r = __builtin_mips_shra_ph(v2q15_a, 2);
155*f4a2713aSLionel Sambuc // CHECK: call <2 x i16> @llvm.mips.shra.ph
156*f4a2713aSLionel Sambuc   v2q15_r = __builtin_mips_shra_r_ph(v2q15_a, 2);
157*f4a2713aSLionel Sambuc // CHECK: call <2 x i16> @llvm.mips.shra.r.ph
158*f4a2713aSLionel Sambuc   q31_a = 0x70000000;
159*f4a2713aSLionel Sambuc   q31_r = __builtin_mips_shll_s_w(q31_a, 2);
160*f4a2713aSLionel Sambuc // CHECK: call i32 @llvm.mips.shll.s.w
161*f4a2713aSLionel Sambuc   q31_a = 0x7FFFFFFF;
162*f4a2713aSLionel Sambuc   q31_r = __builtin_mips_shra_r_w(q31_a, 2);
163*f4a2713aSLionel Sambuc // CHECK: call i32 @llvm.mips.shra.r.w
164*f4a2713aSLionel Sambuc   a64_a = 0x1234567887654321LL;
165*f4a2713aSLionel Sambuc   a64_r = __builtin_mips_shilo(a64_a, -8);
166*f4a2713aSLionel Sambuc // CHECK: call i64 @llvm.mips.shilo
167*f4a2713aSLionel Sambuc 
168*f4a2713aSLionel Sambuc   v4i8_a = (v4i8) {0x1, 0x3, 0x5, 0x7};
169*f4a2713aSLionel Sambuc   v2q15_b = (v2q15) {0x1234, 0x5678};
170*f4a2713aSLionel Sambuc   v2q15_r = __builtin_mips_muleu_s_ph_qbl(v4i8_a, v2q15_b);
171*f4a2713aSLionel Sambuc // CHECK: call <2 x i16> @llvm.mips.muleu.s.ph.qbl
172*f4a2713aSLionel Sambuc   v2q15_r = __builtin_mips_muleu_s_ph_qbr(v4i8_a, v2q15_b);
173*f4a2713aSLionel Sambuc // CHECK: call <2 x i16> @llvm.mips.muleu.s.ph.qbr
174*f4a2713aSLionel Sambuc   v2q15_a = (v2q15) {0x7FFF, 0x8000};
175*f4a2713aSLionel Sambuc   v2q15_b = (v2q15) {0x7FFF, 0x8000};
176*f4a2713aSLionel Sambuc   v2q15_r = __builtin_mips_mulq_rs_ph(v2q15_a, v2q15_b);
177*f4a2713aSLionel Sambuc // CHECK: call <2 x i16> @llvm.mips.mulq.rs.ph
178*f4a2713aSLionel Sambuc   v2q15_a = (v2q15) {0x1234, 0x8000};
179*f4a2713aSLionel Sambuc   v2q15_b = (v2q15) {0x5678, 0x8000};
180*f4a2713aSLionel Sambuc   q31_r = __builtin_mips_muleq_s_w_phl(v2q15_a, v2q15_b);
181*f4a2713aSLionel Sambuc // CHECK: call i32 @llvm.mips.muleq.s.w.phl
182*f4a2713aSLionel Sambuc   q31_r = __builtin_mips_muleq_s_w_phr(v2q15_a, v2q15_b);
183*f4a2713aSLionel Sambuc // CHECK: call i32 @llvm.mips.muleq.s.w.phr
184*f4a2713aSLionel Sambuc   a64_a = 0;
185*f4a2713aSLionel Sambuc   v2q15_a = (v2q15) {0x0001, 0x8000};
186*f4a2713aSLionel Sambuc   v2q15_b = (v2q15) {0x0002, 0x8000};
187*f4a2713aSLionel Sambuc   a64_r = __builtin_mips_mulsaq_s_w_ph(a64_a, v2q15_b, v2q15_c);
188*f4a2713aSLionel Sambuc // CHECK: call i64 @llvm.mips.mulsaq.s.w.ph
189*f4a2713aSLionel Sambuc   a64_a = 0;
190*f4a2713aSLionel Sambuc   v2q15_b = (v2q15) {0x0001, 0x8000};
191*f4a2713aSLionel Sambuc   v2q15_c = (v2q15) {0x0002, 0x8000};
192*f4a2713aSLionel Sambuc   a64_r = __builtin_mips_maq_s_w_phl(a64_a, v2q15_b, v2q15_c);
193*f4a2713aSLionel Sambuc // CHECK: call i64 @llvm.mips.maq.s.w.phl
194*f4a2713aSLionel Sambuc   a64_r = __builtin_mips_maq_s_w_phr(a64_a, v2q15_b, v2q15_c);
195*f4a2713aSLionel Sambuc // CHECK: call i64 @llvm.mips.maq.s.w.phr
196*f4a2713aSLionel Sambuc   a64_a = 0x7FFFFFF0;
197*f4a2713aSLionel Sambuc   a64_r = __builtin_mips_maq_sa_w_phl(a64_a, v2q15_b, v2q15_c);
198*f4a2713aSLionel Sambuc // CHECK: call i64 @llvm.mips.maq.sa.w.phl
199*f4a2713aSLionel Sambuc   a64_r = __builtin_mips_maq_sa_w_phr(a64_a, v2q15_b, v2q15_c);
200*f4a2713aSLionel Sambuc // CHECK: call i64 @llvm.mips.maq.sa.w.phr
201*f4a2713aSLionel Sambuc   i32_a = 0x80000000;
202*f4a2713aSLionel Sambuc   i32_b = 0x11112222;
203*f4a2713aSLionel Sambuc   a64_r = __builtin_mips_mult(i32_a, i32_b);
204*f4a2713aSLionel Sambuc // CHECK: call i64 @llvm.mips.mult
205*f4a2713aSLionel Sambuc   ui32_a = 0x80000000;
206*f4a2713aSLionel Sambuc   ui32_b = 0x11112222;
207*f4a2713aSLionel Sambuc   a64_r = __builtin_mips_multu(ui32_a, ui32_b);
208*f4a2713aSLionel Sambuc // CHECK: call i64 @llvm.mips.multu
209*f4a2713aSLionel Sambuc 
210*f4a2713aSLionel Sambuc   a64_a = 0;
211*f4a2713aSLionel Sambuc   v4i8_b = (v4i8) {1, 2, 3, 4};
212*f4a2713aSLionel Sambuc   v4i8_c = (v4i8) {4, 5, 6, 7};
213*f4a2713aSLionel Sambuc   a64_r = __builtin_mips_dpau_h_qbl(a64_a, v4i8_b, v4i8_c);
214*f4a2713aSLionel Sambuc // CHECK: call i64 @llvm.mips.dpau.h.qbl
215*f4a2713aSLionel Sambuc   a64_r = __builtin_mips_dpau_h_qbr(a64_a, v4i8_b, v4i8_c);
216*f4a2713aSLionel Sambuc // CHECK: call i64 @llvm.mips.dpau.h.qbr
217*f4a2713aSLionel Sambuc   a64_r = __builtin_mips_dpsu_h_qbl(a64_a, v4i8_b, v4i8_c);
218*f4a2713aSLionel Sambuc // CHECK: call i64 @llvm.mips.dpsu.h.qbl
219*f4a2713aSLionel Sambuc   a64_r = __builtin_mips_dpsu_h_qbr(a64_a, v4i8_b, v4i8_c);
220*f4a2713aSLionel Sambuc // CHECK: call i64 @llvm.mips.dpsu.h.qbr
221*f4a2713aSLionel Sambuc   a64_a = 0;
222*f4a2713aSLionel Sambuc   v2q15_b = (v2q15) {0x0001, 0x8000};
223*f4a2713aSLionel Sambuc   v2q15_c = (v2q15) {0x0002, 0x8000};
224*f4a2713aSLionel Sambuc   a64_r = __builtin_mips_dpaq_s_w_ph(a64_a, v2q15_b, v2q15_c);
225*f4a2713aSLionel Sambuc // CHECK: call i64 @llvm.mips.dpaq.s.w.ph
226*f4a2713aSLionel Sambuc   a64_r = __builtin_mips_dpsq_s_w_ph(a64_a, v2q15_b, v2q15_c);
227*f4a2713aSLionel Sambuc // CHECK: call i64 @llvm.mips.dpsq.s.w.ph
228*f4a2713aSLionel Sambuc   a64_a = 0;
229*f4a2713aSLionel Sambuc   q31_b = 0x80000000;
230*f4a2713aSLionel Sambuc   q31_c = 0x80000000;
231*f4a2713aSLionel Sambuc   a64_r = __builtin_mips_dpaq_sa_l_w(a64_a, q31_b, q31_c);
232*f4a2713aSLionel Sambuc // CHECK: call i64 @llvm.mips.dpaq.sa.l.w
233*f4a2713aSLionel Sambuc   a64_r = __builtin_mips_dpsq_sa_l_w(a64_a, q31_b, q31_c);
234*f4a2713aSLionel Sambuc // CHECK: call i64 @llvm.mips.dpsq.sa.l.w
235*f4a2713aSLionel Sambuc 
236*f4a2713aSLionel Sambuc   v4i8_a = (v4i8) {1, 4, 10, 8};
237*f4a2713aSLionel Sambuc   v4i8_b = (v4i8) {1, 2, 100, 8};
238*f4a2713aSLionel Sambuc   __builtin_mips_cmpu_eq_qb(v4i8_a, v4i8_b);
239*f4a2713aSLionel Sambuc // CHECK: call void @llvm.mips.cmpu.eq.qb
240*f4a2713aSLionel Sambuc   __builtin_mips_cmpu_lt_qb(v4i8_a, v4i8_b);
241*f4a2713aSLionel Sambuc // CHECK: call void @llvm.mips.cmpu.lt.qb
242*f4a2713aSLionel Sambuc   __builtin_mips_cmpu_le_qb(v4i8_a, v4i8_b);
243*f4a2713aSLionel Sambuc // CHECK: call void @llvm.mips.cmpu.le.qb
244*f4a2713aSLionel Sambuc   i32_r = __builtin_mips_cmpgu_eq_qb(v4i8_a, v4i8_b);
245*f4a2713aSLionel Sambuc // CHECK: call i32 @llvm.mips.cmpgu.eq.qb
246*f4a2713aSLionel Sambuc   i32_r = __builtin_mips_cmpgu_lt_qb(v4i8_a, v4i8_b);
247*f4a2713aSLionel Sambuc // CHECK: call i32 @llvm.mips.cmpgu.lt.qb
248*f4a2713aSLionel Sambuc   i32_r = __builtin_mips_cmpgu_le_qb(v4i8_a, v4i8_b);
249*f4a2713aSLionel Sambuc // CHECK: call i32 @llvm.mips.cmpgu.le.qb
250*f4a2713aSLionel Sambuc   v2q15_a = (v2q15) {0x1111, 0x1234};
251*f4a2713aSLionel Sambuc   v2q15_b = (v2q15) {0x4444, 0x1234};
252*f4a2713aSLionel Sambuc   __builtin_mips_cmp_eq_ph(v2q15_a, v2q15_b);
253*f4a2713aSLionel Sambuc // CHECK: call void @llvm.mips.cmp.eq.ph
254*f4a2713aSLionel Sambuc   __builtin_mips_cmp_lt_ph(v2q15_a, v2q15_b);
255*f4a2713aSLionel Sambuc // CHECK: call void @llvm.mips.cmp.lt.ph
256*f4a2713aSLionel Sambuc   __builtin_mips_cmp_le_ph(v2q15_a, v2q15_b);
257*f4a2713aSLionel Sambuc // CHECK: call void @llvm.mips.cmp.le.ph
258*f4a2713aSLionel Sambuc 
259*f4a2713aSLionel Sambuc   a64_a = 0xFFFFF81230000000LL;
260*f4a2713aSLionel Sambuc   i32_r = __builtin_mips_extr_s_h(a64_a, 4);
261*f4a2713aSLionel Sambuc // CHECK: call i32 @llvm.mips.extr.s.h
262*f4a2713aSLionel Sambuc   a64_a = 0x8123456712345678LL;
263*f4a2713aSLionel Sambuc   i32_r = __builtin_mips_extr_w(a64_a, 31);
264*f4a2713aSLionel Sambuc // CHECK: call i32 @llvm.mips.extr.w
265*f4a2713aSLionel Sambuc   i32_r = __builtin_mips_extr_rs_w(a64_a, 31);
266*f4a2713aSLionel Sambuc // CHECK: call i32 @llvm.mips.extr.rs.w
267*f4a2713aSLionel Sambuc   i32_r = __builtin_mips_extr_r_w(a64_a, 31);
268*f4a2713aSLionel Sambuc // CHECK: call i32 @llvm.mips.extr.r.w
269*f4a2713aSLionel Sambuc   a64_a = 0x1234567887654321LL;
270*f4a2713aSLionel Sambuc   i32_r = __builtin_mips_extp(a64_a, 3);
271*f4a2713aSLionel Sambuc // CHECK: call i32 @llvm.mips.extp
272*f4a2713aSLionel Sambuc   a64_a = 0x123456789ABCDEF0LL;
273*f4a2713aSLionel Sambuc   i32_r = __builtin_mips_extpdp(a64_a, 7);
274*f4a2713aSLionel Sambuc // CHECK: call i32 @llvm.mips.extpdp
275*f4a2713aSLionel Sambuc 
276*f4a2713aSLionel Sambuc   __builtin_mips_wrdsp(2052, 3);
277*f4a2713aSLionel Sambuc // CHECK: call void @llvm.mips.wrdsp
278*f4a2713aSLionel Sambuc   i32_r = __builtin_mips_rddsp(3);
279*f4a2713aSLionel Sambuc // CHECK: call i32 @llvm.mips.rddsp
280*f4a2713aSLionel Sambuc   i32_a = 0xFFFFFFFF;
281*f4a2713aSLionel Sambuc   i32_b = 0x12345678;
282*f4a2713aSLionel Sambuc   __builtin_mips_wrdsp((16<<7) + 4, 3);
283*f4a2713aSLionel Sambuc // CHECK: call void @llvm.mips.wrdsp
284*f4a2713aSLionel Sambuc   i32_r = __builtin_mips_insv(i32_a, i32_b);
285*f4a2713aSLionel Sambuc // CHECK: call i32 @llvm.mips.insv
286*f4a2713aSLionel Sambuc   i32_a = 0x1234;
287*f4a2713aSLionel Sambuc   i32_r = __builtin_mips_bitrev(i32_a);
288*f4a2713aSLionel Sambuc // CHECK: call i32 @llvm.mips.bitrev
289*f4a2713aSLionel Sambuc   v2q15_a = (v2q15) {0x1111, 0x2222};
290*f4a2713aSLionel Sambuc   v2q15_b = (v2q15) {0x3333, 0x4444};
291*f4a2713aSLionel Sambuc   v2q15_r = __builtin_mips_packrl_ph(v2q15_a, v2q15_b);
292*f4a2713aSLionel Sambuc // CHECK: call <2 x i16> @llvm.mips.packrl.ph
293*f4a2713aSLionel Sambuc   i32_a = 100;
294*f4a2713aSLionel Sambuc   v4i8_r = __builtin_mips_repl_qb(i32_a);
295*f4a2713aSLionel Sambuc // CHECK: call <4 x i8> @llvm.mips.repl.qb
296*f4a2713aSLionel Sambuc   i32_a = 0x1234;
297*f4a2713aSLionel Sambuc   v2q15_r = __builtin_mips_repl_ph(i32_a);
298*f4a2713aSLionel Sambuc // CHECK: call <2 x i16> @llvm.mips.repl.ph
299*f4a2713aSLionel Sambuc   v4i8_a = (v4i8) {1, 4, 10, 8};
300*f4a2713aSLionel Sambuc   v4i8_b = (v4i8) {1, 2, 100, 8};
301*f4a2713aSLionel Sambuc   __builtin_mips_cmpu_eq_qb(v4i8_a, v4i8_b);
302*f4a2713aSLionel Sambuc // CHECK: call void @llvm.mips.cmpu.eq.qb
303*f4a2713aSLionel Sambuc   v4i8_r = __builtin_mips_pick_qb(v4i8_a, v4i8_b);
304*f4a2713aSLionel Sambuc // CHECK: call <4 x i8> @llvm.mips.pick.qb
305*f4a2713aSLionel Sambuc   v2q15_a = (v2q15) {0x1111, 0x1234};
306*f4a2713aSLionel Sambuc   v2q15_b = (v2q15) {0x4444, 0x1234};
307*f4a2713aSLionel Sambuc   __builtin_mips_cmp_eq_ph(v2q15_a, v2q15_b);
308*f4a2713aSLionel Sambuc // CHECK: call void @llvm.mips.cmp.eq.ph
309*f4a2713aSLionel Sambuc   v2q15_r = __builtin_mips_pick_ph(v2q15_a, v2q15_b);
310*f4a2713aSLionel Sambuc // CHECK: call <2 x i16> @llvm.mips.pick.ph
311*f4a2713aSLionel Sambuc   a64_a = 0x1234567887654321LL;
312*f4a2713aSLionel Sambuc   i32_b = 0x11112222;
313*f4a2713aSLionel Sambuc   __builtin_mips_wrdsp(0, 1);
314*f4a2713aSLionel Sambuc // CHECK: call void @llvm.mips.wrdsp
315*f4a2713aSLionel Sambuc   a64_r = __builtin_mips_mthlip(a64_a, i32_b);
316*f4a2713aSLionel Sambuc // CHECK: call i64 @llvm.mips.mthlip
317*f4a2713aSLionel Sambuc   i32_r = __builtin_mips_bposge32();
318*f4a2713aSLionel Sambuc // CHECK: call i32 @llvm.mips.bposge32
319*f4a2713aSLionel Sambuc   char array_a[100];
320*f4a2713aSLionel Sambuc   i32_r = __builtin_mips_lbux(array_a, 20);
321*f4a2713aSLionel Sambuc // CHECK: call i32 @llvm.mips.lbux
322*f4a2713aSLionel Sambuc   short array_b[100];
323*f4a2713aSLionel Sambuc   i32_r = __builtin_mips_lhx(array_b, 20);
324*f4a2713aSLionel Sambuc // CHECK: call i32 @llvm.mips.lhx
325*f4a2713aSLionel Sambuc   int array_c[100];
326*f4a2713aSLionel Sambuc   i32_r = __builtin_mips_lwx(array_c, 20);
327*f4a2713aSLionel Sambuc // CHECK: call i32 @llvm.mips.lwx
328*f4a2713aSLionel Sambuc 
329*f4a2713aSLionel Sambuc   // MIPS DSP Rev 2
330*f4a2713aSLionel Sambuc 
331*f4a2713aSLionel Sambuc   v4q7_a = (v4q7) {0x81, 0xff, 0x80, 0x23};
332*f4a2713aSLionel Sambuc   v4q7_r = __builtin_mips_absq_s_qb (v4q7_a);
333*f4a2713aSLionel Sambuc // CHECK: call <4 x i8> @llvm.mips.absq.s.qb
334*f4a2713aSLionel Sambuc 
335*f4a2713aSLionel Sambuc   v2q15_a = (v2q15) {0x3334, 0x4444};
336*f4a2713aSLionel Sambuc   v2q15_b = (v2q15) {0x1111, 0x2222};
337*f4a2713aSLionel Sambuc   v2q15_r = __builtin_mips_addqh_ph(v2q15_a, v2q15_b);
338*f4a2713aSLionel Sambuc // CHECK: call <2 x i16> @llvm.mips.addqh.ph
339*f4a2713aSLionel Sambuc   v2q15_a = (v2q15) {0x3334, 0x4444};
340*f4a2713aSLionel Sambuc   v2q15_b = (v2q15) {0x1111, 0x2222};
341*f4a2713aSLionel Sambuc   v2q15_r = __builtin_mips_addqh_r_ph(v2q15_a, v2q15_b);
342*f4a2713aSLionel Sambuc // CHECK: call <2 x i16> @llvm.mips.addqh.r.ph
343*f4a2713aSLionel Sambuc   q31_a = 0x11111112;
344*f4a2713aSLionel Sambuc   q31_b = 0x99999999;
345*f4a2713aSLionel Sambuc   q31_r = __builtin_mips_addqh_w(q31_a, q31_b);
346*f4a2713aSLionel Sambuc // CHECK: call i32 @llvm.mips.addqh.w
347*f4a2713aSLionel Sambuc   q31_a = 0x11111112;
348*f4a2713aSLionel Sambuc   q31_b = 0x99999999;
349*f4a2713aSLionel Sambuc   q31_r = __builtin_mips_addqh_r_w(q31_a, q31_b);
350*f4a2713aSLionel Sambuc // CHECK: call i32 @llvm.mips.addqh.r.w
351*f4a2713aSLionel Sambuc 
352*f4a2713aSLionel Sambuc   v2i16_a = (v2i16) {0xffff, 0x2468};
353*f4a2713aSLionel Sambuc   v2i16_b = (v2i16) {0x1234, 0x1111};
354*f4a2713aSLionel Sambuc   v2i16_r = __builtin_mips_addu_ph(v2i16_a, v2i16_b);
355*f4a2713aSLionel Sambuc // CHECK: call <2 x i16> @llvm.mips.addu.ph
356*f4a2713aSLionel Sambuc   v2i16_a = (v2i16) {0xffff, 0x2468};
357*f4a2713aSLionel Sambuc   v2i16_b = (v2i16) {0x1234, 0x1111};
358*f4a2713aSLionel Sambuc   v2i16_r = __builtin_mips_addu_s_ph(v2i16_a, v2i16_b);
359*f4a2713aSLionel Sambuc // CHECK: call <2 x i16> @llvm.mips.addu.s.ph
360*f4a2713aSLionel Sambuc   v4i8_a = (v4i8) {0x11, 0x22, 0x33, 0xff};
361*f4a2713aSLionel Sambuc   v4i8_b = (v4i8) {0x11, 0x33, 0x99, 0xff};
362*f4a2713aSLionel Sambuc   v4i8_r = __builtin_mips_adduh_qb(v4i8_a, v4i8_b);
363*f4a2713aSLionel Sambuc // CHECK: call <4 x i8> @llvm.mips.adduh.qb
364*f4a2713aSLionel Sambuc   v4i8_a = (v4i8) {0x11, 0x22, 0x33, 0xff};
365*f4a2713aSLionel Sambuc   v4i8_b = (v4i8) {0x11, 0x33, 0x99, 0xff};
366*f4a2713aSLionel Sambuc   v4i8_r = __builtin_mips_adduh_r_qb(v4i8_a, v4i8_b);
367*f4a2713aSLionel Sambuc // CHECK: call <4 x i8> @llvm.mips.adduh.r.qb
368*f4a2713aSLionel Sambuc 
369*f4a2713aSLionel Sambuc   i32_a = 0x12345678;
370*f4a2713aSLionel Sambuc   i32_b = 0x87654321;
371*f4a2713aSLionel Sambuc   i32_r = __builtin_mips_append(i32_a, i32_b, 16);
372*f4a2713aSLionel Sambuc // CHECK: call i32 @llvm.mips.append
373*f4a2713aSLionel Sambuc   i32_a = 0x12345678;
374*f4a2713aSLionel Sambuc   i32_b = 0x87654321;
375*f4a2713aSLionel Sambuc   i32_r = __builtin_mips_balign(i32_a, i32_b, 3);
376*f4a2713aSLionel Sambuc // CHECK: call i32 @llvm.mips.balign
377*f4a2713aSLionel Sambuc 
378*f4a2713aSLionel Sambuc   v4i8_a = (v4i8) {0x11, 0x22, 0x33, 0x44};
379*f4a2713aSLionel Sambuc   v4i8_b = (v4i8) {0x11, 0x33, 0x33, 0x44};
380*f4a2713aSLionel Sambuc   i32_r = __builtin_mips_cmpgdu_eq_qb(v4i8_a, v4i8_b);
381*f4a2713aSLionel Sambuc // CHECK: call i32 @llvm.mips.cmpgdu.eq.qb
382*f4a2713aSLionel Sambuc   v4i8_a = (v4i8) {0x11, 0x22, 0x33, 0x44};
383*f4a2713aSLionel Sambuc   v4i8_b = (v4i8) {0x11, 0x33, 0x33, 0x44};
384*f4a2713aSLionel Sambuc   i32_r = __builtin_mips_cmpgdu_lt_qb(v4i8_a, v4i8_b);
385*f4a2713aSLionel Sambuc // CHECK: call i32 @llvm.mips.cmpgdu.lt.qb
386*f4a2713aSLionel Sambuc   v4i8_a = (v4i8) {0x11, 0x22, 0x33, 0x54};
387*f4a2713aSLionel Sambuc   v4i8_b = (v4i8) {0x11, 0x33, 0x33, 0x44};
388*f4a2713aSLionel Sambuc   i32_r = __builtin_mips_cmpgdu_le_qb(v4i8_a, v4i8_b);
389*f4a2713aSLionel Sambuc // CHECK: call i32 @llvm.mips.cmpgdu.le.qb
390*f4a2713aSLionel Sambuc 
391*f4a2713aSLionel Sambuc   a64_a = 0x12345678;
392*f4a2713aSLionel Sambuc   v2i16_b = (v2i16) {0xffff, 0x1555};
393*f4a2713aSLionel Sambuc   v2i16_c = (v2i16) {0x1234, 0x3322};
394*f4a2713aSLionel Sambuc   a64_r = __builtin_mips_dpa_w_ph(a64_a, v2i16_b, v2i16_c);
395*f4a2713aSLionel Sambuc // CHECK: call i64 @llvm.mips.dpa.w.ph
396*f4a2713aSLionel Sambuc   a64_a = 0x12345678;
397*f4a2713aSLionel Sambuc   v2i16_b = (v2i16) {0xffff, 0x1555};
398*f4a2713aSLionel Sambuc   v2i16_c = (v2i16) {0x1234, 0x3322};
399*f4a2713aSLionel Sambuc   a64_r = __builtin_mips_dps_w_ph(a64_a, v2i16_b, v2i16_c);
400*f4a2713aSLionel Sambuc // CHECK: call i64 @llvm.mips.dps.w.ph
401*f4a2713aSLionel Sambuc 
402*f4a2713aSLionel Sambuc   a64_a = 0x70000000;
403*f4a2713aSLionel Sambuc   v2q15_b = (v2q15) {0x4000, 0x2000};
404*f4a2713aSLionel Sambuc   v2q15_c = (v2q15) {0x2000, 0x4000};
405*f4a2713aSLionel Sambuc   a64_r = __builtin_mips_dpaqx_s_w_ph(a64_a, v2q15_b, v2q15_c);
406*f4a2713aSLionel Sambuc // CHECK: call i64 @llvm.mips.dpaqx.s.w.ph
407*f4a2713aSLionel Sambuc   a64_a = 0x70000000;
408*f4a2713aSLionel Sambuc   v2q15_b = (v2q15) {0x4000, 0x2000};
409*f4a2713aSLionel Sambuc   v2q15_c = (v2q15) {0x2000, 0x4000};
410*f4a2713aSLionel Sambuc   a64_r = __builtin_mips_dpaqx_sa_w_ph(a64_a, v2q15_b, v2q15_c);
411*f4a2713aSLionel Sambuc // CHECK: call i64 @llvm.mips.dpaqx.sa.w.ph
412*f4a2713aSLionel Sambuc   a64_a = 0x1111222212345678LL;
413*f4a2713aSLionel Sambuc   v2i16_b = (v2i16) {0x1, 0x2};
414*f4a2713aSLionel Sambuc   v2i16_c = (v2i16) {0x3, 0x4};
415*f4a2713aSLionel Sambuc   a64_r = __builtin_mips_dpax_w_ph(a64_a, v2i16_b, v2i16_c);
416*f4a2713aSLionel Sambuc // CHECK: call i64 @llvm.mips.dpax.w.ph
417*f4a2713aSLionel Sambuc   a64_a = 0x9999111112345678LL;
418*f4a2713aSLionel Sambuc   v2i16_b = (v2i16) {0x1, 0x2};
419*f4a2713aSLionel Sambuc   v2i16_c = (v2i16) {0x3, 0x4};
420*f4a2713aSLionel Sambuc   a64_r = __builtin_mips_dpsx_w_ph(a64_a, v2i16_b, v2i16_c);
421*f4a2713aSLionel Sambuc // CHECK: call i64 @llvm.mips.dpsx.w.ph
422*f4a2713aSLionel Sambuc   a64_a = 0x70000000;
423*f4a2713aSLionel Sambuc   v2q15_b = (v2q15) {0x4000, 0x2000};
424*f4a2713aSLionel Sambuc   v2q15_c = (v2q15) {0x2000, 0x4000};
425*f4a2713aSLionel Sambuc   a64_r = __builtin_mips_dpsqx_s_w_ph(a64_a, v2q15_b, v2q15_c);
426*f4a2713aSLionel Sambuc // CHECK: call i64 @llvm.mips.dpsqx.s.w.ph
427*f4a2713aSLionel Sambuc   a64_a = 0xFFFFFFFF80000000LL;
428*f4a2713aSLionel Sambuc   v2q15_b = (v2q15) {0x4000, 0x2000};
429*f4a2713aSLionel Sambuc   v2q15_c = (v2q15) {0x2000, 0x4000};
430*f4a2713aSLionel Sambuc   a64_r = __builtin_mips_dpsqx_sa_w_ph(a64_a, v2q15_b, v2q15_c);
431*f4a2713aSLionel Sambuc // CHECK: call i64 @llvm.mips.dpsqx.sa.w.ph
432*f4a2713aSLionel Sambuc 
433*f4a2713aSLionel Sambuc   v2i16_a = (v2i16) {0xffff, 0x2468};
434*f4a2713aSLionel Sambuc   v2i16_b = (v2i16) {0x1234, 0x1111};
435*f4a2713aSLionel Sambuc   v2i16_r = __builtin_mips_mul_ph(v2i16_a, v2i16_b);
436*f4a2713aSLionel Sambuc // CHECK: call <2 x i16> @llvm.mips.mul.ph
437*f4a2713aSLionel Sambuc   v2i16_a = (v2i16) {0x8000, 0x7fff};
438*f4a2713aSLionel Sambuc   v2i16_b = (v2i16) {0x1234, 0x1111};
439*f4a2713aSLionel Sambuc   v2i16_r = __builtin_mips_mul_s_ph(v2i16_a, v2i16_b);
440*f4a2713aSLionel Sambuc // CHECK: call <2 x i16> @llvm.mips.mul.s.ph
441*f4a2713aSLionel Sambuc 
442*f4a2713aSLionel Sambuc   q31_a = 0x80000000;
443*f4a2713aSLionel Sambuc   q31_b = 0x80000000;
444*f4a2713aSLionel Sambuc   q31_r = __builtin_mips_mulq_rs_w(q31_a, q31_b);
445*f4a2713aSLionel Sambuc // CHECK: call i32 @llvm.mips.mulq.rs.w
446*f4a2713aSLionel Sambuc   v2q15_a = (v2q15) {0xffff, 0x8000};
447*f4a2713aSLionel Sambuc   v2q15_b = (v2q15) {0x1111, 0x8000};
448*f4a2713aSLionel Sambuc   v2q15_r = __builtin_mips_mulq_s_ph(v2q15_a, v2q15_b);
449*f4a2713aSLionel Sambuc // CHECK: call <2 x i16> @llvm.mips.mulq.s.ph
450*f4a2713aSLionel Sambuc   q31_a = 0x00000002;
451*f4a2713aSLionel Sambuc   q31_b = 0x80000000;
452*f4a2713aSLionel Sambuc   q31_r = __builtin_mips_mulq_s_w(q31_a, q31_b);
453*f4a2713aSLionel Sambuc // CHECK: call i32 @llvm.mips.mulq.s.w
454*f4a2713aSLionel Sambuc   a64_a = 0x19848419;
455*f4a2713aSLionel Sambuc   v2i16_b = (v2i16) {0xffff, 0x8000};
456*f4a2713aSLionel Sambuc   v2i16_c = (v2i16) {0x1111, 0x8000};
457*f4a2713aSLionel Sambuc   a64_r = __builtin_mips_mulsa_w_ph(a64_a, v2i16_b, v2i16_c);
458*f4a2713aSLionel Sambuc // CHECK: call i64 @llvm.mips.mulsa.w.ph
459*f4a2713aSLionel Sambuc 
460*f4a2713aSLionel Sambuc   v2i16_a = (v2i16) {0x1234, 0x5678};
461*f4a2713aSLionel Sambuc   v2i16_b = (v2i16) {0x2233, 0x5566};
462*f4a2713aSLionel Sambuc   v4i8_r = __builtin_mips_precr_qb_ph(v2i16_a, v2i16_b);
463*f4a2713aSLionel Sambuc // CHECK: call <4 x i8> @llvm.mips.precr.qb.ph
464*f4a2713aSLionel Sambuc   i32_a = 0x12345678;
465*f4a2713aSLionel Sambuc   i32_b = 0x33334444;
466*f4a2713aSLionel Sambuc   v2i16_r = __builtin_mips_precr_sra_ph_w(i32_a, i32_b, 4);
467*f4a2713aSLionel Sambuc // CHECK: call <2 x i16> @llvm.mips.precr.sra.ph.w
468*f4a2713aSLionel Sambuc   i32_a = 0x12345678;
469*f4a2713aSLionel Sambuc   i32_b = 0x33334444;
470*f4a2713aSLionel Sambuc   v2i16_r = __builtin_mips_precr_sra_r_ph_w(i32_a, i32_b, 4);
471*f4a2713aSLionel Sambuc // CHECK: call <2 x i16> @llvm.mips.precr.sra.r.ph.w
472*f4a2713aSLionel Sambuc 
473*f4a2713aSLionel Sambuc   i32_a = 0x12345678;
474*f4a2713aSLionel Sambuc   i32_b = 0x87654321;
475*f4a2713aSLionel Sambuc   i32_r = __builtin_mips_prepend(i32_a, i32_b, 16);
476*f4a2713aSLionel Sambuc // CHECK: call i32 @llvm.mips.prepend
477*f4a2713aSLionel Sambuc 
478*f4a2713aSLionel Sambuc   v4i8_a = (v4i8) {0x12, 0x45, 0x77, 0x99};
479*f4a2713aSLionel Sambuc   v4i8_r = __builtin_mips_shra_qb(v4i8_a, 1);
480*f4a2713aSLionel Sambuc // CHECK: call <4 x i8> @llvm.mips.shra.qb
481*f4a2713aSLionel Sambuc   v4i8_a = (v4i8) {0x12, 0x45, 0x77, 0x99};
482*f4a2713aSLionel Sambuc   i32_b = 1;
483*f4a2713aSLionel Sambuc   v4i8_r = __builtin_mips_shra_qb(v4i8_a, i32_b);
484*f4a2713aSLionel Sambuc // CHECK: call <4 x i8> @llvm.mips.shra.qb
485*f4a2713aSLionel Sambuc   v4i8_a = (v4i8) {0x12, 0x45, 0x77, 0x99};
486*f4a2713aSLionel Sambuc   v4i8_r = __builtin_mips_shra_r_qb(v4i8_a, 1);
487*f4a2713aSLionel Sambuc // CHECK: call <4 x i8> @llvm.mips.shra.r.qb
488*f4a2713aSLionel Sambuc   v4i8_a = (v4i8) {0x12, 0x45, 0x77, 0x99};
489*f4a2713aSLionel Sambuc   i32_b = 1;
490*f4a2713aSLionel Sambuc   v4i8_r = __builtin_mips_shra_r_qb(v4i8_a, i32_b);
491*f4a2713aSLionel Sambuc // CHECK: call <4 x i8> @llvm.mips.shra.r.qb
492*f4a2713aSLionel Sambuc   v2i16_a = (v2i16) {0x1357, 0x2468};
493*f4a2713aSLionel Sambuc   v2i16_r = __builtin_mips_shrl_ph(v2i16_a, 4);
494*f4a2713aSLionel Sambuc // CHECK: call <2 x i16> @llvm.mips.shrl.ph
495*f4a2713aSLionel Sambuc   v2i16_a = (v2i16) {0x1357, 0x2468};
496*f4a2713aSLionel Sambuc   i32_b = 8;
497*f4a2713aSLionel Sambuc   v2i16_r = __builtin_mips_shrl_ph (v2i16_a, i32_b);
498*f4a2713aSLionel Sambuc // CHECK: call <2 x i16> @llvm.mips.shrl.ph
499*f4a2713aSLionel Sambuc 
500*f4a2713aSLionel Sambuc   v2q15_a = (v2q15) {0x3334, 0x4444};
501*f4a2713aSLionel Sambuc   v2q15_b = (v2q15) {0x1111, 0x2222};
502*f4a2713aSLionel Sambuc   v2q15_r = __builtin_mips_subqh_ph(v2q15_a, v2q15_b);
503*f4a2713aSLionel Sambuc // CHECK: call <2 x i16> @llvm.mips.subqh.ph
504*f4a2713aSLionel Sambuc   v2q15_a = (v2q15) {0x3334, 0x4444};
505*f4a2713aSLionel Sambuc   v2q15_b = (v2q15) {0x1111, 0x2222};
506*f4a2713aSLionel Sambuc   v2q15_r = __builtin_mips_subqh_r_ph(v2q15_a, v2q15_b);
507*f4a2713aSLionel Sambuc // CHECK: call <2 x i16> @llvm.mips.subqh.r.ph
508*f4a2713aSLionel Sambuc   q31_a = 0x11111112;
509*f4a2713aSLionel Sambuc   q31_b = 0x99999999;
510*f4a2713aSLionel Sambuc   q31_r = __builtin_mips_subqh_w(q31_a, q31_b);
511*f4a2713aSLionel Sambuc // CHECK: call i32 @llvm.mips.subqh.w
512*f4a2713aSLionel Sambuc   q31_a = 0x11111112;
513*f4a2713aSLionel Sambuc   q31_b = 0x99999999;
514*f4a2713aSLionel Sambuc   q31_r = __builtin_mips_subqh_r_w(q31_a, q31_b);
515*f4a2713aSLionel Sambuc // CHECK: call i32 @llvm.mips.subqh.r.w
516*f4a2713aSLionel Sambuc 
517*f4a2713aSLionel Sambuc   v2i16_a = (v2i16) {0x1357, 0x4455};
518*f4a2713aSLionel Sambuc   v2i16_b = (v2i16) {0x3333, 0x4444};
519*f4a2713aSLionel Sambuc   v2i16_r = __builtin_mips_subu_ph(v2i16_a, v2i16_b);
520*f4a2713aSLionel Sambuc // CHECK: call <2 x i16> @llvm.mips.subu.ph
521*f4a2713aSLionel Sambuc   v2i16_a = (v2i16) {0x1357, 0x4455};
522*f4a2713aSLionel Sambuc   v2i16_b = (v2i16) {0x3333, 0x4444};
523*f4a2713aSLionel Sambuc   v2i16_r = __builtin_mips_subu_s_ph(v2i16_a, v2i16_b);
524*f4a2713aSLionel Sambuc // CHECK: call <2 x i16> @llvm.mips.subu.s.ph
525*f4a2713aSLionel Sambuc 
526*f4a2713aSLionel Sambuc   v4i8_a = (v4i8) {0x33 ,0x44, 0x55, 0x66};
527*f4a2713aSLionel Sambuc   v4i8_b = (v4i8) {0x99 ,0x15, 0x85, 0xff};
528*f4a2713aSLionel Sambuc   v4i8_r = __builtin_mips_subuh_qb(v4i8_a, v4i8_b);
529*f4a2713aSLionel Sambuc // CHECK: call <4 x i8> @llvm.mips.subuh.qb
530*f4a2713aSLionel Sambuc   v4i8_a = (v4i8) {0x33 ,0x44, 0x55, 0x66};
531*f4a2713aSLionel Sambuc   v4i8_b = (v4i8) {0x99 ,0x15, 0x85, 0xff};
532*f4a2713aSLionel Sambuc   v4i8_r = __builtin_mips_subuh_r_qb(v4i8_a, v4i8_b);
533*f4a2713aSLionel Sambuc // CHECK: call <4 x i8> @llvm.mips.subuh.r.qb
534*f4a2713aSLionel Sambuc }
535*f4a2713aSLionel Sambuc 
test_eh_return_data_regno()536*f4a2713aSLionel Sambuc void test_eh_return_data_regno()
537*f4a2713aSLionel Sambuc {
538*f4a2713aSLionel Sambuc   volatile int res;
539*f4a2713aSLionel Sambuc   res = __builtin_eh_return_data_regno(0);  // CHECK: store volatile i32 4
540*f4a2713aSLionel Sambuc   res = __builtin_eh_return_data_regno(1);  // CHECK: store volatile i32 5
541*f4a2713aSLionel Sambuc }
542