1 ; RUN: llvm-as < %s | llc -march=x86 -mattr=+mmx
3 ;; A basic sanity check to make sure that MMX arithmetic actually compiles.
5 define void @foo(<8 x i8>* %A, <8 x i8>* %B) {
7 %tmp1 = load <8 x i8>* %A ; <<8 x i8>> [#uses=1]
8 %tmp3 = load <8 x i8>* %B ; <<8 x i8>> [#uses=1]
9 %tmp4 = add <8 x i8> %tmp1, %tmp3 ; <<8 x i8>> [#uses=2]
10 store <8 x i8> %tmp4, <8 x i8>* %A
11 %tmp7 = load <8 x i8>* %B ; <<8 x i8>> [#uses=1]
12 %tmp12 = tail call <8 x i8> @llvm.x86.mmx.padds.b( <8 x i8> %tmp4, <8 x i8> %tmp7 ) ; <<8 x i8>> [#uses=2]
13 store <8 x i8> %tmp12, <8 x i8>* %A
14 %tmp16 = load <8 x i8>* %B ; <<8 x i8>> [#uses=1]
15 %tmp21 = tail call <8 x i8> @llvm.x86.mmx.paddus.b( <8 x i8> %tmp12, <8 x i8> %tmp16 ) ; <<8 x i8>> [#uses=2]
16 store <8 x i8> %tmp21, <8 x i8>* %A
17 %tmp27 = load <8 x i8>* %B ; <<8 x i8>> [#uses=1]
18 %tmp28 = sub <8 x i8> %tmp21, %tmp27 ; <<8 x i8>> [#uses=2]
19 store <8 x i8> %tmp28, <8 x i8>* %A
20 %tmp31 = load <8 x i8>* %B ; <<8 x i8>> [#uses=1]
21 %tmp36 = tail call <8 x i8> @llvm.x86.mmx.psubs.b( <8 x i8> %tmp28, <8 x i8> %tmp31 ) ; <<8 x i8>> [#uses=2]
22 store <8 x i8> %tmp36, <8 x i8>* %A
23 %tmp40 = load <8 x i8>* %B ; <<8 x i8>> [#uses=1]
24 %tmp45 = tail call <8 x i8> @llvm.x86.mmx.psubus.b( <8 x i8> %tmp36, <8 x i8> %tmp40 ) ; <<8 x i8>> [#uses=2]
25 store <8 x i8> %tmp45, <8 x i8>* %A
26 %tmp51 = load <8 x i8>* %B ; <<8 x i8>> [#uses=1]
27 %tmp52 = mul <8 x i8> %tmp45, %tmp51 ; <<8 x i8>> [#uses=2]
28 store <8 x i8> %tmp52, <8 x i8>* %A
29 %tmp57 = load <8 x i8>* %B ; <<8 x i8>> [#uses=1]
30 %tmp58 = and <8 x i8> %tmp52, %tmp57 ; <<8 x i8>> [#uses=2]
31 store <8 x i8> %tmp58, <8 x i8>* %A
32 %tmp63 = load <8 x i8>* %B ; <<8 x i8>> [#uses=1]
33 %tmp64 = or <8 x i8> %tmp58, %tmp63 ; <<8 x i8>> [#uses=2]
34 store <8 x i8> %tmp64, <8 x i8>* %A
35 %tmp69 = load <8 x i8>* %B ; <<8 x i8>> [#uses=1]
36 %tmp70 = xor <8 x i8> %tmp64, %tmp69 ; <<8 x i8>> [#uses=1]
37 store <8 x i8> %tmp70, <8 x i8>* %A
38 tail call void @llvm.x86.mmx.emms( )
42 define void @baz(<2 x i32>* %A, <2 x i32>* %B) {
44 %tmp1 = load <2 x i32>* %A ; <<2 x i32>> [#uses=1]
45 %tmp3 = load <2 x i32>* %B ; <<2 x i32>> [#uses=1]
46 %tmp4 = add <2 x i32> %tmp1, %tmp3 ; <<2 x i32>> [#uses=2]
47 store <2 x i32> %tmp4, <2 x i32>* %A
48 %tmp9 = load <2 x i32>* %B ; <<2 x i32>> [#uses=1]
49 %tmp10 = sub <2 x i32> %tmp4, %tmp9 ; <<2 x i32>> [#uses=2]
50 store <2 x i32> %tmp10, <2 x i32>* %A
51 %tmp15 = load <2 x i32>* %B ; <<2 x i32>> [#uses=1]
52 %tmp16 = mul <2 x i32> %tmp10, %tmp15 ; <<2 x i32>> [#uses=2]
53 store <2 x i32> %tmp16, <2 x i32>* %A
54 %tmp21 = load <2 x i32>* %B ; <<2 x i32>> [#uses=1]
55 %tmp22 = and <2 x i32> %tmp16, %tmp21 ; <<2 x i32>> [#uses=2]
56 store <2 x i32> %tmp22, <2 x i32>* %A
57 %tmp27 = load <2 x i32>* %B ; <<2 x i32>> [#uses=1]
58 %tmp28 = or <2 x i32> %tmp22, %tmp27 ; <<2 x i32>> [#uses=2]
59 store <2 x i32> %tmp28, <2 x i32>* %A
60 %tmp33 = load <2 x i32>* %B ; <<2 x i32>> [#uses=1]
61 %tmp34 = xor <2 x i32> %tmp28, %tmp33 ; <<2 x i32>> [#uses=1]
62 store <2 x i32> %tmp34, <2 x i32>* %A
63 tail call void @llvm.x86.mmx.emms( )
67 define void @bar(<4 x i16>* %A, <4 x i16>* %B) {
69 %tmp1 = load <4 x i16>* %A ; <<4 x i16>> [#uses=1]
70 %tmp3 = load <4 x i16>* %B ; <<4 x i16>> [#uses=1]
71 %tmp4 = add <4 x i16> %tmp1, %tmp3 ; <<4 x i16>> [#uses=2]
72 store <4 x i16> %tmp4, <4 x i16>* %A
73 %tmp7 = load <4 x i16>* %B ; <<4 x i16>> [#uses=1]
74 %tmp12 = tail call <4 x i16> @llvm.x86.mmx.padds.w( <4 x i16> %tmp4, <4 x i16> %tmp7 ) ; <<4 x i16>> [#uses=2]
75 store <4 x i16> %tmp12, <4 x i16>* %A
76 %tmp16 = load <4 x i16>* %B ; <<4 x i16>> [#uses=1]
77 %tmp21 = tail call <4 x i16> @llvm.x86.mmx.paddus.w( <4 x i16> %tmp12, <4 x i16> %tmp16 ) ; <<4 x i16>> [#uses=2]
78 store <4 x i16> %tmp21, <4 x i16>* %A
79 %tmp27 = load <4 x i16>* %B ; <<4 x i16>> [#uses=1]
80 %tmp28 = sub <4 x i16> %tmp21, %tmp27 ; <<4 x i16>> [#uses=2]
81 store <4 x i16> %tmp28, <4 x i16>* %A
82 %tmp31 = load <4 x i16>* %B ; <<4 x i16>> [#uses=1]
83 %tmp36 = tail call <4 x i16> @llvm.x86.mmx.psubs.w( <4 x i16> %tmp28, <4 x i16> %tmp31 ) ; <<4 x i16>> [#uses=2]
84 store <4 x i16> %tmp36, <4 x i16>* %A
85 %tmp40 = load <4 x i16>* %B ; <<4 x i16>> [#uses=1]
86 %tmp45 = tail call <4 x i16> @llvm.x86.mmx.psubus.w( <4 x i16> %tmp36, <4 x i16> %tmp40 ) ; <<4 x i16>> [#uses=2]
87 store <4 x i16> %tmp45, <4 x i16>* %A
88 %tmp51 = load <4 x i16>* %B ; <<4 x i16>> [#uses=1]
89 %tmp52 = mul <4 x i16> %tmp45, %tmp51 ; <<4 x i16>> [#uses=2]
90 store <4 x i16> %tmp52, <4 x i16>* %A
91 %tmp55 = load <4 x i16>* %B ; <<4 x i16>> [#uses=1]
92 %tmp60 = tail call <4 x i16> @llvm.x86.mmx.pmulh.w( <4 x i16> %tmp52, <4 x i16> %tmp55 ) ; <<4 x i16>> [#uses=2]
93 store <4 x i16> %tmp60, <4 x i16>* %A
94 %tmp64 = load <4 x i16>* %B ; <<4 x i16>> [#uses=1]
95 %tmp69 = tail call <2 x i32> @llvm.x86.mmx.pmadd.wd( <4 x i16> %tmp60, <4 x i16> %tmp64 ) ; <<2 x i32>> [#uses=1]
96 %tmp70 = bitcast <2 x i32> %tmp69 to <4 x i16> ; <<4 x i16>> [#uses=2]
97 store <4 x i16> %tmp70, <4 x i16>* %A
98 %tmp75 = load <4 x i16>* %B ; <<4 x i16>> [#uses=1]
99 %tmp76 = and <4 x i16> %tmp70, %tmp75 ; <<4 x i16>> [#uses=2]
100 store <4 x i16> %tmp76, <4 x i16>* %A
101 %tmp81 = load <4 x i16>* %B ; <<4 x i16>> [#uses=1]
102 %tmp82 = or <4 x i16> %tmp76, %tmp81 ; <<4 x i16>> [#uses=2]
103 store <4 x i16> %tmp82, <4 x i16>* %A
104 %tmp87 = load <4 x i16>* %B ; <<4 x i16>> [#uses=1]
105 %tmp88 = xor <4 x i16> %tmp82, %tmp87 ; <<4 x i16>> [#uses=1]
106 store <4 x i16> %tmp88, <4 x i16>* %A
107 tail call void @llvm.x86.mmx.emms( )
111 declare <8 x i8> @llvm.x86.mmx.padds.b(<8 x i8>, <8 x i8>)
113 declare <8 x i8> @llvm.x86.mmx.paddus.b(<8 x i8>, <8 x i8>)
115 declare <8 x i8> @llvm.x86.mmx.psubs.b(<8 x i8>, <8 x i8>)
117 declare <8 x i8> @llvm.x86.mmx.psubus.b(<8 x i8>, <8 x i8>)
119 declare <4 x i16> @llvm.x86.mmx.padds.w(<4 x i16>, <4 x i16>)
121 declare <4 x i16> @llvm.x86.mmx.paddus.w(<4 x i16>, <4 x i16>)
123 declare <4 x i16> @llvm.x86.mmx.psubs.w(<4 x i16>, <4 x i16>)
125 declare <4 x i16> @llvm.x86.mmx.psubus.w(<4 x i16>, <4 x i16>)
127 declare <4 x i16> @llvm.x86.mmx.pmulh.w(<4 x i16>, <4 x i16>)
129 declare <2 x i32> @llvm.x86.mmx.pmadd.wd(<4 x i16>, <4 x i16>)
131 declare void @llvm.x86.mmx.emms()