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 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 <2 x double> @llvm.masked.load.v2f64(<2 x double>* %ptrs, i32, <2 x i1> %mask, <2 x double> %src0) 62 63define <2 x double> @tests.masked.load(<2 x double>* %ptr, <2 x i1> %mask, <2 x double> %passthru) { 64; CHECK-LABEL: @tests.masked.load( 65; CHECK: @llvm.masked.load.v2f64.p0v2f64 66 %res = call <2 x double> @llvm.masked.load.v2f64(<2 x double>* %ptr, i32 1, <2 x i1> %mask, <2 x double> %passthru) 67 ret <2 x double> %res 68} 69 70declare void @llvm.masked.store.v2f64(<2 x double> %val, <2 x double>* %ptrs, i32, <2 x i1> %mask) 71 72define void @tests.masked.store(<2 x double>* %ptr, <2 x i1> %mask, <2 x double> %val) { 73; CHECK-LABEL: @tests.masked.store( 74; CHECK: @llvm.masked.store.v2f64.p0v2f64 75 call void @llvm.masked.store.v2f64(<2 x double> %val, <2 x double>* %ptr, i32 3, <2 x i1> %mask) 76 ret void 77} 78 79@__stack_chk_guard = external global i8* 80declare void @llvm.stackprotectorcheck(i8**) 81 82define void @test.stackprotectorcheck() { 83; CHECK-LABEL: @test.stackprotectorcheck( 84; CHECK-NEXT: ret void 85 call void @llvm.stackprotectorcheck(i8** @__stack_chk_guard) 86 ret void 87} 88 89; This is part of @test.objectsize(), since llvm.objectsize declaration gets 90; emitted at the end. 91; CHECK: declare i32 @llvm.objectsize.i32.p0i8 92