1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -verify-machineinstrs -mtriple=i386--netbsd < %s | FileCheck %s
4 ; Regression test for http://reviews.llvm.org/D5701
6 %struct.XXH_state64_t = type { i32, i32, i64, i64, i64 }
8 @a = common global i32 0, align 4
9 @b = common global i64 0, align 8
11 ; Function Attrs: nounwind uwtable
12 define i64 @fn1() #0 {
14 ; CHECK: # %bb.0: # %entry
15 ; CHECK-NEXT: pushl %ebp
16 ; CHECK-NEXT: .cfi_def_cfa_offset 8
17 ; CHECK-NEXT: .cfi_offset %ebp, -8
18 ; CHECK-NEXT: movl %esp, %ebp
19 ; CHECK-NEXT: .cfi_def_cfa_register %ebp
20 ; CHECK-NEXT: pushl %ebx
21 ; CHECK-NEXT: pushl %edi
22 ; CHECK-NEXT: pushl %esi
23 ; CHECK-NEXT: subl $12, %esp
24 ; CHECK-NEXT: .cfi_offset %esi, -20
25 ; CHECK-NEXT: .cfi_offset %edi, -16
26 ; CHECK-NEXT: .cfi_offset %ebx, -12
27 ; CHECK-NEXT: movl $-1028477379, %ebx # imm = 0xC2B2AE3D
28 ; CHECK-NEXT: movl $668265295, %ecx # imm = 0x27D4EB4F
29 ; CHECK-NEXT: movl a, %edi
30 ; CHECK-NEXT: cmpl $0, (%edi)
31 ; CHECK-NEXT: je .LBB0_2
32 ; CHECK-NEXT: # %bb.1: # %if.then
33 ; CHECK-NEXT: movl 8(%edi), %esi
34 ; CHECK-NEXT: movl 12(%edi), %eax
35 ; CHECK-NEXT: movl %eax, %edx
36 ; CHECK-NEXT: shldl $1, %esi, %edx
37 ; CHECK-NEXT: orl %eax, %edx
38 ; CHECK-NEXT: leal (%esi,%esi), %eax
39 ; CHECK-NEXT: orl %esi, %eax
40 ; CHECK-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
41 ; CHECK-NEXT: movl 16(%edi), %ebx
42 ; CHECK-NEXT: movl 20(%edi), %esi
43 ; CHECK-NEXT: movl %esi, %eax
44 ; CHECK-NEXT: shldl $2, %ebx, %eax
45 ; CHECK-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
46 ; CHECK-NEXT: movl %ebx, %eax
47 ; CHECK-NEXT: movl %esi, %ebx
48 ; CHECK-NEXT: shldl $31, %eax, %ebx
49 ; CHECK-NEXT: shll $2, %eax
50 ; CHECK-NEXT: orl %ebx, %eax
51 ; CHECK-NEXT: shrl %esi
52 ; CHECK-NEXT: orl {{[-0-9]+}}(%e{{[sb]}}p), %esi # 4-byte Folded Reload
53 ; CHECK-NEXT: addl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 4-byte Folded Reload
54 ; CHECK-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
55 ; CHECK-NEXT: adcl %edx, %esi
56 ; CHECK-NEXT: movl %esi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
57 ; CHECK-NEXT: movl 24(%edi), %eax
58 ; CHECK-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
59 ; CHECK-NEXT: movl $-1028477379, %ebx # imm = 0xC2B2AE3D
60 ; CHECK-NEXT: imull %eax, %ebx
61 ; CHECK-NEXT: mull %ecx
62 ; CHECK-NEXT: movl %eax, %esi
63 ; CHECK-NEXT: addl %ebx, %edx
64 ; CHECK-NEXT: movl 28(%edi), %edi
65 ; CHECK-NEXT: imull %edi, %ecx
66 ; CHECK-NEXT: addl %edx, %ecx
67 ; CHECK-NEXT: movl $1336530590, %edx # imm = 0x4FA9D69E
68 ; CHECK-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ebx # 4-byte Reload
69 ; CHECK-NEXT: movl %ebx, %eax
70 ; CHECK-NEXT: mull %edx
71 ; CHECK-NEXT: imull $-2056954758, %ebx, %ebx # imm = 0x85655C7A
72 ; CHECK-NEXT: addl %edx, %ebx
73 ; CHECK-NEXT: imull $1336530590, %edi, %edx # imm = 0x4FA9D69E
74 ; CHECK-NEXT: addl %ebx, %edx
75 ; CHECK-NEXT: shrdl $3, %ecx, %esi
76 ; CHECK-NEXT: sarl $3, %ecx
77 ; CHECK-NEXT: orl %edx, %ecx
78 ; CHECK-NEXT: orl %eax, %esi
79 ; CHECK-NEXT: movl $-66860409, %ebx # imm = 0xFC03CA87
80 ; CHECK-NEXT: movl %esi, %eax
81 ; CHECK-NEXT: mull %ebx
82 ; CHECK-NEXT: movl %eax, %edi
83 ; CHECK-NEXT: imull $326129324, %esi, %eax # imm = 0x137056AC
84 ; CHECK-NEXT: addl %edx, %eax
85 ; CHECK-NEXT: imull $-66860409, %ecx, %ecx # imm = 0xFC03CA87
86 ; CHECK-NEXT: addl %eax, %ecx
87 ; CHECK-NEXT: xorl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Folded Reload
88 ; CHECK-NEXT: xorl {{[-0-9]+}}(%e{{[sb]}}p), %edi # 4-byte Folded Reload
89 ; CHECK-NEXT: movl %edi, b
90 ; CHECK-NEXT: movl %edi, %eax
91 ; CHECK-NEXT: mull %ebx
92 ; CHECK-NEXT: imull $326129324, %edi, %esi # imm = 0x137056AC
93 ; CHECK-NEXT: addl %edx, %esi
94 ; CHECK-NEXT: movl %ecx, b+4
95 ; CHECK-NEXT: imull $-66860409, %ecx, %ecx # imm = 0xFC03CA87
96 ; CHECK-NEXT: jmp .LBB0_3
97 ; CHECK-NEXT: .LBB0_2: # %if.else
98 ; CHECK-NEXT: xorl b+4, %ebx
99 ; CHECK-NEXT: xorl b, %ecx
100 ; CHECK-NEXT: movl $1419758215, %edx # imm = 0x549FCA87
101 ; CHECK-NEXT: movl %ecx, %eax
102 ; CHECK-NEXT: mull %edx
103 ; CHECK-NEXT: imull $93298681, %ecx, %esi # imm = 0x58F9FF9
104 ; CHECK-NEXT: addl %edx, %esi
105 ; CHECK-NEXT: imull $1419758215, %ebx, %ecx # imm = 0x549FCA87
106 ; CHECK-NEXT: .LBB0_3: # %if.end
107 ; CHECK-NEXT: addl %esi, %ecx
108 ; CHECK-NEXT: addl $-1028477341, %eax # imm = 0xC2B2AE63
109 ; CHECK-NEXT: adcl $-2048144777, %ecx # imm = 0x85EBCA77
110 ; CHECK-NEXT: movl %eax, b
111 ; CHECK-NEXT: movl %ecx, b+4
112 ; CHECK-NEXT: addl $12, %esp
113 ; CHECK-NEXT: popl %esi
114 ; CHECK-NEXT: popl %edi
115 ; CHECK-NEXT: popl %ebx
116 ; CHECK-NEXT: popl %ebp
117 ; CHECK-NEXT: .cfi_def_cfa %esp, 4
120 %0 = load i32, ptr @a, align 4, !tbaa !1
121 %1 = inttoptr i32 %0 to ptr
122 %2 = load i32, ptr %1, align 4, !tbaa !5
123 %tobool = icmp eq i32 %2, 0
124 br i1 %tobool, label %if.else, label %if.then
126 if.then: ; preds = %entry
127 %v3 = getelementptr inbounds %struct.XXH_state64_t, ptr %1, i32 0, i32 3
128 %3 = load i64, ptr %v3, align 4, !tbaa !8
129 %v4 = getelementptr inbounds %struct.XXH_state64_t, ptr %1, i32 0, i32 4
130 %4 = load i64, ptr %v4, align 4, !tbaa !9
131 %v2 = getelementptr inbounds %struct.XXH_state64_t, ptr %1, i32 0, i32 2
132 %5 = load i64, ptr %v2, align 4, !tbaa !10
134 %or = or i64 %shl, %5
135 %shl2 = shl i64 %3, 2
136 %shr = lshr i64 %3, 1
137 %or3 = or i64 %shl2, %shr
138 %add = add i64 %or, %or3
139 %mul = mul i64 %4, -4417276706812531889
140 %shl4 = mul i64 %4, -8834553413625063778
141 %shr5 = ashr i64 %mul, 3
142 %or6 = or i64 %shr5, %shl4
143 %mul7 = mul nsw i64 %or6, 1400714785074694791
144 %xor = xor i64 %add, %mul7
145 store i64 %xor, ptr @b, align 8, !tbaa !11
146 %mul8 = mul nsw i64 %xor, 1400714785074694791
149 if.else: ; preds = %entry
150 %6 = load i64, ptr @b, align 8, !tbaa !11
151 %xor10 = xor i64 %6, -4417276706812531889
152 %mul11 = mul nsw i64 %xor10, 400714785074694791
155 if.end: ; preds = %if.else, %if.then
156 %storemerge.in = phi i64 [ %mul11, %if.else ], [ %mul8, %if.then ]
157 %storemerge = add i64 %storemerge.in, -8796714831421723037
158 store i64 %storemerge, ptr @b, align 8, !tbaa !11
162 attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
166 !0 = !{!"clang version 3.6 (trunk 219587)"}
167 !1 = !{!2, !2, i64 0}
168 !2 = !{!"int", !3, i64 0}
169 !3 = !{!"omnipotent char", !4, i64 0}
170 !4 = !{!"Simple C/C++ TBAA"}
171 !5 = !{!6, !2, i64 0}
172 !6 = !{!"XXH_state64_t", !2, i64 0, !2, i64 4, !7, i64 8, !7, i64 16, !7, i64 24}
173 !7 = !{!"long long", !3, i64 0}
174 !8 = !{!6, !7, i64 16}
175 !9 = !{!6, !7, i64 24}
176 !10 = !{!6, !7, i64 8}
177 !11 = !{!7, !7, i64 0}