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, %ecx # imm = 0xC2B2AE3D
28 ; CHECK-NEXT: movl $668265295, %esi # 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), %ecx
34 ; CHECK-NEXT: movl 12(%edi), %edx
35 ; CHECK-NEXT: movl %edx, %eax
36 ; CHECK-NEXT: shldl $1, %ecx, %eax
37 ; CHECK-NEXT: orl %edx, %eax
38 ; CHECK-NEXT: leal (%ecx,%ecx), %edx
39 ; CHECK-NEXT: orl %ecx, %edx
40 ; CHECK-NEXT: movl %edx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
41 ; CHECK-NEXT: movl 16(%edi), %ebx
42 ; CHECK-NEXT: movl 20(%edi), %edx
43 ; CHECK-NEXT: movl %edx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
44 ; CHECK-NEXT: shldl $2, %ebx, %edx
45 ; CHECK-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
46 ; CHECK-NEXT: shldl $31, %ebx, %ecx
47 ; CHECK-NEXT: shll $2, %ebx
48 ; CHECK-NEXT: orl %ecx, %ebx
49 ; CHECK-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
50 ; CHECK-NEXT: shrl %ecx
51 ; CHECK-NEXT: orl %edx, %ecx
52 ; CHECK-NEXT: addl {{[-0-9]+}}(%e{{[sb]}}p), %ebx # 4-byte Folded Reload
53 ; CHECK-NEXT: movl %ebx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
54 ; CHECK-NEXT: adcl %eax, %ecx
55 ; CHECK-NEXT: movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
56 ; CHECK-NEXT: movl 24(%edi), %eax
57 ; CHECK-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
58 ; CHECK-NEXT: movl $-1028477379, %ebx # imm = 0xC2B2AE3D
59 ; CHECK-NEXT: imull %eax, %ebx
60 ; CHECK-NEXT: mull %esi
61 ; CHECK-NEXT: movl %eax, %ecx
62 ; CHECK-NEXT: addl %ebx, %edx
63 ; CHECK-NEXT: movl 28(%edi), %edi
64 ; CHECK-NEXT: imull %edi, %esi
65 ; CHECK-NEXT: addl %edx, %esi
66 ; CHECK-NEXT: movl $1336530590, %edx # imm = 0x4FA9D69E
67 ; CHECK-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %ebx # 4-byte Reload
68 ; CHECK-NEXT: movl %ebx, %eax
69 ; CHECK-NEXT: mull %edx
70 ; CHECK-NEXT: imull $-2056954758, %ebx, %ebx # imm = 0x85655C7A
71 ; CHECK-NEXT: addl %edx, %ebx
72 ; CHECK-NEXT: imull $1336530590, %edi, %edx # imm = 0x4FA9D69E
73 ; CHECK-NEXT: addl %ebx, %edx
74 ; CHECK-NEXT: shrdl $3, %esi, %ecx
75 ; CHECK-NEXT: sarl $3, %esi
76 ; CHECK-NEXT: orl %edx, %esi
77 ; CHECK-NEXT: orl %eax, %ecx
78 ; CHECK-NEXT: movl $-66860409, %ebx # imm = 0xFC03CA87
79 ; CHECK-NEXT: movl %ecx, %eax
80 ; CHECK-NEXT: mull %ebx
81 ; CHECK-NEXT: movl %eax, %edi
82 ; CHECK-NEXT: imull $326129324, %ecx, %eax # imm = 0x137056AC
83 ; CHECK-NEXT: addl %edx, %eax
84 ; CHECK-NEXT: imull $-66860409, %esi, %ecx # imm = 0xFC03CA87
85 ; CHECK-NEXT: addl %eax, %ecx
86 ; CHECK-NEXT: xorl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Folded Reload
87 ; CHECK-NEXT: xorl {{[-0-9]+}}(%e{{[sb]}}p), %edi # 4-byte Folded Reload
88 ; CHECK-NEXT: movl %edi, b
89 ; CHECK-NEXT: movl %edi, %eax
90 ; CHECK-NEXT: mull %ebx
91 ; CHECK-NEXT: imull $326129324, %edi, %esi # imm = 0x137056AC
92 ; CHECK-NEXT: addl %edx, %esi
93 ; CHECK-NEXT: movl %ecx, b+4
94 ; CHECK-NEXT: imull $-66860409, %ecx, %ecx # imm = 0xFC03CA87
95 ; CHECK-NEXT: jmp .LBB0_3
96 ; CHECK-NEXT: .LBB0_2: # %if.else
97 ; CHECK-NEXT: xorl b+4, %ecx
98 ; CHECK-NEXT: xorl b, %esi
99 ; CHECK-NEXT: movl $1419758215, %edx # imm = 0x549FCA87
100 ; CHECK-NEXT: movl %esi, %eax
101 ; CHECK-NEXT: mull %edx
102 ; CHECK-NEXT: imull $93298681, %esi, %esi # imm = 0x58F9FF9
103 ; CHECK-NEXT: addl %edx, %esi
104 ; CHECK-NEXT: imull $1419758215, %ecx, %ecx # imm = 0x549FCA87
105 ; CHECK-NEXT: .LBB0_3: # %if.end
106 ; CHECK-NEXT: addl %esi, %ecx
107 ; CHECK-NEXT: addl $-1028477341, %eax # imm = 0xC2B2AE63
108 ; CHECK-NEXT: adcl $-2048144777, %ecx # imm = 0x85EBCA77
109 ; CHECK-NEXT: movl %eax, b
110 ; CHECK-NEXT: movl %ecx, b+4
111 ; CHECK-NEXT: addl $12, %esp
112 ; CHECK-NEXT: popl %esi
113 ; CHECK-NEXT: popl %edi
114 ; CHECK-NEXT: popl %ebx
115 ; CHECK-NEXT: popl %ebp
116 ; CHECK-NEXT: .cfi_def_cfa %esp, 4
119 %0 = load i32, ptr @a, align 4, !tbaa !1
120 %1 = inttoptr i32 %0 to ptr
121 %2 = load i32, ptr %1, align 4, !tbaa !5
122 %tobool = icmp eq i32 %2, 0
123 br i1 %tobool, label %if.else, label %if.then
125 if.then: ; preds = %entry
126 %v3 = getelementptr inbounds %struct.XXH_state64_t, ptr %1, i32 0, i32 3
127 %3 = load i64, ptr %v3, align 4, !tbaa !8
128 %v4 = getelementptr inbounds %struct.XXH_state64_t, ptr %1, i32 0, i32 4
129 %4 = load i64, ptr %v4, align 4, !tbaa !9
130 %v2 = getelementptr inbounds %struct.XXH_state64_t, ptr %1, i32 0, i32 2
131 %5 = load i64, ptr %v2, align 4, !tbaa !10
133 %or = or i64 %shl, %5
134 %shl2 = shl i64 %3, 2
135 %shr = lshr i64 %3, 1
136 %or3 = or i64 %shl2, %shr
137 %add = add i64 %or, %or3
138 %mul = mul i64 %4, -4417276706812531889
139 %shl4 = mul i64 %4, -8834553413625063778
140 %shr5 = ashr i64 %mul, 3
141 %or6 = or i64 %shr5, %shl4
142 %mul7 = mul nsw i64 %or6, 1400714785074694791
143 %xor = xor i64 %add, %mul7
144 store i64 %xor, ptr @b, align 8, !tbaa !11
145 %mul8 = mul nsw i64 %xor, 1400714785074694791
148 if.else: ; preds = %entry
149 %6 = load i64, ptr @b, align 8, !tbaa !11
150 %xor10 = xor i64 %6, -4417276706812531889
151 %mul11 = mul nsw i64 %xor10, 400714785074694791
154 if.end: ; preds = %if.else, %if.then
155 %storemerge.in = phi i64 [ %mul11, %if.else ], [ %mul8, %if.then ]
156 %storemerge = add i64 %storemerge.in, -8796714831421723037
157 store i64 %storemerge, ptr @b, align 8, !tbaa !11
161 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" }
165 !0 = !{!"clang version 3.6 (trunk 219587)"}
166 !1 = !{!2, !2, i64 0}
167 !2 = !{!"int", !3, i64 0}
168 !3 = !{!"omnipotent char", !4, i64 0}
169 !4 = !{!"Simple C/C++ TBAA"}
170 !5 = !{!6, !2, i64 0}
171 !6 = !{!"XXH_state64_t", !2, i64 0, !2, i64 4, !7, i64 8, !7, i64 16, !7, i64 24}
172 !7 = !{!"long long", !3, i64 0}
173 !8 = !{!6, !7, i64 16}
174 !9 = !{!6, !7, i64 24}
175 !10 = !{!6, !7, i64 8}
176 !11 = !{!7, !7, i64 0}