1 ; RUN: llc -verify-machineinstrs -mtriple=i386--netbsd < %s | FileCheck %s
2 ; Regression test for http://reviews.llvm.org/D5701
4 ; ModuleID = 'xxhash.i'
5 target datalayout = "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128"
6 target triple = "i386--netbsd"
9 ; CHECK: orl {{.*#+}} 4-byte Folded Reload
10 ; CHECK: addl {{.*#+}} 4-byte Folded Reload
11 ; CHECK: xorl {{.*#+}} 4-byte Folded Reload
12 ; CHECK: xorl {{.*#+}} 4-byte Folded Reload
15 %struct.XXH_state64_t = type { i32, i32, i64, i64, i64 }
17 @a = common global i32 0, align 4
18 @b = common global i64 0, align 8
20 ; Function Attrs: nounwind uwtable
21 define i64 @fn1() #0 {
23 %0 = load i32, i32* @a, align 4, !tbaa !1
24 %1 = inttoptr i32 %0 to %struct.XXH_state64_t*
25 %total_len = getelementptr inbounds %struct.XXH_state64_t, %struct.XXH_state64_t* %1, i32 0, i32 0
26 %2 = load i32, i32* %total_len, align 4, !tbaa !5
27 %tobool = icmp eq i32 %2, 0
28 br i1 %tobool, label %if.else, label %if.then
30 if.then: ; preds = %entry
31 %v3 = getelementptr inbounds %struct.XXH_state64_t, %struct.XXH_state64_t* %1, i32 0, i32 3
32 %3 = load i64, i64* %v3, align 4, !tbaa !8
33 %v4 = getelementptr inbounds %struct.XXH_state64_t, %struct.XXH_state64_t* %1, i32 0, i32 4
34 %4 = load i64, i64* %v4, align 4, !tbaa !9
35 %v2 = getelementptr inbounds %struct.XXH_state64_t, %struct.XXH_state64_t* %1, i32 0, i32 2
36 %5 = load i64, i64* %v2, align 4, !tbaa !10
41 %or3 = or i64 %shl2, %shr
42 %add = add i64 %or, %or3
43 %mul = mul i64 %4, -4417276706812531889
44 %shl4 = mul i64 %4, -8834553413625063778
45 %shr5 = ashr i64 %mul, 3
46 %or6 = or i64 %shr5, %shl4
47 %mul7 = mul nsw i64 %or6, 1400714785074694791
48 %xor = xor i64 %add, %mul7
49 store i64 %xor, i64* @b, align 8, !tbaa !11
50 %mul8 = mul nsw i64 %xor, 1400714785074694791
53 if.else: ; preds = %entry
54 %6 = load i64, i64* @b, align 8, !tbaa !11
55 %xor10 = xor i64 %6, -4417276706812531889
56 %mul11 = mul nsw i64 %xor10, 400714785074694791
59 if.end: ; preds = %if.else, %if.then
60 %storemerge.in = phi i64 [ %mul11, %if.else ], [ %mul8, %if.then ]
61 %storemerge = add i64 %storemerge.in, -8796714831421723037
62 store i64 %storemerge, i64* @b, align 8, !tbaa !11
66 attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
70 !0 = !{!"clang version 3.6 (trunk 219587)"}
72 !2 = !{!"int", !3, i64 0}
73 !3 = !{!"omnipotent char", !4, i64 0}
74 !4 = !{!"Simple C/C++ TBAA"}
76 !6 = !{!"XXH_state64_t", !2, i64 0, !2, i64 4, !7, i64 8, !7, i64 16, !7, i64 24}
77 !7 = !{!"long long", !3, i64 0}
78 !8 = !{!6, !7, i64 16}
79 !9 = !{!6, !7, i64 24}
80 !10 = !{!6, !7, i64 8}
81 !11 = !{!7, !7, i64 0}