blob: 4c499e44e4f04cf24f57ee906e21a6e2e6d8d74b [file] [log] [blame]
Bill Schmidt87982a12014-10-19 20:48:47 +00001; FIXME: FastISel currently returns false if it hits code that uses VSX
Mehdi Amini945a6602015-02-27 18:32:11 +00002; registers and with -fast-isel-abort=1 turned on the test case will then fail.
Bill Schmidt87982a12014-10-19 20:48:47 +00003; When fastisel better supports VSX fix up this test case.
4;
Mehdi Amini945a6602015-02-27 18:32:11 +00005; RUN: llc < %s -O0 -verify-machineinstrs -fast-isel-abort=1 -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 -mattr=-vsx | FileCheck %s --check-prefix=ELF64
Bill Schmidtd89f6782013-08-26 19:42:51 +00006
Eric Christopher1fb23392015-07-24 01:07:50 +00007define zeroext i1 @rettrue() nounwind {
Samuel Antao61570df2014-09-17 23:25:06 +00008entry:
9; ELF64-LABEL: rettrue
10; ELF64: li 3, 1
11; ELF64: blr
12 ret i1 true
13}
14
Eric Christopher1fb23392015-07-24 01:07:50 +000015define zeroext i1 @retfalse() nounwind {
Samuel Antao61570df2014-09-17 23:25:06 +000016entry:
17; ELF64-LABEL: retfalse
18; ELF64: li 3, 0
19; ELF64: blr
20 ret i1 false
21}
22
Eric Christopher1fb23392015-07-24 01:07:50 +000023define signext i1 @retstrue() nounwind {
Samuel Antao61570df2014-09-17 23:25:06 +000024entry:
25; ELF64-LABEL: retstrue
26; ELF64: li 3, -1
27; ELF64: blr
28 ret i1 true
29}
30
Eric Christopher1fb23392015-07-24 01:07:50 +000031define signext i1 @retsfalse() nounwind {
Samuel Antao61570df2014-09-17 23:25:06 +000032entry:
33; ELF64-LABEL: retsfalse
34; ELF64: li 3, 0
35; ELF64: blr
36 ret i1 false
37}
38
Eric Christopher1fb23392015-07-24 01:07:50 +000039define signext i8 @ret2(i8 signext %a) nounwind {
Bill Schmidtd89f6782013-08-26 19:42:51 +000040entry:
Samuel Antao61570df2014-09-17 23:25:06 +000041; ELF64-LABEL: ret2
Bill Schmidtd89f6782013-08-26 19:42:51 +000042; ELF64: extsb
43; ELF64: blr
44 ret i8 %a
45}
46
Eric Christopher1fb23392015-07-24 01:07:50 +000047define zeroext i8 @ret3(i8 signext %a) nounwind {
Bill Schmidtd89f6782013-08-26 19:42:51 +000048entry:
Samuel Antao61570df2014-09-17 23:25:06 +000049; ELF64-LABEL: ret3
Nemanja Ivanovicc4980792017-09-23 09:50:12 +000050; ELF64: clrldi {{[0-9]+}}, {{[0-9]+}}, 56
Bill Schmidtd89f6782013-08-26 19:42:51 +000051; ELF64: blr
52 ret i8 %a
53}
54
Eric Christopher1fb23392015-07-24 01:07:50 +000055define signext i16 @ret4(i16 signext %a) nounwind {
Bill Schmidtd89f6782013-08-26 19:42:51 +000056entry:
Samuel Antao61570df2014-09-17 23:25:06 +000057; ELF64-LABEL: ret4
Bill Schmidtd89f6782013-08-26 19:42:51 +000058; ELF64: extsh
59; ELF64: blr
60 ret i16 %a
61}
62
Eric Christopher1fb23392015-07-24 01:07:50 +000063define zeroext i16 @ret5(i16 signext %a) nounwind {
Bill Schmidtd89f6782013-08-26 19:42:51 +000064entry:
Samuel Antao61570df2014-09-17 23:25:06 +000065; ELF64-LABEL: ret5
Nemanja Ivanovicc4980792017-09-23 09:50:12 +000066; ELF64: clrldi {{[0-9]+}}, {{[0-9]+}}, 48
Bill Schmidtd89f6782013-08-26 19:42:51 +000067; ELF64: blr
68 ret i16 %a
69}
70
Eric Christopher1fb23392015-07-24 01:07:50 +000071define i16 @ret6(i16 %a) nounwind {
Bill Schmidtd89f6782013-08-26 19:42:51 +000072entry:
Samuel Antao61570df2014-09-17 23:25:06 +000073; ELF64-LABEL: ret6
Nemanja Ivanovicc4980792017-09-23 09:50:12 +000074; ELF64: clrldi {{[0-9]+}}, {{[0-9]+}}, 48
Bill Schmidtd89f6782013-08-26 19:42:51 +000075; ELF64: blr
76 ret i16 %a
77}
78
Eric Christopher1fb23392015-07-24 01:07:50 +000079define signext i32 @ret7(i32 signext %a) nounwind {
Bill Schmidtd89f6782013-08-26 19:42:51 +000080entry:
Samuel Antao61570df2014-09-17 23:25:06 +000081; ELF64-LABEL: ret7
Bill Schmidtd89f6782013-08-26 19:42:51 +000082; ELF64: extsw
83; ELF64: blr
84 ret i32 %a
85}
86
Eric Christopher1fb23392015-07-24 01:07:50 +000087define zeroext i32 @ret8(i32 signext %a) nounwind {
Bill Schmidtd89f6782013-08-26 19:42:51 +000088entry:
Samuel Antao61570df2014-09-17 23:25:06 +000089; ELF64-LABEL: ret8
Nemanja Ivanovicc4980792017-09-23 09:50:12 +000090; ELF64: clrldi {{[0-9]+}}, {{[0-9]+}}, 32
Bill Schmidtd89f6782013-08-26 19:42:51 +000091; ELF64: blr
92 ret i32 %a
93}
94
Eric Christopher1fb23392015-07-24 01:07:50 +000095define i32 @ret9(i32 %a) nounwind {
Bill Schmidtd89f6782013-08-26 19:42:51 +000096entry:
Samuel Antao61570df2014-09-17 23:25:06 +000097; ELF64-LABEL: ret9
Nemanja Ivanovicc4980792017-09-23 09:50:12 +000098; ELF64: clrldi {{[0-9]+}}, {{[0-9]+}}, 32
Bill Schmidtd89f6782013-08-26 19:42:51 +000099; ELF64: blr
100 ret i32 %a
101}
102
Eric Christopher1fb23392015-07-24 01:07:50 +0000103define i64 @ret10(i64 %a) nounwind {
Bill Schmidtd89f6782013-08-26 19:42:51 +0000104entry:
Samuel Antao61570df2014-09-17 23:25:06 +0000105; ELF64-LABEL: ret10
Bill Schmidtd89f6782013-08-26 19:42:51 +0000106; ELF64-NOT: exts
Nemanja Ivanovicc4980792017-09-23 09:50:12 +0000107; ELF64-NOT: clrldi
Bill Schmidtd89f6782013-08-26 19:42:51 +0000108; ELF64-NOT: rldicl
109; ELF64: blr
110 ret i64 %a
111}
112
Eric Christopher1fb23392015-07-24 01:07:50 +0000113define float @ret11(float %a) nounwind {
Bill Schmidtd89f6782013-08-26 19:42:51 +0000114entry:
Samuel Antao61570df2014-09-17 23:25:06 +0000115; ELF64-LABEL: ret11
Bill Schmidtd89f6782013-08-26 19:42:51 +0000116; ELF64: blr
117 ret float %a
118}
119
Eric Christopher1fb23392015-07-24 01:07:50 +0000120define double @ret12(double %a) nounwind {
Bill Schmidtd89f6782013-08-26 19:42:51 +0000121entry:
Samuel Antao61570df2014-09-17 23:25:06 +0000122; ELF64-LABEL: ret12
Bill Schmidtd89f6782013-08-26 19:42:51 +0000123; ELF64: blr
124 ret double %a
125}
126
Eric Christopher1fb23392015-07-24 01:07:50 +0000127define i8 @ret13() nounwind {
Bill Schmidtd89f6782013-08-26 19:42:51 +0000128entry:
Samuel Antao61570df2014-09-17 23:25:06 +0000129; ELF64-LABEL: ret13
Bill Schmidtd89f6782013-08-26 19:42:51 +0000130; ELF64: li
131; ELF64: blr
132 ret i8 15;
133}
134
Eric Christopher1fb23392015-07-24 01:07:50 +0000135define i16 @ret14() nounwind {
Bill Schmidtd89f6782013-08-26 19:42:51 +0000136entry:
Samuel Antao61570df2014-09-17 23:25:06 +0000137; ELF64-LABEL: ret14
Bill Schmidtd89f6782013-08-26 19:42:51 +0000138; ELF64: li
139; ELF64: blr
140 ret i16 -225;
141}
142
Eric Christopher1fb23392015-07-24 01:07:50 +0000143define i32 @ret15() nounwind {
Bill Schmidtd89f6782013-08-26 19:42:51 +0000144entry:
Samuel Antao61570df2014-09-17 23:25:06 +0000145; ELF64-LABEL: ret15
Bill Schmidtd89f6782013-08-26 19:42:51 +0000146; ELF64: lis
147; ELF64: ori
148; ELF64: blr
149 ret i32 278135;
150}
151
Eric Christopher1fb23392015-07-24 01:07:50 +0000152define i64 @ret16() nounwind {
Bill Schmidtd89f6782013-08-26 19:42:51 +0000153entry:
Samuel Antao61570df2014-09-17 23:25:06 +0000154; ELF64-LABEL: ret16
Bill Schmidtd89f6782013-08-26 19:42:51 +0000155; ELF64: li
156; ELF64: sldi
157; ELF64: oris
158; ELF64: ori
159; ELF64: blr
160 ret i64 27813515225;
161}
162
Eric Christopher1fb23392015-07-24 01:07:50 +0000163define float @ret17() nounwind {
Bill Schmidtd89f6782013-08-26 19:42:51 +0000164entry:
Samuel Antao61570df2014-09-17 23:25:06 +0000165; ELF64-LABEL: ret17
Bill Schmidtd89f6782013-08-26 19:42:51 +0000166; ELF64: addis
167; ELF64: lfs
168; ELF64: blr
169 ret float 2.5;
170}
171
Eric Christopher1fb23392015-07-24 01:07:50 +0000172define double @ret18() nounwind {
Bill Schmidtd89f6782013-08-26 19:42:51 +0000173entry:
Samuel Antao61570df2014-09-17 23:25:06 +0000174; ELF64-LABEL: ret18
Bill Schmidtd89f6782013-08-26 19:42:51 +0000175; ELF64: addis
176; ELF64: lfd
177; ELF64: blr
178 ret double 2.5e-33;
179}
Eric Christopherf0024d12015-07-25 00:48:08 +0000180
181define zeroext i32 @ret19() nounwind {
182entry:
183; ELF64-LABEL: ret19
184; ELF64: li
185; ELF64: oris
186; ELF64: ori
187; ELF64: blr
188 ret i32 -1
189}
Eric Christopher5a2429e2016-01-29 07:20:01 +0000190
191define zeroext i16 @ret20() nounwind {
192entry:
193; ELF64-LABEL: ret20
194; ELF64: lis{{.*}}0
195; ELF64: ori{{.*}}32768
196; ELF64: blr
197 ret i16 32768
198}