1 ; Test to make sure intrinsics are automatically upgraded.
2 ; RUN: llvm-as < %s | llvm-dis | FileCheck %s
3 ; RUN: verify-uselistorder %s
5 declare i8 @llvm.ctlz.i8(i8)
6 declare i16 @llvm.ctlz.i16(i16)
7 declare i32 @llvm.ctlz.i32(i32)
8 declare i42 @llvm.ctlz.i42(i42) ; Not a power-of-2
11 declare i32 @llvm.objectsize.i32(i8*, i1) nounwind readonly
14 define void @test.ctlz(i8 %a, i16 %b, i32 %c, i42 %d) {
18 ; CHECK: call i8 @llvm.ctlz.i8(i8 %a, i1 false)
19 call i8 @llvm.ctlz.i8(i8 %a)
20 ; CHECK: call i16 @llvm.ctlz.i16(i16 %b, i1 false)
21 call i16 @llvm.ctlz.i16(i16 %b)
22 ; CHECK: call i32 @llvm.ctlz.i32(i32 %c, i1 false)
23 call i32 @llvm.ctlz.i32(i32 %c)
24 ; CHECK: call i42 @llvm.ctlz.i42(i42 %d, i1 false)
25 call i42 @llvm.ctlz.i42(i42 %d)
30 declare i8 @llvm.cttz.i8(i8)
31 declare i16 @llvm.cttz.i16(i16)
32 declare i32 @llvm.cttz.i32(i32)
33 declare i42 @llvm.cttz.i42(i42) ; Not a power-of-2
35 define void @test.cttz(i8 %a, i16 %b, i32 %c, i42 %d) {
39 ; CHECK: call i8 @llvm.cttz.i8(i8 %a, i1 false)
40 call i8 @llvm.cttz.i8(i8 %a)
41 ; CHECK: call i16 @llvm.cttz.i16(i16 %b, i1 false)
42 call i16 @llvm.cttz.i16(i16 %b)
43 ; CHECK: call i32 @llvm.cttz.i32(i32 %c, i1 false)
44 call i32 @llvm.cttz.i32(i32 %c)
45 ; CHECK: call i42 @llvm.cttz.i42(i42 %d, i1 false)
46 call i42 @llvm.cttz.i42(i42 %d)
52 @a = private global [60 x i8] zeroinitializer, align 1
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 declare <2 x double> @llvm.masked.load.v2f64(<2 x double>* %ptrs, i32, <2 x i1> %mask, <2 x double> %src0)
71 define <2 x double> @tests.masked.load(<2 x double>* %ptr, <2 x i1> %mask, <2 x double> %passthru) {
72 ; CHECK-LABEL: @tests.masked.load(
73 ; CHECK: @llvm.masked.load.v2f64.p0v2f64
74 %res = call <2 x double> @llvm.masked.load.v2f64(<2 x double>* %ptr, i32 1, <2 x i1> %mask, <2 x double> %passthru)
78 declare void @llvm.masked.store.v2f64(<2 x double> %val, <2 x double>* %ptrs, i32, <2 x i1> %mask)
80 define void @tests.masked.store(<2 x double>* %ptr, <2 x i1> %mask, <2 x double> %val) {
81 ; CHECK-LABEL: @tests.masked.store(
82 ; CHECK: @llvm.masked.store.v2f64.p0v2f64
83 call void @llvm.masked.store.v2f64(<2 x double> %val, <2 x double>* %ptr, i32 4, <2 x i1> %mask)
87 declare <2 x double> @llvm.masked.gather.v2f64(<2 x double*> %ptrs, i32, <2 x i1> %mask, <2 x double> %src0)
89 define <2 x double> @tests.masked.gather(<2 x double*> %ptr, <2 x i1> %mask, <2 x double> %passthru) {
90 ; CHECK-LABEL: @tests.masked.gather(
91 ; CHECK: @llvm.masked.gather.v2f64.v2p0f64
92 %res = call <2 x double> @llvm.masked.gather.v2f64(<2 x double*> %ptr, i32 1, <2 x i1> %mask, <2 x double> %passthru)
96 declare void @llvm.masked.scatter.v2f64(<2 x double> %val, <2 x double*> %ptrs, i32, <2 x i1> %mask)
98 define void @tests.masked.scatter(<2 x double*> %ptr, <2 x i1> %mask, <2 x double> %val) {
99 ; CHECK-LABEL: @tests.masked.scatter(
100 ; CHECK: @llvm.masked.scatter.v2f64.v2p0f64
101 call void @llvm.masked.scatter.v2f64(<2 x double> %val, <2 x double*> %ptr, i32 3, <2 x i1> %mask)
105 declare {}* @llvm.invariant.start(i64, i8* nocapture) nounwind readonly
106 declare void @llvm.invariant.end({}*, i64, i8* nocapture) nounwind
108 define void @tests.invariant.start.end() {
109 ; CHECK-LABEL: @tests.invariant.start.end(
111 %i = call {}* @llvm.invariant.start(i64 1, i8* %a)
112 ; CHECK: call {}* @llvm.invariant.start.p0i8
114 call void @llvm.invariant.end({}* %i, i64 1, i8* %a)
115 ; CHECK: call void @llvm.invariant.end.p0i8
119 @__stack_chk_guard = external global i8*
120 declare void @llvm.stackprotectorcheck(i8**)
122 define void @test.stackprotectorcheck() {
123 ; CHECK-LABEL: @test.stackprotectorcheck(
124 ; CHECK-NEXT: ret void
125 call void @llvm.stackprotectorcheck(i8** @__stack_chk_guard)
129 declare void @llvm.lifetime.start(i64, i8* nocapture) nounwind readonly
130 declare void @llvm.lifetime.end(i64, i8* nocapture) nounwind
132 define void @tests.lifetime.start.end() {
133 ; CHECK-LABEL: @tests.lifetime.start.end(
135 call void @llvm.lifetime.start(i64 1, i8* %a)
136 ; CHECK: call void @llvm.lifetime.start.p0i8(i64 1, i8* %a)
138 call void @llvm.lifetime.end(i64 1, i8* %a)
139 ; CHECK: call void @llvm.lifetime.end.p0i8(i64 1, i8* %a)
143 declare void @llvm.prefetch(i8*, i32, i32, i32)
144 define void @test.prefetch(i8* %ptr) {
145 ; CHECK-LABEL: @test.prefetch(
146 ; CHECK: @llvm.prefetch.p0i8(i8* %ptr, i32 0, i32 3, i32 2)
147 call void @llvm.prefetch(i8* %ptr, i32 0, i32 3, i32 2)
151 declare void @llvm.prefetch.p0i8(i8*, i32, i32, i32)
152 define void @test.prefetch.2(i8* %ptr) {
153 ; CHECK-LABEL: @test.prefetch.2(
154 ; CHECK: @llvm.prefetch.p0i8(i8* %ptr, i32 0, i32 3, i32 2)
155 call void @llvm.prefetch(i8* %ptr, i32 0, i32 3, i32 2)
159 ; This is part of @test.objectsize(), since llvm.objectsize declaration gets
160 ; emitted at the end.
161 ; CHECK: declare i32 @llvm.objectsize.i32.p0i8
164 ; CHECK: declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture)
165 ; CHECK: declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture)