xref: /llvm-project/llvm/test/CodeGen/X86/MachineSink-eflags.ll (revision 02ba5b8c6b9f0c1ce6df421db5dd5eb307d7d27d)
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s | FileCheck %s
3target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
4target triple = "x86_64-pc-linux"
5
6
7%0 = type <{ i64, i64, %1, %1, [21 x %2] }>
8%1 = type <{ i64, i64, i64 }>
9%2 = type <{ i32, i32, ptr addrspace(2) }>
10%3 = type { ptr, ptr, ptr, ptr, i32 }
11%4 = type <{ ptr, ptr, i32, i32, [4 x i64], [4 x i64], [4 x i64], [4 x i64], [4 x i64] }>
12%5 = type <{ ptr, ptr, ptr }>
13
14define void @foo(ptr nocapture %_stubArgs) nounwind {
15; CHECK-LABEL: foo:
16; CHECK:       # %bb.0: # %entry
17; CHECK-NEXT:    movq 48(%rdi), %rax
18; CHECK-NEXT:    movl 64(%rdi), %ecx
19; CHECK-NEXT:    movl $200, %esi
20; CHECK-NEXT:    addl 68(%rdi), %esi
21; CHECK-NEXT:    imull $46, %ecx, %edx
22; CHECK-NEXT:    addq %rsi, %rdx
23; CHECK-NEXT:    shlq $4, %rdx
24; CHECK-NEXT:    imull $47, %ecx, %ecx
25; CHECK-NEXT:    addq %rsi, %rcx
26; CHECK-NEXT:    shlq $4, %rcx
27; CHECK-NEXT:    cmpl $0, (%rdi)
28; CHECK-NEXT:    jne .LBB0_1
29; CHECK-NEXT:  # %bb.2: # %entry
30; CHECK-NEXT:    xorps %xmm0, %xmm0
31; CHECK-NEXT:    jmp .LBB0_3
32; CHECK-NEXT:  .LBB0_1:
33; CHECK-NEXT:    movaps (%rax,%rdx), %xmm0
34; CHECK-NEXT:  .LBB0_3: # %entry
35; CHECK-NEXT:    leaq -{{[0-9]+}}(%rsp), %rsp
36; CHECK-NEXT:    movaps (%rax,%rcx), %xmm1
37; CHECK-NEXT:    movaps %xmm0, -{{[0-9]+}}(%rsp)
38; CHECK-NEXT:    jne .LBB0_5
39; CHECK-NEXT:  # %bb.4: # %entry
40; CHECK-NEXT:    xorps %xmm1, %xmm1
41; CHECK-NEXT:  .LBB0_5: # %entry
42; CHECK-NEXT:    movaps %xmm1, -{{[0-9]+}}(%rsp)
43; CHECK-NEXT:    addq $152, %rsp
44; CHECK-NEXT:    retq
45entry:
46 %i0 = alloca ptr, align 8
47 %i2 = alloca ptr, align 8
48 %b.i = alloca [16 x <2 x double>], align 16
49 %tmp1 = load i32, ptr %_stubArgs, align 4
50 %ptr8 = getelementptr i8, ptr %_stubArgs, i64 16
51 %ptr20 = getelementptr i8, ptr %_stubArgs, i64 48
52 %tmp21 = load ptr addrspace(1), ptr %ptr20, align 8
53 %ptr28 = getelementptr i8, ptr %_stubArgs, i64 64
54 %tmp29 = load i32, ptr %ptr28, align 4
55 %ptr32 = getelementptr i8, ptr %_stubArgs, i64 68
56 %tmp33 = load i32, ptr %ptr32, align 4
57 %tmp17.i = mul i32 10, 20
58 %tmp19.i = add i32 %tmp17.i, %tmp33
59 %conv21.i = zext i32 %tmp19.i to i64
60 %tmp6.i = and i32 42, -32
61 %tmp42.i = add i32 %tmp6.i, 17
62 %tmp44.i = insertelement <2 x i32> undef, i32 %tmp42.i, i32 1
63 %tmp96676677.i = or i32 17, -4
64 %arrayidx4506.i = getelementptr [16 x <2 x double>], ptr %b.i, i64 0, i64 4
65 %tmp52.i = insertelement <2 x i32> %tmp44.i, i32 0, i32 0
66 %tmp78.i = extractelement <2 x i32> %tmp44.i, i32 1
67 %tmp97.i = add i32 %tmp78.i, %tmp96676677.i
68 %tmp99.i = insertelement <2 x i32> %tmp52.i, i32 %tmp97.i, i32 1
69 %tmp154.i = extractelement <2 x i32> %tmp99.i, i32 1
70 %tmp156.i = extractelement <2 x i32> %tmp52.i, i32 0
71 %tmp158.i = urem i32 %tmp156.i, %tmp1
72 %i38 = mul i32 %tmp154.i, %tmp29
73 %i39 = add i32 %tmp158.i, %i38
74 %conv160.i = zext i32 %i39 to i64
75 %tmp22.sum652.i = add i64 %conv160.i, %conv21.i
76 %arrayidx161.i = getelementptr <2 x double>, ptr addrspace(1) %tmp21, i64 %tmp22.sum652.i
77 %tmp162.i = load <2 x double>, ptr addrspace(1) %arrayidx161.i, align 16
78 %tmp222.i = add i32 %tmp154.i, 1
79 %i43 = mul i32 %tmp222.i, %tmp29
80 %i44 = add i32 %tmp158.i, %i43
81 %conv228.i = zext i32 %i44 to i64
82 %tmp22.sum656.i = add i64 %conv228.i, %conv21.i
83 %arrayidx229.i = getelementptr <2 x double>, ptr addrspace(1) %tmp21, i64 %tmp22.sum656.i
84 %tmp230.i = load <2 x double>, ptr addrspace(1) %arrayidx229.i, align 16
85 %cmp432.i = icmp ult i32 %tmp156.i, %tmp1
86
87; %shl.i should not be sinked below the compare.
88
89 %cond.i = select i1 %cmp432.i, <2 x double> %tmp162.i, <2 x double> zeroinitializer
90 store <2 x double> %cond.i, ptr %b.i, align 16
91 %cond448.i = select i1 %cmp432.i, <2 x double> %tmp230.i, <2 x double> zeroinitializer
92 store <2 x double> %cond448.i, ptr %arrayidx4506.i, align 16
93  ret void
94}
95
96
97
98