1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+mmx,+sse2 | FileCheck %s
4 %SA = type <{ %union.anon, i32, [4 x i8], i8*, i8*, i8*, i32, [4 x i8] }>
5 %union.anon = type { <1 x i64> }
7 ; Check that extra movd (copy) instructions aren't generated.
9 define i32 @test(%SA* %pSA, i16* %A, i32 %B, i32 %C, i32 %D, i8* %E) {
11 ; CHECK: # %bb.0: # %entry
12 ; CHECK-NEXT: pshufw $238, (%rdi), %mm0 # mm0 = mem[2,3,2,3]
13 ; CHECK-NEXT: movd %mm0, %eax
14 ; CHECK-NEXT: testl %eax, %eax
15 ; CHECK-NEXT: je .LBB0_1
16 ; CHECK-NEXT: # %bb.2: # %if.B
17 ; CHECK-NEXT: pshufw $238, %mm0, %mm0 # mm0 = mm0[2,3,2,3]
18 ; CHECK-NEXT: movq %mm0, %rax
19 ; CHECK-NEXT: testl %eax, %eax
20 ; CHECK-NEXT: jne .LBB0_4
21 ; CHECK-NEXT: .LBB0_1: # %if.A
22 ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1
23 ; CHECK-NEXT: movd %edx, %mm1
24 ; CHECK-NEXT: psllq %mm1, %mm0
25 ; CHECK-NEXT: movq %mm0, %rax
26 ; CHECK-NEXT: testq %rax, %rax
27 ; CHECK-NEXT: jne .LBB0_4
28 ; CHECK-NEXT: # %bb.3: # %if.C
29 ; CHECK-NEXT: # in Loop: Header=BB0_1 Depth=1
30 ; CHECK-NEXT: testl %eax, %eax
31 ; CHECK-NEXT: je .LBB0_1
32 ; CHECK-NEXT: .LBB0_4: # %merge
33 ; CHECK-NEXT: pshufw $238, %mm0, %mm0 # mm0 = mm0[2,3,2,3]
34 ; CHECK-NEXT: movd %mm0, %eax
38 %shl1 = shl i32 %C, %B
40 %v = getelementptr inbounds %SA, %SA* %pSA, i64 0, i32 0, i32 0
41 %v0 = load <1 x i64>, <1 x i64>* %v, align 8
42 %SA0 = getelementptr inbounds %SA, %SA* %pSA, i64 0, i32 1
43 %v1 = load i32, i32* %SA0, align 4
44 %SA1 = getelementptr inbounds %SA, %SA* %pSA, i64 0, i32 3
45 %v2 = load i8*, i8** %SA1, align 8
46 %SA2 = getelementptr inbounds %SA, %SA* %pSA, i64 0, i32 4
47 %v3 = load i8*, i8** %SA2, align 8
48 %v4 = bitcast <1 x i64> %v0 to <4 x i16>
49 %v5 = bitcast <4 x i16> %v4 to x86_mmx
50 %v6 = tail call x86_mmx @llvm.x86.sse.pshuf.w(x86_mmx %v5, i8 -18)
51 %v7 = bitcast x86_mmx %v6 to <4 x i16>
52 %v8 = bitcast <4 x i16> %v7 to <1 x i64>
53 %v9 = extractelement <1 x i64> %v8, i32 0
54 %v10 = bitcast i64 %v9 to <2 x i32>
55 %v11 = extractelement <2 x i32> %v10, i32 0
56 %cmp = icmp eq i32 %v11, 0
57 br i1 %cmp, label %if.A, label %if.B
60 %pa = phi <1 x i64> [ %v8, %entry ], [ %vx, %if.C ]
61 %v17 = extractelement <1 x i64> %pa, i32 0
62 %v18 = bitcast i64 %v17 to x86_mmx
63 %v19 = tail call x86_mmx @llvm.x86.mmx.pslli.q(x86_mmx %v18, i32 %B) #2
64 %v20 = bitcast x86_mmx %v19 to i64
65 %v21 = insertelement <1 x i64> undef, i64 %v20, i32 0
66 %cmp3 = icmp eq i64 %v20, 0
67 br i1 %cmp3, label %if.C, label %merge
70 %v34 = bitcast <1 x i64> %v8 to <4 x i16>
71 %v35 = bitcast <4 x i16> %v34 to x86_mmx
72 %v36 = tail call x86_mmx @llvm.x86.sse.pshuf.w(x86_mmx %v35, i8 -18)
73 %v37 = bitcast x86_mmx %v36 to <4 x i16>
74 %v38 = bitcast <4 x i16> %v37 to <1 x i64>
78 %vx = phi <1 x i64> [ %v21, %if.A ], [ %v38, %if.B ]
79 %cvt = bitcast <1 x i64> %vx to <2 x i32>
80 %ex = extractelement <2 x i32> %cvt, i32 0
81 %cmp2 = icmp eq i32 %ex, 0
82 br i1 %cmp2, label %if.A, label %merge
85 %vy = phi <1 x i64> [ %v21, %if.A ], [ %vx, %if.C ]
86 %v130 = bitcast <1 x i64> %vy to <4 x i16>
87 %v131 = bitcast <4 x i16> %v130 to x86_mmx
88 %v132 = tail call x86_mmx @llvm.x86.sse.pshuf.w(x86_mmx %v131, i8 -18)
89 %v133 = bitcast x86_mmx %v132 to <4 x i16>
90 %v134 = bitcast <4 x i16> %v133 to <1 x i64>
91 %v135 = extractelement <1 x i64> %v134, i32 0
92 %v136 = bitcast i64 %v135 to <2 x i32>
93 %v137 = extractelement <2 x i32> %v136, i32 0
98 declare x86_mmx @llvm.x86.sse.pshuf.w(x86_mmx, i8)
99 declare x86_mmx @llvm.x86.mmx.pslli.q(x86_mmx, i32)