1; Test to make sure intrinsics are automatically upgraded. 2; RUN: llvm-as < %s | llvm-dis | FileCheck %s 3; RUN: verify-uselistorder %s 4 5declare i8 @llvm.ctlz.i8(i8) 6declare i16 @llvm.ctlz.i16(i16) 7declare i32 @llvm.ctlz.i32(i32) 8declare i42 @llvm.ctlz.i42(i42) ; Not a power-of-2 9 10 11declare i32 @llvm.objectsize.i32(i8*, i1) nounwind readonly 12 13 14define void @test.ctlz(i8 %a, i16 %b, i32 %c, i42 %d) { 15; CHECK: @test.ctlz 16 17entry: 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) 26 27 ret void 28} 29 30declare i8 @llvm.cttz.i8(i8) 31declare i16 @llvm.cttz.i16(i16) 32declare i32 @llvm.cttz.i32(i32) 33declare i42 @llvm.cttz.i42(i42) ; Not a power-of-2 34 35define void @test.cttz(i8 %a, i16 %b, i32 %c, i42 %d) { 36; CHECK: @test.cttz 37 38entry: 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) 47 48 ret void 49} 50 51 52@a = private global [60 x i8] zeroinitializer, align 1 53 54define 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) 57 %s = call i32 @llvm.objectsize.i32(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i1 false) 58 ret i32 %s 59} 60 61declare i64 @llvm.objectsize.i64.p0i8(i8*, i1) nounwind readonly 62define 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) 65 %s = call i64 @llvm.objectsize.i64.p0i8(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i1 false) 66 ret i64 %s 67} 68 69 70declare <2 x double> @llvm.masked.load.v2f64(<2 x double>* %ptrs, i32, <2 x i1> %mask, <2 x double> %src0) 71 72define <2 x double> @tests.masked.load(<2 x double>* %ptr, <2 x i1> %mask, <2 x double> %passthru) { 73; CHECK-LABEL: @tests.masked.load( 74; CHECK: @llvm.masked.load.v2f64.p0v2f64 75 %res = call <2 x double> @llvm.masked.load.v2f64(<2 x double>* %ptr, i32 1, <2 x i1> %mask, <2 x double> %passthru) 76 ret <2 x double> %res 77} 78 79declare void @llvm.masked.store.v2f64(<2 x double> %val, <2 x double>* %ptrs, i32, <2 x i1> %mask) 80 81define void @tests.masked.store(<2 x double>* %ptr, <2 x i1> %mask, <2 x double> %val) { 82; CHECK-LABEL: @tests.masked.store( 83; CHECK: @llvm.masked.store.v2f64.p0v2f64 84 call void @llvm.masked.store.v2f64(<2 x double> %val, <2 x double>* %ptr, i32 3, <2 x i1> %mask) 85 ret void 86} 87 88declare <2 x double> @llvm.masked.gather.v2f64(<2 x double*> %ptrs, i32, <2 x i1> %mask, <2 x double> %src0) 89 90define <2 x double> @tests.masked.gather(<2 x double*> %ptr, <2 x i1> %mask, <2 x double> %passthru) { 91; CHECK-LABEL: @tests.masked.gather( 92; CHECK: @llvm.masked.gather.v2f64.v2p0f64 93 %res = call <2 x double> @llvm.masked.gather.v2f64(<2 x double*> %ptr, i32 1, <2 x i1> %mask, <2 x double> %passthru) 94 ret <2 x double> %res 95} 96 97declare void @llvm.masked.scatter.v2f64(<2 x double> %val, <2 x double*> %ptrs, i32, <2 x i1> %mask) 98 99define void @tests.masked.scatter(<2 x double*> %ptr, <2 x i1> %mask, <2 x double> %val) { 100; CHECK-LABEL: @tests.masked.scatter( 101; CHECK: @llvm.masked.scatter.v2f64.v2p0f64 102 call void @llvm.masked.scatter.v2f64(<2 x double> %val, <2 x double*> %ptr, i32 3, <2 x i1> %mask) 103 ret void 104} 105 106declare {}* @llvm.invariant.start(i64, i8* nocapture) nounwind readonly 107declare void @llvm.invariant.end({}*, i64, i8* nocapture) nounwind 108 109define void @tests.invariant.start.end() { 110 ; CHECK-LABEL: @tests.invariant.start.end( 111 %a = alloca i8 112 %i = call {}* @llvm.invariant.start(i64 1, i8* %a) 113 ; CHECK: call {}* @llvm.invariant.start.p0i8 114 store i8 0, i8* %a 115 call void @llvm.invariant.end({}* %i, i64 1, i8* %a) 116 ; CHECK: call void @llvm.invariant.end.p0i8 117 ret void 118} 119 120@__stack_chk_guard = external global i8* 121declare void @llvm.stackprotectorcheck(i8**) 122 123define void @test.stackprotectorcheck() { 124; CHECK-LABEL: @test.stackprotectorcheck( 125; CHECK-NEXT: ret void 126 call void @llvm.stackprotectorcheck(i8** @__stack_chk_guard) 127 ret void 128} 129 130declare void @llvm.lifetime.start(i64, i8* nocapture) nounwind readonly 131declare void @llvm.lifetime.end(i64, i8* nocapture) nounwind 132 133define void @tests.lifetime.start.end() { 134 ; CHECK-LABEL: @tests.lifetime.start.end( 135 %a = alloca i8 136 call void @llvm.lifetime.start(i64 1, i8* %a) 137 ; CHECK: call void @llvm.lifetime.start.p0i8(i64 1, i8* %a) 138 store i8 0, i8* %a 139 call void @llvm.lifetime.end(i64 1, i8* %a) 140 ; CHECK: call void @llvm.lifetime.end.p0i8(i64 1, i8* %a) 141 ret void 142} 143 144 145; This is part of @test.objectsize(), since llvm.objectsize declaration gets 146; emitted at the end. 147; CHECK: declare i32 @llvm.objectsize.i32.p0i8 148 149 150; CHECK: declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) 151; CHECK: declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) 152