1 ; Tests to make sure intrinsics are automatically upgraded.
2 ; RUN: llvm-as < %s | llvm-dis | not grep {i32 @llvm\\.ct}
3 ; RUN: llvm-as < %s | llvm-dis | \
4 ; RUN: not grep {llvm\\.part\\.set\\.i\[0-9\]*\\.i\[0-9\]*\\.i\[0-9\]*}
5 ; RUN: llvm-as < %s | llvm-dis | \
6 ; RUN: not grep {llvm\\.part\\.select\\.i\[0-9\]*\\.i\[0-9\]*}
7 ; RUN: llvm-as < %s | llvm-dis | \
8 ; RUN: not grep {llvm\\.bswap\\.i\[0-9\]*\\.i\[0-9\]*}
9 ; RUN: llvm-as < %s | llvm-dis | \
10 ; RUN: grep {llvm\\.x86\\.mmx\\.ps} | grep {\\\<2 x i32\\\>} | count 6
12 declare i32 @llvm.ctpop.i28(i28 %val)
13 declare i32 @llvm.cttz.i29(i29 %val)
14 declare i32 @llvm.ctlz.i30(i30 %val)
16 define i32 @test_ct(i32 %A) {
17 %c1 = call i32 @llvm.ctpop.i28(i28 1234)
18 %c2 = call i32 @llvm.cttz.i29(i29 2345)
19 %c3 = call i32 @llvm.ctlz.i30(i30 3456)
20 %r1 = add i32 %c1, %c2
21 %r2 = add i32 %r1, %c3
25 declare i32 @llvm.part.set.i32.i32.i32(i32 %x, i32 %rep, i32 %hi, i32 %lo)
26 declare i16 @llvm.part.set.i16.i16.i16(i16 %x, i16 %rep, i32 %hi, i32 %lo)
27 define i32 @test_part_set(i32 %A, i16 %B) {
28 %a = call i32 @llvm.part.set.i32.i32.i32(i32 %A, i32 27, i32 8, i32 0)
29 %b = call i16 @llvm.part.set.i16.i16.i16(i16 %B, i16 27, i32 8, i32 0)
30 %c = zext i16 %b to i32
35 declare i32 @llvm.part.select.i32.i32(i32 %x, i32 %hi, i32 %lo)
36 declare i16 @llvm.part.select.i16.i16(i16 %x, i32 %hi, i32 %lo)
37 define i32 @test_part_select(i32 %A, i16 %B) {
38 %a = call i32 @llvm.part.select.i32.i32(i32 %A, i32 8, i32 0)
39 %b = call i16 @llvm.part.select.i16.i16(i16 %B, i32 8, i32 0)
40 %c = zext i16 %b to i32
45 declare i32 @llvm.bswap.i32.i32(i32 %x)
46 declare i16 @llvm.bswap.i16.i16(i16 %x)
47 define i32 @test_bswap(i32 %A, i16 %B) {
48 %a = call i32 @llvm.bswap.i32.i32(i32 %A)
49 %b = call i16 @llvm.bswap.i16.i16(i16 %B)
50 %c = zext i16 %b to i32
55 declare <4 x i16> @llvm.x86.mmx.psra.w(<4 x i16>, <2 x i32>) nounwind readnone
56 declare <4 x i16> @llvm.x86.mmx.psll.w(<4 x i16>, <2 x i32>) nounwind readnone
57 declare <4 x i16> @llvm.x86.mmx.psrl.w(<4 x i16>, <2 x i32>) nounwind readnone
58 define void @sh16(<4 x i16> %A, <2 x i32> %B) {
59 %r1 = call <4 x i16> @llvm.x86.mmx.psra.w( <4 x i16> %A, <2 x i32> %B ) ; <<4 x i16>> [#uses=0]
60 %r2 = call <4 x i16> @llvm.x86.mmx.psll.w( <4 x i16> %A, <2 x i32> %B ) ; <<4 x i16>> [#uses=0]
61 %r3 = call <4 x i16> @llvm.x86.mmx.psrl.w( <4 x i16> %A, <2 x i32> %B ) ; <<4 x i16>> [#uses=0]
65 declare <2 x i32> @llvm.x86.mmx.psra.d(<2 x i32>, <2 x i32>) nounwind readnone
66 declare <2 x i32> @llvm.x86.mmx.psll.d(<2 x i32>, <2 x i32>) nounwind readnone
67 declare <2 x i32> @llvm.x86.mmx.psrl.d(<2 x i32>, <2 x i32>) nounwind readnone
68 define void @sh32(<2 x i32> %A, <2 x i32> %B) {
69 %r1 = call <2 x i32> @llvm.x86.mmx.psra.d( <2 x i32> %A, <2 x i32> %B ) ; <<2 x i32>> [#uses=0]
70 %r2 = call <2 x i32> @llvm.x86.mmx.psll.d( <2 x i32> %A, <2 x i32> %B ) ; <<2 x i32>> [#uses=0]
71 %r3 = call <2 x i32> @llvm.x86.mmx.psrl.d( <2 x i32> %A, <2 x i32> %B ) ; <<2 x i32>> [#uses=0]
75 declare <1 x i64> @llvm.x86.mmx.psll.q(<1 x i64>, <2 x i32>) nounwind readnone
76 declare <1 x i64> @llvm.x86.mmx.psrl.q(<1 x i64>, <2 x i32>) nounwind readnone
77 define void @sh64(<1 x i64> %A, <2 x i32> %B) {
78 %r1 = call <1 x i64> @llvm.x86.mmx.psll.q( <1 x i64> %A, <2 x i32> %B ) ; <<1 x i64>> [#uses=0]
79 %r2 = call <1 x i64> @llvm.x86.mmx.psrl.q( <1 x i64> %A, <2 x i32> %B ) ; <<1 x i64>> [#uses=0]