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 x86_mmx, ptr %p
12 %u = tail call x86_mmx @llvm.x86.mmx.padd.q(x86_mmx %t, x86_mmx %t)
13 %s = bitcast x86_mmx %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 x86_mmx, ptr %p
25 %u = tail call x86_mmx @llvm.x86.mmx.padd.d(x86_mmx %t, x86_mmx %t)
26 %s = bitcast x86_mmx %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 x86_mmx, ptr %p
38 %u = tail call x86_mmx @llvm.x86.mmx.padd.w(x86_mmx %t, x86_mmx %t)
39 %s = bitcast x86_mmx %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 x86_mmx, ptr %p
51 %u = tail call x86_mmx @llvm.x86.mmx.padd.b(x86_mmx %t, x86_mmx %t)
52 %s = bitcast x86_mmx %u to i64
56 @R = external global x86_mmx
58 define void @t4(<1 x i64> %A, <1 x i64> %B) {
60 ; CHECK: ## %bb.0: ## %entry
61 ; CHECK-NEXT: movq %rdi, %mm0
62 ; CHECK-NEXT: movq %rsi, %mm1
63 ; CHECK-NEXT: paddusw %mm0, %mm1
64 ; CHECK-NEXT: movq _R@GOTPCREL(%rip), %rax
65 ; CHECK-NEXT: movq %mm1, (%rax)
69 %tmp2 = bitcast <1 x i64> %A to x86_mmx
70 %tmp3 = bitcast <1 x i64> %B to x86_mmx
71 %tmp7 = tail call x86_mmx @llvm.x86.mmx.paddus.w(x86_mmx %tmp2, x86_mmx %tmp3)
72 store x86_mmx %tmp7, ptr @R
73 tail call void @llvm.x86.mmx.emms()
77 define i64 @t5(i32 %a, i32 %b) nounwind readnone {
80 ; CHECK-NEXT: movd %esi, %xmm0
81 ; CHECK-NEXT: movd %edi, %xmm1
82 ; CHECK-NEXT: punpckldq {{.*#+}} xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
83 ; CHECK-NEXT: movq %xmm1, %rax
85 %v0 = insertelement <2 x i32> undef, i32 %a, i32 0
86 %v1 = insertelement <2 x i32> %v0, i32 %b, i32 1
87 %conv = bitcast <2 x i32> %v1 to i64
91 declare x86_mmx @llvm.x86.mmx.pslli.q(x86_mmx, i32)
93 define <1 x i64> @t6(i64 %t) {
96 ; CHECK-NEXT: movq %rdi, %mm0
97 ; CHECK-NEXT: psllq $48, %mm0
98 ; CHECK-NEXT: movq %mm0, %rax
100 %t1 = insertelement <1 x i64> undef, i64 %t, i32 0
101 %t0 = bitcast <1 x i64> %t1 to x86_mmx
102 %t2 = tail call x86_mmx @llvm.x86.mmx.pslli.q(x86_mmx %t0, i32 48)
103 %t3 = bitcast x86_mmx %t2 to <1 x i64>
107 declare x86_mmx @llvm.x86.mmx.paddus.w(x86_mmx, x86_mmx)
108 declare x86_mmx @llvm.x86.mmx.padd.b(x86_mmx, x86_mmx)
109 declare x86_mmx @llvm.x86.mmx.padd.w(x86_mmx, x86_mmx)
110 declare x86_mmx @llvm.x86.mmx.padd.d(x86_mmx, x86_mmx)
111 declare x86_mmx @llvm.x86.mmx.padd.q(x86_mmx, x86_mmx)
112 declare void @llvm.x86.mmx.emms()