blob: 6a077d5c9fa00bb6e454b9bc58383c524ebbd079 [file] [log] [blame]
Michael Kuperstein946b3b22014-09-23 08:48:01 +00001; RUN: llvm-dis < %s.bc| FileCheck %s
Duncan P. N. Exon Smith9c296662014-07-30 17:49:00 +00002
3; miscInstructions.3.2.ll.bc was generated by passing this file to llvm-as-3.2.
4; The test checks that LLVM does not misread miscellaneous instructions of
5; older bitcode files.
6
Michael Kuperstein946b3b22014-09-23 08:48:01 +00007@X = global i8 1
8@_ZTIi = global i8* @X
9@_ZTId = global i8* @X
10
11define i32 @__gxx_personality_v0(...){
12entry:
13 ret i32 0
14}
15
16define void @landingpadInstr1(i1 %cond1, <2 x i1> %cond2, <2 x i8> %x1, <2 x i8> %x2){
17entry:
18; CHECK: %res = landingpad { i8*, i32 } personality i32 (...)* @__gxx_personality_v0
19 %res = landingpad { i8*, i32 } personality i32 (...)* @__gxx_personality_v0
20; CHECK: catch i8** @_ZTIi
21 catch i8** @_ZTIi
22 ret void
23}
24
25define void @landingpadInstr2(i1 %cond1, <2 x i1> %cond2, <2 x i8> %x1, <2 x i8> %x2){
26entry:
27; CHECK: %res = landingpad { i8*, i32 } personality i32 (...)* @__gxx_personality_v0
28 %res = landingpad { i8*, i32 } personality i32 (...)* @__gxx_personality_v0
29; CHECK: cleanup
30 cleanup
31 ret void
32}
33
34define void @landingpadInstr3(i1 %cond1, <2 x i1> %cond2, <2 x i8> %x1, <2 x i8> %x2){
35entry:
36; CHECK: %res = landingpad { i8*, i32 } personality i32 (...)* @__gxx_personality_v0
37 %res = landingpad { i8*, i32 } personality i32 (...)* @__gxx_personality_v0
38; CHECK: catch i8** @_ZTIi
39 catch i8** @_ZTIi
40; CHECK: filter [1 x i8**] [i8** @_ZTId]
41 filter [1 x i8**] [i8** @_ZTId]
42 ret void
43}
44
45define void @phiInstr(){
46LoopHeader:
47 %x = add i32 0, 0
48 br label %Loop
49Loop:
50; CHECK: %indvar = phi i32 [ 0, %LoopHeader ], [ %nextindvar, %Loop ]
51 %indvar = phi i32 [ 0, %LoopHeader ], [ %nextindvar, %Loop ]
52 %nextindvar = add i32 %indvar, 1
53 br label %Loop
54 ret void
55}
56
57define void @selectInstr(i1 %cond1, <2 x i1> %cond2, <2 x i8> %x1, <2 x i8> %x2){
58entry:
59; CHECK: %res1 = select i1 %cond1, i8 1, i8 0
60 %res1 = select i1 %cond1, i8 1, i8 0
61; CHECK-NEXT: %res2 = select <2 x i1> %cond2, <2 x i8> %x1, <2 x i8> %x2
62 %res2 = select <2 x i1> %cond2, <2 x i8> %x1, <2 x i8> %x2
63
64 ret void
65}
66
Duncan P. N. Exon Smith9c296662014-07-30 17:49:00 +000067define void @icmp(i32 %x1, i32 %x2, i32* %ptr1, i32* %ptr2, <2 x i32> %vec1, <2 x i32> %vec2){
68entry:
69; CHECK: %res1 = icmp eq i32 %x1, %x2
70 %res1 = icmp eq i32 %x1, %x2
Michael Kuperstein946b3b22014-09-23 08:48:01 +000071
Duncan P. N. Exon Smith9c296662014-07-30 17:49:00 +000072; CHECK-NEXT: %res2 = icmp ne i32 %x1, %x2
73 %res2 = icmp ne i32 %x1, %x2
Michael Kuperstein946b3b22014-09-23 08:48:01 +000074
Duncan P. N. Exon Smith9c296662014-07-30 17:49:00 +000075; CHECK-NEXT: %res3 = icmp ugt i32 %x1, %x2
76 %res3 = icmp ugt i32 %x1, %x2
Michael Kuperstein946b3b22014-09-23 08:48:01 +000077
Duncan P. N. Exon Smith9c296662014-07-30 17:49:00 +000078; CHECK-NEXT: %res4 = icmp uge i32 %x1, %x2
79 %res4 = icmp uge i32 %x1, %x2
Michael Kuperstein946b3b22014-09-23 08:48:01 +000080
Duncan P. N. Exon Smith9c296662014-07-30 17:49:00 +000081; CHECK-NEXT: %res5 = icmp ult i32 %x1, %x2
82 %res5 = icmp ult i32 %x1, %x2
Michael Kuperstein946b3b22014-09-23 08:48:01 +000083
Duncan P. N. Exon Smith9c296662014-07-30 17:49:00 +000084; CHECK-NEXT: %res6 = icmp ule i32 %x1, %x2
85 %res6 = icmp ule i32 %x1, %x2
Michael Kuperstein946b3b22014-09-23 08:48:01 +000086
Duncan P. N. Exon Smith9c296662014-07-30 17:49:00 +000087; CHECK-NEXT: %res7 = icmp sgt i32 %x1, %x2
88 %res7 = icmp sgt i32 %x1, %x2
Michael Kuperstein946b3b22014-09-23 08:48:01 +000089
Duncan P. N. Exon Smith9c296662014-07-30 17:49:00 +000090; CHECK-NEXT: %res8 = icmp sge i32 %x1, %x2
91 %res8 = icmp sge i32 %x1, %x2
Michael Kuperstein946b3b22014-09-23 08:48:01 +000092
Duncan P. N. Exon Smith9c296662014-07-30 17:49:00 +000093; CHECK-NEXT: %res9 = icmp slt i32 %x1, %x2
94 %res9 = icmp slt i32 %x1, %x2
Michael Kuperstein946b3b22014-09-23 08:48:01 +000095
Duncan P. N. Exon Smith9c296662014-07-30 17:49:00 +000096; CHECK-NEXT: %res10 = icmp sle i32 %x1, %x2
97 %res10 = icmp sle i32 %x1, %x2
Michael Kuperstein946b3b22014-09-23 08:48:01 +000098
Duncan P. N. Exon Smith9c296662014-07-30 17:49:00 +000099; CHECK-NEXT: %res11 = icmp eq i32* %ptr1, %ptr2
100 %res11 = icmp eq i32* %ptr1, %ptr2
Michael Kuperstein946b3b22014-09-23 08:48:01 +0000101
Duncan P. N. Exon Smith9c296662014-07-30 17:49:00 +0000102; CHECK-NEXT: %res12 = icmp eq <2 x i32> %vec1, %vec2
103 %res12 = icmp eq <2 x i32> %vec1, %vec2
Michael Kuperstein946b3b22014-09-23 08:48:01 +0000104
Duncan P. N. Exon Smith9c296662014-07-30 17:49:00 +0000105 ret void
106}
107
108
109define void @fcmp(float %x1, float %x2, <2 x float> %vec1, <2 x float> %vec2){
110entry:
111; CHECK: %res1 = fcmp oeq float %x1, %x2
112 %res1 = fcmp oeq float %x1, %x2
Michael Kuperstein946b3b22014-09-23 08:48:01 +0000113
Duncan P. N. Exon Smith9c296662014-07-30 17:49:00 +0000114; CHECK-NEXT: %res2 = fcmp one float %x1, %x2
115 %res2 = fcmp one float %x1, %x2
Michael Kuperstein946b3b22014-09-23 08:48:01 +0000116
Duncan P. N. Exon Smith9c296662014-07-30 17:49:00 +0000117; CHECK-NEXT: %res3 = fcmp ugt float %x1, %x2
118 %res3 = fcmp ugt float %x1, %x2
Michael Kuperstein946b3b22014-09-23 08:48:01 +0000119
Duncan P. N. Exon Smith9c296662014-07-30 17:49:00 +0000120; CHECK-NEXT: %res4 = fcmp uge float %x1, %x2
121 %res4 = fcmp uge float %x1, %x2
Michael Kuperstein946b3b22014-09-23 08:48:01 +0000122
Duncan P. N. Exon Smith9c296662014-07-30 17:49:00 +0000123; CHECK-NEXT: %res5 = fcmp ult float %x1, %x2
124 %res5 = fcmp ult float %x1, %x2
Michael Kuperstein946b3b22014-09-23 08:48:01 +0000125
Duncan P. N. Exon Smith9c296662014-07-30 17:49:00 +0000126; CHECK-NEXT: %res6 = fcmp ule float %x1, %x2
127 %res6 = fcmp ule float %x1, %x2
Michael Kuperstein946b3b22014-09-23 08:48:01 +0000128
Duncan P. N. Exon Smith9c296662014-07-30 17:49:00 +0000129; CHECK-NEXT: %res7 = fcmp ogt float %x1, %x2
130 %res7 = fcmp ogt float %x1, %x2
Michael Kuperstein946b3b22014-09-23 08:48:01 +0000131
Duncan P. N. Exon Smith9c296662014-07-30 17:49:00 +0000132; CHECK-NEXT: %res8 = fcmp oge float %x1, %x2
133 %res8 = fcmp oge float %x1, %x2
Michael Kuperstein946b3b22014-09-23 08:48:01 +0000134
Duncan P. N. Exon Smith9c296662014-07-30 17:49:00 +0000135; CHECK-NEXT: %res9 = fcmp olt float %x1, %x2
136 %res9 = fcmp olt float %x1, %x2
Michael Kuperstein946b3b22014-09-23 08:48:01 +0000137
Duncan P. N. Exon Smith9c296662014-07-30 17:49:00 +0000138; CHECK-NEXT: %res10 = fcmp ole float %x1, %x2
139 %res10 = fcmp ole float %x1, %x2
Michael Kuperstein946b3b22014-09-23 08:48:01 +0000140
Duncan P. N. Exon Smith9c296662014-07-30 17:49:00 +0000141; CHECK-NEXT: %res11 = fcmp ord float %x1, %x2
142 %res11 = fcmp ord float %x1, %x2
Michael Kuperstein946b3b22014-09-23 08:48:01 +0000143
Duncan P. N. Exon Smith9c296662014-07-30 17:49:00 +0000144; CHECK-NEXT: %res12 = fcmp ueq float %x1, %x2
145 %res12 = fcmp ueq float %x1, %x2
Michael Kuperstein946b3b22014-09-23 08:48:01 +0000146
Duncan P. N. Exon Smith9c296662014-07-30 17:49:00 +0000147; CHECK-NEXT: %res13 = fcmp une float %x1, %x2
148 %res13 = fcmp une float %x1, %x2
Michael Kuperstein946b3b22014-09-23 08:48:01 +0000149
Duncan P. N. Exon Smith9c296662014-07-30 17:49:00 +0000150; CHECK-NEXT: %res14 = fcmp uno float %x1, %x2
151 %res14 = fcmp uno float %x1, %x2
Michael Kuperstein946b3b22014-09-23 08:48:01 +0000152
Duncan P. N. Exon Smith9c296662014-07-30 17:49:00 +0000153; CHECK-NEXT: %res15 = fcmp true float %x1, %x2
154 %res15 = fcmp true float %x1, %x2
Michael Kuperstein946b3b22014-09-23 08:48:01 +0000155
Duncan P. N. Exon Smith9c296662014-07-30 17:49:00 +0000156; CHECK-NEXT: %res16 = fcmp false float %x1, %x2
157 %res16 = fcmp false float %x1, %x2
Michael Kuperstein946b3b22014-09-23 08:48:01 +0000158
Duncan P. N. Exon Smith9c296662014-07-30 17:49:00 +0000159; CHECK-NEXT: %res17 = fcmp oeq <2 x float> %vec1, %vec2
160 %res17 = fcmp oeq <2 x float> %vec1, %vec2
Michael Kuperstein946b3b22014-09-23 08:48:01 +0000161
Duncan P. N. Exon Smith9c296662014-07-30 17:49:00 +0000162 ret void
163}
164
165declare i32 @printf(i8* noalias nocapture, ...)
166
167define void @call(i32 %x, i8* %msg ){
168entry:
169
170; CHECK: %res1 = call i32 @test(i32 %x)
171 %res1 = call i32 @test(i32 %x)
Michael Kuperstein946b3b22014-09-23 08:48:01 +0000172
Duncan P. N. Exon Smith9c296662014-07-30 17:49:00 +0000173; CHECK-NEXT: %res2 = tail call i32 @test(i32 %x)
174 %res2 = tail call i32 @test(i32 %x)
Michael Kuperstein946b3b22014-09-23 08:48:01 +0000175
Duncan P. N. Exon Smith9c296662014-07-30 17:49:00 +0000176; CHECK-NEXT: %res3 = call i32 (i8*, ...)* @printf(i8* %msg, i32 12, i8 42)
177 %res3 = call i32 (i8*, ...)* @printf(i8* %msg, i32 12, i8 42)
Michael Kuperstein946b3b22014-09-23 08:48:01 +0000178
Duncan P. N. Exon Smith9c296662014-07-30 17:49:00 +0000179 ret void
180}
181
182define i32 @test(i32 %x){
183entry:
184
185 ret i32 %x
186}