1 ; Test to make sure intrinsics are automatically upgraded.
2 ; RUN: llvm-as < %s | llvm-dis | FileCheck %s
3 ; RUN: verify-uselistorder %s
7 declare i8 @llvm.ctlz.i8(i8)
8 declare i16 @llvm.ctlz.i16(i16)
9 declare i32 @llvm.ctlz.i32(i32)
10 declare i42 @llvm.ctlz.i42(i42) ; Not a power-of-2
13 define void @test.ctlz(i8 %a, i16 %b, i32 %c, i42 %d) {
17 ; CHECK: call i8 @llvm.ctlz.i8(i8 %a, i1 false)
18 call i8 @llvm.ctlz.i8(i8 %a)
19 ; CHECK: call i16 @llvm.ctlz.i16(i16 %b, i1 false)
20 call i16 @llvm.ctlz.i16(i16 %b)
21 ; CHECK: call i32 @llvm.ctlz.i32(i32 %c, i1 false)
22 call i32 @llvm.ctlz.i32(i32 %c)
23 ; CHECK: call i42 @llvm.ctlz.i42(i42 %d, i1 false)
24 call i42 @llvm.ctlz.i42(i42 %d)
29 declare i8 @llvm.cttz.i8(i8)
30 declare i16 @llvm.cttz.i16(i16)
31 declare i32 @llvm.cttz.i32(i32)
32 declare i42 @llvm.cttz.i42(i42) ; Not a power-of-2
34 define void @test.cttz(i8 %a, i16 %b, i32 %c, i42 %d) {
38 ; CHECK: call i8 @llvm.cttz.i8(i8 %a, i1 false)
39 call i8 @llvm.cttz.i8(i8 %a)
40 ; CHECK: call i16 @llvm.cttz.i16(i16 %b, i1 false)
41 call i16 @llvm.cttz.i16(i16 %b)
42 ; CHECK: call i32 @llvm.cttz.i32(i32 %c, i1 false)
43 call i32 @llvm.cttz.i32(i32 %c)
44 ; CHECK: call i42 @llvm.cttz.i42(i42 %d, i1 false)
45 call i42 @llvm.cttz.i42(i42 %d)
51 @a = private global [60 x i8] zeroinitializer, align 1
53 declare i32 @llvm.objectsize.i32(i8*, i1) nounwind readonly
54 define i32 @test.objectsize() {
55 ; CHECK-LABEL: @test.objectsize(
56 ; CHECK: @llvm.objectsize.i32.p0i8(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i1 false, i1 false, i1 false)
57 %s = call i32 @llvm.objectsize.i32(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i1 false)
61 declare i64 @llvm.objectsize.i64.p0i8(i8*, i1) nounwind readonly
62 define i64 @test.objectsize.2() {
63 ; CHECK-LABEL: @test.objectsize.2(
64 ; CHECK: @llvm.objectsize.i64.p0i8(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i1 false, i1 false, i1 false)
65 %s = call i64 @llvm.objectsize.i64.p0i8(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i1 false)
69 @u = private global [60 x %0*] zeroinitializer, align 1
71 declare i32 @llvm.objectsize.i32.unnamed(%0**, i1) nounwind readonly
72 define i32 @test.objectsize.unnamed() {
73 ; CHECK-LABEL: @test.objectsize.unnamed(
74 ; CHECK: @llvm.objectsize.i32.p0p0s_s.0(%0** getelementptr inbounds ([60 x %0*], [60 x %0*]* @u, i32 0, i32 0), i1 false, i1 false, i1 false)
75 %s = call i32 @llvm.objectsize.i32.unnamed(%0** getelementptr inbounds ([60 x %0*], [60 x %0*]* @u, i32 0, i32 0), i1 false)
79 declare i64 @llvm.objectsize.i64.p0p0s_s.0(%0**, i1) nounwind readonly
80 define i64 @test.objectsize.unnamed.2() {
81 ; CHECK-LABEL: @test.objectsize.unnamed.2(
82 ; CHECK: @llvm.objectsize.i64.p0p0s_s.0(%0** getelementptr inbounds ([60 x %0*], [60 x %0*]* @u, i32 0, i32 0), i1 false, i1 false, i1 false)
83 %s = call i64 @llvm.objectsize.i64.p0p0s_s.0(%0** getelementptr inbounds ([60 x %0*], [60 x %0*]* @u, i32 0, i32 0), i1 false)
87 declare <2 x double> @llvm.masked.load.v2f64(<2 x double>* %ptrs, i32, <2 x i1> %mask, <2 x double> %src0)
89 define <2 x double> @tests.masked.load(<2 x double>* %ptr, <2 x i1> %mask, <2 x double> %passthru) {
90 ; CHECK-LABEL: @tests.masked.load(
91 ; CHECK: @llvm.masked.load.v2f64.p0v2f64
92 %res = call <2 x double> @llvm.masked.load.v2f64(<2 x double>* %ptr, i32 1, <2 x i1> %mask, <2 x double> %passthru)
96 declare void @llvm.masked.store.v2f64(<2 x double> %val, <2 x double>* %ptrs, i32, <2 x i1> %mask)
98 define void @tests.masked.store(<2 x double>* %ptr, <2 x i1> %mask, <2 x double> %val) {
99 ; CHECK-LABEL: @tests.masked.store(
100 ; CHECK: @llvm.masked.store.v2f64.p0v2f64
101 call void @llvm.masked.store.v2f64(<2 x double> %val, <2 x double>* %ptr, i32 4, <2 x i1> %mask)
105 declare <2 x double> @llvm.masked.gather.v2f64(<2 x double*> %ptrs, i32, <2 x i1> %mask, <2 x double> %src0)
107 define <2 x double> @tests.masked.gather(<2 x double*> %ptr, <2 x i1> %mask, <2 x double> %passthru) {
108 ; CHECK-LABEL: @tests.masked.gather(
109 ; CHECK: @llvm.masked.gather.v2f64.v2p0f64
110 %res = call <2 x double> @llvm.masked.gather.v2f64(<2 x double*> %ptr, i32 1, <2 x i1> %mask, <2 x double> %passthru)
111 ret <2 x double> %res
114 declare void @llvm.masked.scatter.v2f64(<2 x double> %val, <2 x double*> %ptrs, i32, <2 x i1> %mask)
116 define void @tests.masked.scatter(<2 x double*> %ptr, <2 x i1> %mask, <2 x double> %val) {
117 ; CHECK-LABEL: @tests.masked.scatter(
118 ; CHECK: @llvm.masked.scatter.v2f64.v2p0f64
119 call void @llvm.masked.scatter.v2f64(<2 x double> %val, <2 x double*> %ptr, i32 1, <2 x i1> %mask)
123 declare {}* @llvm.invariant.start(i64, i8* nocapture) nounwind readonly
124 declare void @llvm.invariant.end({}*, i64, i8* nocapture) nounwind
126 define void @tests.invariant.start.end() {
127 ; CHECK-LABEL: @tests.invariant.start.end(
129 %i = call {}* @llvm.invariant.start(i64 1, i8* %a)
130 ; CHECK: call {}* @llvm.invariant.start.p0i8
132 call void @llvm.invariant.end({}* %i, i64 1, i8* %a)
133 ; CHECK: call void @llvm.invariant.end.p0i8
137 declare {}* @llvm.invariant.start.unnamed(i64, %0** nocapture) nounwind readonly
138 declare void @llvm.invariant.end.unnamed({}*, i64, %0** nocapture) nounwind
140 define void @tests.invariant.start.end.unnamed() {
141 ; CHECK-LABEL: @tests.invariant.start.end.unnamed(
143 %i = call {}* @llvm.invariant.start.unnamed(i64 1, %0** %a)
144 ; CHECK: call {}* @llvm.invariant.start.p0p0s_s.0
145 store %0* null, %0** %a
146 call void @llvm.invariant.end.unnamed({}* %i, i64 1, %0** %a)
147 ; CHECK: call void @llvm.invariant.end.p0p0s_s.0
151 @__stack_chk_guard = external global i8*
152 declare void @llvm.stackprotectorcheck(i8**)
154 define void @test.stackprotectorcheck() {
155 ; CHECK-LABEL: @test.stackprotectorcheck(
156 ; CHECK-NEXT: ret void
157 call void @llvm.stackprotectorcheck(i8** @__stack_chk_guard)
161 declare void @llvm.lifetime.start(i64, i8* nocapture) nounwind readonly
162 declare void @llvm.lifetime.end(i64, i8* nocapture) nounwind
164 define void @tests.lifetime.start.end() {
165 ; CHECK-LABEL: @tests.lifetime.start.end(
167 call void @llvm.lifetime.start(i64 1, i8* %a)
168 ; CHECK: call void @llvm.lifetime.start.p0i8(i64 1, i8* %a)
170 call void @llvm.lifetime.end(i64 1, i8* %a)
171 ; CHECK: call void @llvm.lifetime.end.p0i8(i64 1, i8* %a)
175 declare void @llvm.lifetime.start.unnamed(i64, %0** nocapture) nounwind readonly
176 declare void @llvm.lifetime.end.unnamed(i64, %0** nocapture) nounwind
178 define void @tests.lifetime.start.end.unnamed() {
179 ; CHECK-LABEL: @tests.lifetime.start.end.unnamed(
181 call void @llvm.lifetime.start.unnamed(i64 1, %0** %a)
182 ; CHECK: call void @llvm.lifetime.start.p0p0s_s.0(i64 1, %0** %a)
183 store %0* null, %0** %a
184 call void @llvm.lifetime.end.unnamed(i64 1, %0** %a)
185 ; CHECK: call void @llvm.lifetime.end.p0p0s_s.0(i64 1, %0** %a)
189 declare void @llvm.prefetch(i8*, i32, i32, i32)
190 define void @test.prefetch(i8* %ptr) {
191 ; CHECK-LABEL: @test.prefetch(
192 ; CHECK: @llvm.prefetch.p0i8(i8* %ptr, i32 0, i32 3, i32 2)
193 call void @llvm.prefetch(i8* %ptr, i32 0, i32 3, i32 2)
197 declare void @llvm.prefetch.p0i8(i8*, i32, i32, i32)
198 define void @test.prefetch.2(i8* %ptr) {
199 ; CHECK-LABEL: @test.prefetch.2(
200 ; CHECK: @llvm.prefetch.p0i8(i8* %ptr, i32 0, i32 3, i32 2)
201 call void @llvm.prefetch(i8* %ptr, i32 0, i32 3, i32 2)
205 declare void @llvm.prefetch.unnamed(%0**, i32, i32, i32)
206 define void @test.prefetch.unnamed(%0** %ptr) {
207 ; CHECK-LABEL: @test.prefetch.unnamed(
208 ; CHECK: @llvm.prefetch.p0p0s_s.0(%0** %ptr, i32 0, i32 3, i32 2)
209 call void @llvm.prefetch.unnamed(%0** %ptr, i32 0, i32 3, i32 2)
213 ; This is part of @test.objectsize(), since llvm.objectsize declaration gets
214 ; emitted at the end.
215 ; CHECK: declare i32 @llvm.objectsize.i32.p0i8
216 ; CHECK: declare i32 @llvm.objectsize.i32.p0p0s_s.0
218 ; CHECK: declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture)
219 ; CHECK: declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture)
220 ; CHECK: declare void @llvm.lifetime.start.p0p0s_s.0(i64 immarg, %0** nocapture)
221 ; CHECK: declare void @llvm.lifetime.end.p0p0s_s.0(i64 immarg, %0** nocapture)