aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/Assembler/AutoUpgradeIntrinsics.ll52
-rw-r--r--test/Bitcode/AutoUpgradeIntrinsics.ll10
-rw-r--r--test/Bitcode/AutoUpgradeIntrinsics.ll.bcbin0 -> 800 bytes
-rw-r--r--test/CodeGen/Alpha/ctlz.ll7
-rw-r--r--test/CodeGen/Generic/bit-intrinsics.ll16
-rw-r--r--test/CodeGen/PowerPC/2007-03-24-cntlzd.ll5
-rw-r--r--test/Feature/llvm2cpp.ll72
-rw-r--r--test/Transforms/InstCombine/bitcount.ll14
8 files changed, 103 insertions, 73 deletions
diff --git a/test/Assembler/AutoUpgradeIntrinsics.ll b/test/Assembler/AutoUpgradeIntrinsics.ll
new file mode 100644
index 0000000..fad3d4e
--- /dev/null
+++ b/test/Assembler/AutoUpgradeIntrinsics.ll
@@ -0,0 +1,52 @@
+; Tests to make sure intrinsics are automatically upgraded.
+; RUN: llvm-as < %s | llvm-dis | not grep {i32 @llvm\\.ct}
+; RUN: llvm-as < %s | llvm-dis | \
+; RUN: not grep {llvm\\.part\\.set\\.i\[0-9\]*\\.i\[0-9\]*\\.i\[0-9\]*}
+; RUN: llvm-as < %s | llvm-dis | \
+; RUN: not grep {llvm\\.part\\.select\\.i\[0-9\]*\\.i\[0-9\]*}
+; RUN: llvm-as < %s | llvm-dis | \
+; RUN: not grep {llvm\\.bswap\\.i\[0-9\]*\\.i\[0-9\]*}
+
+declare i32 @llvm.ctpop.i28(i28 %val)
+declare i32 @llvm.cttz.i29(i29 %val)
+declare i32 @llvm.ctlz.i30(i30 %val)
+
+define i32 @test_ct(i32 %A) {
+ %c1 = call i32 @llvm.ctpop.i28(i28 1234)
+ %c2 = call i32 @llvm.cttz.i29(i29 2345)
+ %c3 = call i32 @llvm.ctlz.i30(i30 3456)
+ %r1 = add i32 %c1, %c2
+ %r2 = add i32 %r1, %c3
+ ret i32 %r2
+}
+
+declare i32 @llvm.part.set.i32.i32.i32(i32 %x, i32 %rep, i32 %hi, i32 %lo)
+declare i16 @llvm.part.set.i16.i16.i16(i16 %x, i16 %rep, i32 %hi, i32 %lo)
+define i32 @test_part_set(i32 %A, i16 %B) {
+ %a = call i32 @llvm.part.set.i32.i32.i32(i32 %A, i32 27, i32 8, i32 0)
+ %b = call i16 @llvm.part.set.i16.i16.i16(i16 %B, i16 27, i32 8, i32 0)
+ %c = zext i16 %b to i32
+ %d = add i32 %a, %c
+ ret i32 %d
+}
+
+declare i32 @llvm.part.select.i32.i32(i32 %x, i32 %hi, i32 %lo)
+declare i16 @llvm.part.select.i16.i16(i16 %x, i32 %hi, i32 %lo)
+define i32 @test_part_select(i32 %A, i16 %B) {
+ %a = call i32 @llvm.part.select.i32.i32(i32 %A, i32 8, i32 0)
+ %b = call i16 @llvm.part.select.i16.i16(i16 %B, i32 8, i32 0)
+ %c = zext i16 %b to i32
+ %d = add i32 %a, %c
+ ret i32 %d
+}
+
+declare i32 @llvm.bswap.i32.i32(i32 %x)
+declare i16 @llvm.bswap.i16.i16(i16 %x)
+define i32 @test_bswap(i32 %A, i16 %B) {
+ %a = call i32 @llvm.bswap.i32.i32(i32 %A)
+ %b = call i16 @llvm.bswap.i16.i16(i16 %B)
+ %c = zext i16 %b to i32
+ %d = add i32 %a, %c
+ ret i32 %d
+}
+
diff --git a/test/Bitcode/AutoUpgradeIntrinsics.ll b/test/Bitcode/AutoUpgradeIntrinsics.ll
new file mode 100644
index 0000000..5f9bcd5
--- /dev/null
+++ b/test/Bitcode/AutoUpgradeIntrinsics.ll
@@ -0,0 +1,10 @@
+; This isn't really an assembly file. It just runs test on bitcode to ensure
+; it is auto-upgraded.
+; RUN: llvm-dis < %s.bc | not grep {i32 @llvm\\.ct}
+; RUN: llvm-dis < %s.bc | \
+; RUN: not grep {llvm\\.part\\.set\\.i\[0-9\]*\\.i\[0-9\]*\\.i\[0-9\]*}
+; RUN: llvm-dis < %s.bc | \
+; RUN: not grep {llvm\\.part\\.select\\.i\[0-9\]*\\.i\[0-9\]*}
+; RUN: llvm-dis < %s.bc | \
+; RUN: not grep {llvm\\.bswap\\.i\[0-9\]*\\.i\[0-9\]*}
+
diff --git a/test/Bitcode/AutoUpgradeIntrinsics.ll.bc b/test/Bitcode/AutoUpgradeIntrinsics.ll.bc
new file mode 100644
index 0000000..9de756b
--- /dev/null
+++ b/test/Bitcode/AutoUpgradeIntrinsics.ll.bc
Binary files differ
diff --git a/test/CodeGen/Alpha/ctlz.ll b/test/CodeGen/Alpha/ctlz.ll
index 0ad014d..fba6022 100644
--- a/test/CodeGen/Alpha/ctlz.ll
+++ b/test/CodeGen/Alpha/ctlz.ll
@@ -5,10 +5,11 @@
; RUN: llvm-as < %s | llc -march=alpha -mcpu=ev56 | not grep -i ctlz
; RUN: llvm-as < %s | llc -march=alpha -mattr=-CIX | not grep -i ctlz
-declare i32 @llvm.ctlz.i8(i8)
+declare i8 @llvm.ctlz.i8(i8)
define i32 @bar(i8 %x) {
entry:
- %tmp.1 = call i32 @llvm.ctlz.i8( i8 %x )
- ret i32 %tmp.1
+ %tmp.1 = call i8 @llvm.ctlz.i8( i8 %x )
+ %tmp.2 = sext i8 %tmp.1 to i32
+ ret i32 %tmp.2
}
diff --git a/test/CodeGen/Generic/bit-intrinsics.ll b/test/CodeGen/Generic/bit-intrinsics.ll
index 427387f..9541011 100644
--- a/test/CodeGen/Generic/bit-intrinsics.ll
+++ b/test/CodeGen/Generic/bit-intrinsics.ll
@@ -3,21 +3,21 @@
; RUN: llvm-as < %s > %t.bc
; RUN: lli --force-interpreter=true %t.bc
-declare i32 @llvm.part.set.i32.i32.i32(i32 %x, i32 %rep, i32 %hi, i32 %lo)
-declare i16 @llvm.part.set.i16.i16.i16(i16 %x, i16 %rep, i32 %hi, i32 %lo)
+declare i32 @llvm.part.set.i32.i32(i32 %x, i32 %rep, i32 %hi, i32 %lo)
+declare i16 @llvm.part.set.i16.i16(i16 %x, i16 %rep, i32 %hi, i32 %lo)
define i32 @test_part_set(i32 %A, i16 %B) {
- %a = call i32 @llvm.part.set.i32.i32.i32(i32 %A, i32 27, i32 8, i32 0)
- %b = call i16 @llvm.part.set.i16.i16.i16(i16 %B, i16 27, i32 8, i32 0)
+ %a = call i32 @llvm.part.set.i32.i32(i32 %A, i32 27, i32 8, i32 0)
+ %b = call i16 @llvm.part.set.i16.i16(i16 %B, i16 27, i32 8, i32 0)
%c = zext i16 %b to i32
%d = add i32 %a, %c
ret i32 %d
}
-declare i32 @llvm.part.select.i32.i32(i32 %x, i32 %hi, i32 %lo)
-declare i16 @llvm.part.select.i16.i16(i16 %x, i32 %hi, i32 %lo)
+declare i32 @llvm.part.select.i32(i32 %x, i32 %hi, i32 %lo)
+declare i16 @llvm.part.select.i16(i16 %x, i32 %hi, i32 %lo)
define i32 @test_part_select(i32 %A, i16 %B) {
- %a = call i32 @llvm.part.select.i32.i32(i32 %A, i32 8, i32 0)
- %b = call i16 @llvm.part.select.i16.i16(i16 %B, i32 8, i32 0)
+ %a = call i32 @llvm.part.select.i32(i32 %A, i32 8, i32 0)
+ %b = call i16 @llvm.part.select.i16(i16 %B, i32 8, i32 0)
%c = zext i16 %b to i32
%d = add i32 %a, %c
ret i32 %d
diff --git a/test/CodeGen/PowerPC/2007-03-24-cntlzd.ll b/test/CodeGen/PowerPC/2007-03-24-cntlzd.ll
index 1ea6174..098e748 100644
--- a/test/CodeGen/PowerPC/2007-03-24-cntlzd.ll
+++ b/test/CodeGen/PowerPC/2007-03-24-cntlzd.ll
@@ -2,10 +2,11 @@
define i32 @_ZNK4llvm5APInt17countLeadingZerosEv(i64 *%t) {
%tmp19 = load i64* %t
- %tmp23 = tail call i32 @llvm.ctlz.i64( i64 %tmp19 ) ; <i64> [#uses=1]
+ %tmp22 = tail call i64 @llvm.ctlz.i64( i64 %tmp19 ) ; <i64> [#uses=1]
+ %tmp23 = trunc i64 %tmp22 to i32
%tmp89 = add i32 %tmp23, -64 ; <i32> [#uses=1]
%tmp90 = add i32 %tmp89, 0 ; <i32> [#uses=1]
ret i32 %tmp90
}
-declare i32 @llvm.ctlz.i64(i64)
+declare i64 @llvm.ctlz.i64(i64)
diff --git a/test/Feature/llvm2cpp.ll b/test/Feature/llvm2cpp.ll
index 88cfa34..5c381c7 100644
--- a/test/Feature/llvm2cpp.ll
+++ b/test/Feature/llvm2cpp.ll
@@ -403,30 +403,6 @@ declare i1 @llvm.isunordered.f64(double, double)
declare void @llvm.prefetch(i8*, i32, i32)
-declare i32 @upgrd.rm.llvm.ctpop.i8(i8)
-
-declare i32 @upgrd.rm.llvm.ctpop.i16(i16)
-
-declare i32 @upgrd.rm.llvm.ctpop.i32(i32)
-
-declare i32 @upgrd.rm.llvm.ctpop.i64(i64)
-
-declare i32 @upgrd.rm.llvm.cttz.i8(i8)
-
-declare i32 @upgrd.rm.llvm.cttz.i16(i16)
-
-declare i32 @upgrd.rm.llvm.cttz.i32(i32)
-
-declare i32 @upgrd.rm.llvm.cttz.i64(i64)
-
-declare i32 @upgrd.rm.llvm.ctlz.i8(i8)
-
-declare i32 @upgrd.rm.llvm.ctlz.i16(i16)
-
-declare i32 @upgrd.rm.llvm.ctlz.i32(i32)
-
-declare i32 @upgrd.rm.llvm.ctlz.i64(i64)
-
declare float @llvm.sqrt.f32(float)
declare double @llvm.sqrt.f64(double)
@@ -437,56 +413,44 @@ define void @libm() {
call void @llvm.prefetch( i8* null, i32 1, i32 3 )
call float @llvm.sqrt.f32( float 5.000000e+00 ) ; <float>:3 [#uses=0]
call double @llvm.sqrt.f64( double 6.000000e+00 ) ; <double>:4 [#uses=0]
- call i32 @llvm.ctpop.i8( i8 10 ) ; <i32>:5 [#uses=1]
- bitcast i32 %5 to i32 ; <i32>:6 [#uses=0]
- call i32 @llvm.ctpop.i16( i16 11 ) ; <i32>:7 [#uses=1]
- bitcast i32 %7 to i32 ; <i32>:8 [#uses=0]
+ call i8 @llvm.ctpop.i8( i8 10 ) ; <i32>:5 [#uses=1]
+ call i16 @llvm.ctpop.i16( i16 11 ) ; <i32>:7 [#uses=1]
call i32 @llvm.ctpop.i32( i32 12 ) ; <i32>:9 [#uses=1]
- bitcast i32 %9 to i32 ; <i32>:10 [#uses=0]
- call i32 @llvm.ctpop.i64( i64 13 ) ; <i32>:11 [#uses=1]
- bitcast i32 %11 to i32 ; <i32>:12 [#uses=0]
- call i32 @llvm.ctlz.i8( i8 14 ) ; <i32>:13 [#uses=1]
- bitcast i32 %13 to i32 ; <i32>:14 [#uses=0]
- call i32 @llvm.ctlz.i16( i16 15 ) ; <i32>:15 [#uses=1]
- bitcast i32 %15 to i32 ; <i32>:16 [#uses=0]
+ call i64 @llvm.ctpop.i64( i64 13 ) ; <i32>:11 [#uses=1]
+ call i8 @llvm.ctlz.i8( i8 14 ) ; <i32>:13 [#uses=1]
+ call i16 @llvm.ctlz.i16( i16 15 ) ; <i32>:15 [#uses=1]
call i32 @llvm.ctlz.i32( i32 16 ) ; <i32>:17 [#uses=1]
- bitcast i32 %17 to i32 ; <i32>:18 [#uses=0]
- call i32 @llvm.ctlz.i64( i64 17 ) ; <i32>:19 [#uses=1]
- bitcast i32 %19 to i32 ; <i32>:20 [#uses=0]
- call i32 @llvm.cttz.i8( i8 18 ) ; <i32>:21 [#uses=1]
- bitcast i32 %21 to i32 ; <i32>:22 [#uses=0]
- call i32 @llvm.cttz.i16( i16 19 ) ; <i32>:23 [#uses=1]
- bitcast i32 %23 to i32 ; <i32>:24 [#uses=0]
+ call i64 @llvm.ctlz.i64( i64 17 ) ; <i32>:19 [#uses=1]
+ call i8 @llvm.cttz.i8( i8 18 ) ; <i32>:21 [#uses=1]
+ call i16 @llvm.cttz.i16( i16 19 ) ; <i32>:23 [#uses=1]
call i32 @llvm.cttz.i32( i32 20 ) ; <i32>:25 [#uses=1]
- bitcast i32 %25 to i32 ; <i32>:26 [#uses=0]
- call i32 @llvm.cttz.i64( i64 21 ) ; <i32>:27 [#uses=1]
- bitcast i32 %27 to i32 ; <i32>:28 [#uses=0]
+ call i64 @llvm.cttz.i64( i64 21 ) ; <i32>:27 [#uses=1]
ret void
}
-declare i32 @llvm.ctpop.i8(i8)
+declare i8 @llvm.ctpop.i8(i8)
-declare i32 @llvm.ctpop.i16(i16)
+declare i16 @llvm.ctpop.i16(i16)
declare i32 @llvm.ctpop.i32(i32)
-declare i32 @llvm.ctpop.i64(i64)
+declare i64 @llvm.ctpop.i64(i64)
-declare i32 @llvm.ctlz.i8(i8)
+declare i8 @llvm.ctlz.i8(i8)
-declare i32 @llvm.ctlz.i16(i16)
+declare i16 @llvm.ctlz.i16(i16)
declare i32 @llvm.ctlz.i32(i32)
-declare i32 @llvm.ctlz.i64(i64)
+declare i64 @llvm.ctlz.i64(i64)
-declare i32 @llvm.cttz.i8(i8)
+declare i8 @llvm.cttz.i8(i8)
-declare i32 @llvm.cttz.i16(i16)
+declare i16 @llvm.cttz.i16(i16)
declare i32 @llvm.cttz.i32(i32)
-declare i32 @llvm.cttz.i64(i64)
+declare i64 @llvm.cttz.i64(i64)
; ModuleID = 'packed.ll'
@foo1 = external global <4 x float> ; <<4 x float>*> [#uses=2]
diff --git a/test/Transforms/InstCombine/bitcount.ll b/test/Transforms/InstCombine/bitcount.ll
index da53920..8ebf289 100644
--- a/test/Transforms/InstCombine/bitcount.ll
+++ b/test/Transforms/InstCombine/bitcount.ll
@@ -3,15 +3,17 @@
; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
; RUN: grep -v declare | not grep llvm.ct
-declare i32 @llvm.ctpop.i31(i31 %val)
+declare i31 @llvm.ctpop.i31(i31 %val)
declare i32 @llvm.cttz.i32(i32 %val)
-declare i32 @llvm.ctlz.i33(i33 %val)
+declare i33 @llvm.ctlz.i33(i33 %val)
define i32 @test(i32 %A) {
- %c1 = call i32 @llvm.ctpop.i31(i31 12415124)
+ %c1 = call i31 @llvm.ctpop.i31(i31 12415124)
%c2 = call i32 @llvm.cttz.i32(i32 87359874)
- %c3 = call i32 @llvm.ctlz.i33(i33 87359874)
- %r1 = add i32 %c1, %c2
- %r2 = add i32 %r1, %c3
+ %c3 = call i33 @llvm.ctlz.i33(i33 87359874)
+ %t1 = zext i31 %c1 to i32
+ %t3 = trunc i33 %c3 to i32
+ %r1 = add i32 %t1, %c2
+ %r2 = add i32 %r1, %t3
ret i32 %r2
}