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; CHECK-DAG: declare i32 @llvm.objectsize.i32.p0i8
58  %s = call i32 @llvm.objectsize.i32(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i1 false)
59  ret i32 %s
60}
61