1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-darwin -mattr=+mmx,+sse2 | FileCheck %s
4 define i64 @t0(ptr %p) {
7 ; CHECK-NEXT: movq (%rdi), %mm0
8 ; CHECK-NEXT: paddq %mm0, %mm0
9 ; CHECK-NEXT: movq %mm0, %rax
11 %t = load <1 x i64>, ptr %p
12 %u = tail call <1 x i64> @llvm.x86.mmx.padd.q(<1 x i64> %t, <1 x i64> %t)
13 %s = bitcast <1 x i64> %u to i64
17 define i64 @t1(ptr %p) {
20 ; CHECK-NEXT: movq (%rdi), %mm0
21 ; CHECK-NEXT: paddd %mm0, %mm0
22 ; CHECK-NEXT: movq %mm0, %rax
24 %t = load <1 x i64>, ptr %p
25 %u = tail call <1 x i64> @llvm.x86.mmx.padd.d(<1 x i64> %t, <1 x i64> %t)
26 %s = bitcast <1 x i64> %u to i64
30 define i64 @t2(ptr %p) {
33 ; CHECK-NEXT: movq (%rdi), %mm0
34 ; CHECK-NEXT: paddw %mm0, %mm0
35 ; CHECK-NEXT: movq %mm0, %rax
37 %t = load <1 x i64>, ptr %p
38 %u = tail call <1 x i64> @llvm.x86.mmx.padd.w(<1 x i64> %t, <1 x i64> %t)
39 %s = bitcast <1 x i64> %u to i64
43 define i64 @t3(ptr %p) {
46 ; CHECK-NEXT: movq (%rdi), %mm0
47 ; CHECK-NEXT: paddb %mm0, %mm0
48 ; CHECK-NEXT: movq %mm0, %rax
50 %t = load <1 x i64>, ptr %p
51 %u = tail call <1 x i64> @llvm.x86.mmx.padd.b(<1 x i64> %t, <1 x i64> %t)
52 %s = bitcast <1 x i64> %u to i64
56 @R = external global <1 x i64>
58 define void @t4(<1 x i64> %A, <1 x i64> %B) {
60 ; CHECK: ## %bb.0: ## %entry
61 ; CHECK-NEXT: movq %rsi, %mm0
62 ; CHECK-NEXT: movq %rdi, %mm1
63 ; CHECK-NEXT: paddusw %mm0, %mm1
64 ; CHECK-NEXT: movq _R@GOTPCREL(%rip), %rax
65 ; CHECK-NEXT: movq %mm1, (%rax)
69 %tmp7 = tail call <1 x i64> @llvm.x86.mmx.paddus.w(<1 x i64> %A, <1 x i64> %B)
70 store <1 x i64> %tmp7, ptr @R
71 tail call void @llvm.x86.mmx.emms()
75 define i64 @t5(i32 %a, i32 %b) nounwind readnone {
78 ; CHECK-NEXT: movd %esi, %xmm0
79 ; CHECK-NEXT: movd %edi, %xmm1
80 ; CHECK-NEXT: punpckldq {{.*#+}} xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
81 ; CHECK-NEXT: movq %xmm1, %rax
83 %v0 = insertelement <2 x i32> undef, i32 %a, i32 0
84 %v1 = insertelement <2 x i32> %v0, i32 %b, i32 1
85 %conv = bitcast <2 x i32> %v1 to i64
89 declare <1 x i64> @llvm.x86.mmx.pslli.q(<1 x i64>, i32)
91 define <1 x i64> @t6(i64 %t) {
94 ; CHECK-NEXT: movq %rdi, %mm0
95 ; CHECK-NEXT: psllq $48, %mm0
96 ; CHECK-NEXT: movq %mm0, %rax
98 %t1 = insertelement <1 x i64> undef, i64 %t, i32 0
99 %t2 = tail call <1 x i64> @llvm.x86.mmx.pslli.q(<1 x i64> %t1, i32 48)
103 declare <1 x i64> @llvm.x86.mmx.paddus.w(<1 x i64>, <1 x i64>)
104 declare <1 x i64> @llvm.x86.mmx.padd.b(<1 x i64>, <1 x i64>)
105 declare <1 x i64> @llvm.x86.mmx.padd.w(<1 x i64>, <1 x i64>)
106 declare <1 x i64> @llvm.x86.mmx.padd.d(<1 x i64>, <1 x i64>)
107 declare <1 x i64> @llvm.x86.mmx.padd.q(<1 x i64>, <1 x i64>)
108 declare void @llvm.x86.mmx.emms()