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(ptr, i1) nounwind readonly
54 define i32 @test.objectsize() {
55 ; CHECK-LABEL: @test.objectsize(
56 ; CHECK: @llvm.objectsize.i32.p0(ptr @a, i1 false, i1 false, i1 false)
57 %s = call i32 @llvm.objectsize.i32(ptr @a, i1 false)
61 declare i64 @llvm.objectsize.i64.p0(ptr, i1) nounwind readonly
62 define i64 @test.objectsize.2() {
63 ; CHECK-LABEL: @test.objectsize.2(
64 ; CHECK: @llvm.objectsize.i64.p0(ptr @a, i1 false, i1 false, i1 false)
65 %s = call i64 @llvm.objectsize.i64.p0(ptr @a, i1 false)
69 @u = private global [60 x ptr] zeroinitializer, align 1
71 declare i32 @llvm.objectsize.i32.unnamed(ptr, i1) nounwind readonly
72 define i32 @test.objectsize.unnamed() {
73 ; CHECK-LABEL: @test.objectsize.unnamed(
74 ; CHECK: @llvm.objectsize.i32.p0(ptr @u, i1 false, i1 false, i1 false)
75 %s = call i32 @llvm.objectsize.i32.unnamed(ptr @u, i1 false)
79 define i64 @test.objectsize.unnamed.2() {
80 ; CHECK-LABEL: @test.objectsize.unnamed.2(
81 ; CHECK: @llvm.objectsize.i64.p0(ptr @u, i1 false, i1 false, i1 false)
82 %s = call i64 @llvm.objectsize.i64.p0(ptr @u, i1 false)
86 declare <2 x double> @llvm.masked.load.v2f64(ptr %ptrs, i32, <2 x i1> %mask, <2 x double> %src0)
88 define <2 x double> @tests.masked.load(ptr %ptr, <2 x i1> %mask, <2 x double> %passthru) {
89 ; CHECK-LABEL: @tests.masked.load(
90 ; CHECK: @llvm.masked.load.v2f64.p0
91 %res = call <2 x double> @llvm.masked.load.v2f64(ptr %ptr, i32 1, <2 x i1> %mask, <2 x double> %passthru)
95 declare void @llvm.masked.store.v2f64(<2 x double> %val, ptr %ptrs, i32, <2 x i1> %mask)
97 define void @tests.masked.store(ptr %ptr, <2 x i1> %mask, <2 x double> %val) {
98 ; CHECK-LABEL: @tests.masked.store(
99 ; CHECK: @llvm.masked.store.v2f64.p0
100 call void @llvm.masked.store.v2f64(<2 x double> %val, ptr %ptr, i32 4, <2 x i1> %mask)
104 declare <2 x double> @llvm.masked.gather.v2f64(<2 x ptr> %ptrs, i32, <2 x i1> %mask, <2 x double> %src0)
106 define <2 x double> @tests.masked.gather(<2 x ptr> %ptr, <2 x i1> %mask, <2 x double> %passthru) {
107 ; CHECK-LABEL: @tests.masked.gather(
108 ; CHECK: @llvm.masked.gather.v2f64.v2p0
109 %res = call <2 x double> @llvm.masked.gather.v2f64(<2 x ptr> %ptr, i32 1, <2 x i1> %mask, <2 x double> %passthru)
110 ret <2 x double> %res
113 declare void @llvm.masked.scatter.v2f64(<2 x double> %val, <2 x ptr> %ptrs, i32, <2 x i1> %mask)
115 define void @tests.masked.scatter(<2 x ptr> %ptr, <2 x i1> %mask, <2 x double> %val) {
116 ; CHECK-LABEL: @tests.masked.scatter(
117 ; CHECK: @llvm.masked.scatter.v2f64.v2p0
118 call void @llvm.masked.scatter.v2f64(<2 x double> %val, <2 x ptr> %ptr, i32 1, <2 x i1> %mask)
122 declare ptr @llvm.invariant.start(i64, ptr nocapture) nounwind readonly
123 declare void @llvm.invariant.end(ptr, i64, ptr nocapture) nounwind
125 define void @tests.invariant.start.end() {
126 ; CHECK-LABEL: @tests.invariant.start.end(
128 %i = call ptr @llvm.invariant.start(i64 1, ptr %a)
129 ; CHECK: call ptr @llvm.invariant.start.p0
131 call void @llvm.invariant.end(ptr %i, i64 1, ptr %a)
132 ; CHECK: call void @llvm.invariant.end.p0
136 declare ptr @llvm.invariant.start.unnamed(i64, ptr nocapture) nounwind readonly
137 declare void @llvm.invariant.end.unnamed(ptr, i64, ptr nocapture) nounwind
139 define void @tests.invariant.start.end.unnamed() {
140 ; CHECK-LABEL: @tests.invariant.start.end.unnamed(
142 %i = call ptr @llvm.invariant.start.unnamed(i64 1, ptr %a)
143 ; CHECK: call ptr @llvm.invariant.start.p0
144 store ptr null, ptr %a
145 call void @llvm.invariant.end.unnamed(ptr %i, i64 1, ptr %a)
146 ; CHECK: call void @llvm.invariant.end.p0
150 @__stack_chk_guard = external global ptr
151 declare void @llvm.stackprotectorcheck(ptr)
153 define void @test.stackprotectorcheck() {
154 ; CHECK-LABEL: @test.stackprotectorcheck(
155 ; CHECK-NEXT: ret void
156 call void @llvm.stackprotectorcheck(ptr @__stack_chk_guard)
160 declare void @llvm.lifetime.start(i64, ptr nocapture) nounwind readonly
161 declare void @llvm.lifetime.end(i64, ptr nocapture) nounwind
163 define void @tests.lifetime.start.end() {
164 ; CHECK-LABEL: @tests.lifetime.start.end(
166 call void @llvm.lifetime.start(i64 1, ptr %a)
167 ; CHECK: call void @llvm.lifetime.start.p0(i64 1, ptr %a)
169 call void @llvm.lifetime.end(i64 1, ptr %a)
170 ; CHECK: call void @llvm.lifetime.end.p0(i64 1, ptr %a)
174 declare void @llvm.lifetime.start.unnamed(i64, ptr nocapture) nounwind readonly
175 declare void @llvm.lifetime.end.unnamed(i64, ptr nocapture) nounwind
177 define void @tests.lifetime.start.end.unnamed() {
178 ; CHECK-LABEL: @tests.lifetime.start.end.unnamed(
180 call void @llvm.lifetime.start.unnamed(i64 1, ptr %a)
181 ; CHECK: call void @llvm.lifetime.start.p0(i64 1, ptr %a)
182 store ptr null, ptr %a
183 call void @llvm.lifetime.end.unnamed(i64 1, ptr %a)
184 ; CHECK: call void @llvm.lifetime.end.p0(i64 1, ptr %a)
188 declare void @llvm.prefetch(ptr, i32, i32, i32)
189 define void @test.prefetch(ptr %ptr) {
190 ; CHECK-LABEL: @test.prefetch(
191 ; CHECK: @llvm.prefetch.p0(ptr %ptr, i32 0, i32 3, i32 1)
192 call void @llvm.prefetch(ptr %ptr, i32 0, i32 3, i32 1)
196 declare void @llvm.prefetch.p0(ptr, i32, i32, i32)
197 define void @test.prefetch.2(ptr %ptr) {
198 ; CHECK-LABEL: @test.prefetch.2(
199 ; CHECK: @llvm.prefetch.p0(ptr %ptr, i32 0, i32 3, i32 1)
200 call void @llvm.prefetch(ptr %ptr, i32 0, i32 3, i32 1)
204 declare void @llvm.prefetch.unnamed(ptr, i32, i32, i32)
205 define void @test.prefetch.unnamed(ptr %ptr) {
206 ; CHECK-LABEL: @test.prefetch.unnamed(
207 ; CHECK: @llvm.prefetch.p0(ptr %ptr, i32 0, i32 3, i32 1)
208 call void @llvm.prefetch.unnamed(ptr %ptr, i32 0, i32 3, i32 1)
212 ; This is part of @test.objectsize(), since llvm.objectsize declaration gets
213 ; emitted at the end.
214 ; CHECK: declare i32 @llvm.objectsize.i32.p0
216 ; CHECK: declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture)
217 ; CHECK: declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture)