blob: 30f7134722aaa6d69e2b2c0d8a22a26fca317014 [file] [log] [blame]
Venkatraman Govindarajue105a392011-01-22 11:36:24 +00001; RUN: llc -march=sparc <%s | FileCheck %s -check-prefix=V8
2; RUN: llc -march=sparc -mattr=v9 <%s | FileCheck %s -check-prefix=V9
Venkatraman Govindarajuf27df332011-01-11 22:38:28 +00003
4
5define i32 @test_addx(i64 %a, i64 %b, i64 %c) nounwind readnone noinline {
6entry:
Venkatraman Govindarajue105a392011-01-22 11:36:24 +00007; V8: addcc
8; V8-NOT: subcc
9; V8: addx
10; V9: addcc
11; V9-NOT: subcc
12; V9: addx
13; V9: mov{{e|ne}} %icc
Venkatraman Govindarajuf27df332011-01-11 22:38:28 +000014 %0 = add i64 %a, %b
15 %1 = icmp ugt i64 %0, %c
16 %2 = zext i1 %1 to i32
17 ret i32 %2
18}
19
20
21define i32 @test_select_int_icc(i32 %a, i32 %b, i32 %c) nounwind readnone noinline {
22entry:
Venkatraman Govindarajue105a392011-01-22 11:36:24 +000023; V8: test_select_int_icc
Venkatraman Govindaraju01021a82013-06-07 00:03:36 +000024; V8: cmp
Venkatraman Govindarajue105a392011-01-22 11:36:24 +000025; V8: {{be|bne}}
26; V9: test_select_int_icc
Venkatraman Govindaraju01021a82013-06-07 00:03:36 +000027; V9: cmp
Venkatraman Govindarajue105a392011-01-22 11:36:24 +000028; V9-NOT: {{be|bne}}
29; V9: mov{{e|ne}} %icc
Venkatraman Govindarajuf27df332011-01-11 22:38:28 +000030 %0 = icmp eq i32 %a, 0
31 %1 = select i1 %0, i32 %b, i32 %c
32 ret i32 %1
33}
34
35
36define float @test_select_fp_icc(i32 %a, float %f1, float %f2) nounwind readnone noinline {
37entry:
Venkatraman Govindarajue105a392011-01-22 11:36:24 +000038; V8: test_select_fp_icc
Venkatraman Govindaraju01021a82013-06-07 00:03:36 +000039; V8: cmp
Venkatraman Govindarajue105a392011-01-22 11:36:24 +000040; V8: {{be|bne}}
41; V9: test_select_fp_icc
Venkatraman Govindaraju01021a82013-06-07 00:03:36 +000042; V9: cmp
Venkatraman Govindarajue105a392011-01-22 11:36:24 +000043; V9-NOT: {{be|bne}}
44; V9: fmovs{{e|ne}} %icc
Venkatraman Govindarajuf27df332011-01-11 22:38:28 +000045 %0 = icmp eq i32 %a, 0
46 %1 = select i1 %0, float %f1, float %f2
47 ret float %1
48}
49
50define double @test_select_dfp_icc(i32 %a, double %f1, double %f2) nounwind readnone noinline {
51entry:
Venkatraman Govindarajue105a392011-01-22 11:36:24 +000052; V8: test_select_dfp_icc
Venkatraman Govindaraju01021a82013-06-07 00:03:36 +000053; V8: cmp
Venkatraman Govindarajue105a392011-01-22 11:36:24 +000054; V8: {{be|bne}}
55; V9: test_select_dfp_icc
Venkatraman Govindaraju01021a82013-06-07 00:03:36 +000056; V9: cmp
Benjamin Kramerfba80d92012-10-02 15:49:34 +000057; V9-NOT: {{be|bne}}
Venkatraman Govindarajue105a392011-01-22 11:36:24 +000058; V9: fmovd{{e|ne}} %icc
Venkatraman Govindarajuf27df332011-01-11 22:38:28 +000059 %0 = icmp eq i32 %a, 0
60 %1 = select i1 %0, double %f1, double %f2
61 ret double %1
62}
63
64define i32 @test_select_int_fcc(float %f, i32 %a, i32 %b) nounwind readnone noinline {
65entry:
Stephen Lincf2ab762013-07-18 22:47:09 +000066;V8-LABEL: test_select_int_fcc:
Venkatraman Govindarajue105a392011-01-22 11:36:24 +000067;V8: fcmps
68;V8: {{fbe|fbne}}
Stephen Lincf2ab762013-07-18 22:47:09 +000069;V9-LABEL: test_select_int_fcc:
Venkatraman Govindarajue105a392011-01-22 11:36:24 +000070;V9: fcmps
71;V9-NOT: {{fbe|fbne}}
72;V9: mov{{e|ne}} %fcc0
Venkatraman Govindarajuf27df332011-01-11 22:38:28 +000073 %0 = fcmp une float %f, 0.000000e+00
74 %a.b = select i1 %0, i32 %a, i32 %b
75 ret i32 %a.b
76}
77
78
79define float @test_select_fp_fcc(float %f, float %f1, float %f2) nounwind readnone noinline {
80entry:
Stephen Lincf2ab762013-07-18 22:47:09 +000081;V8-LABEL: test_select_fp_fcc:
Venkatraman Govindarajue105a392011-01-22 11:36:24 +000082;V8: fcmps
83;V8: {{fbe|fbne}}
Stephen Lincf2ab762013-07-18 22:47:09 +000084;V9-LABEL: test_select_fp_fcc:
Venkatraman Govindarajue105a392011-01-22 11:36:24 +000085;V9: fcmps
86;V9-NOT: {{fbe|fbne}}
87;V9: fmovs{{e|ne}} %fcc0
Venkatraman Govindarajuf27df332011-01-11 22:38:28 +000088 %0 = fcmp une float %f, 0.000000e+00
89 %1 = select i1 %0, float %f1, float %f2
90 ret float %1
91}
92
93define double @test_select_dfp_fcc(double %f, double %f1, double %f2) nounwind readnone noinline {
94entry:
Stephen Lincf2ab762013-07-18 22:47:09 +000095;V8-LABEL: test_select_dfp_fcc:
Venkatraman Govindarajue105a392011-01-22 11:36:24 +000096;V8: fcmpd
97;V8: {{fbne|fbe}}
Stephen Lincf2ab762013-07-18 22:47:09 +000098;V9-LABEL: test_select_dfp_fcc:
Venkatraman Govindarajue105a392011-01-22 11:36:24 +000099;V9: fcmpd
100;V9-NOT: {{fbne|fbe}}
101;V9: fmovd{{e|ne}} %fcc0
Venkatraman Govindarajuf27df332011-01-11 22:38:28 +0000102 %0 = fcmp une double %f, 0.000000e+00
103 %1 = select i1 %0, double %f1, double %f2
104 ret double %1
105}
Venkatraman Govindaraju1c9524b2013-10-04 23:54:30 +0000106
107define i32 @test_float_cc(double %a, double %b, i32 %c, i32 %d) {
108entry:
109; V8-LABEL: test_float_cc
110; V8: fcmpd
111; V8: {{fbl|fbuge}} .LBB
112; V8: fcmpd
113; V8: {{fbule|fbg}} .LBB
114
115; V9-LABEL: test_float_cc
116; V9: fcmpd
117; V9: {{fbl|fbuge}} .LBB
118; V9: fcmpd
119; V9: {{fbule|fbg}} .LBB
120
121 %0 = fcmp uge double %a, 0.000000e+00
122 br i1 %0, label %loop, label %loop.2
123
124loop:
125 %1 = icmp eq i32 %c, 10
126 br i1 %1, label %loop, label %exit.0
127
128loop.2:
129 %2 = fcmp ogt double %b, 0.000000e+00
130 br i1 %2, label %exit.1, label %loop
131
132exit.0:
133 ret i32 0
134
135exit.1:
136 ret i32 1
137}
Venkatraman Govindarajubb0ec982013-10-06 02:11:10 +0000138
139; V8-LABEL: test_adde_sube
140; V8: addcc
141; V8: addxcc
142; V8: addxcc
143; V8: addxcc
144; V8: subcc
145; V8: subxcc
146; V8: subxcc
147; V8: subxcc
148
149
150; V9-LABEL: test_adde_sube
151; V9: addcc
152; V9: addxcc
153; V9: addxcc
154; V9: addxcc
155; V9: subcc
156; V9: subxcc
157; V9: subxcc
158; V9: subxcc
159
160
161define void @test_adde_sube(i8* %a, i8* %b, i8* %sum, i8* %diff) {
162entry:
163 %0 = bitcast i8* %a to i128*
164 %1 = bitcast i8* %b to i128*
165 %2 = load i128* %0
166 %3 = load i128* %1
167 %4 = add i128 %2, %3
168 %5 = bitcast i8* %sum to i128*
169 store i128 %4, i128* %5
170 tail call void asm sideeffect "", "=*m,*m"(i128 *%0, i128* %5) nounwind
171 %6 = load i128* %0
172 %7 = sub i128 %2, %6
173 %8 = bitcast i8* %diff to i128*
174 store i128 %7, i128* %8
175 ret void
176}