1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc -mtriple=i386-apple-macosx10.13.0 -o - %s | FileCheck %s
3
4target datalayout = "e-m:o-p:32:32-f64:32:64-f80:128-n8:16:32-S128"
5
6@c = external local_unnamed_addr global i32, align 4
7@b = external local_unnamed_addr global [1 x i32], align 4
8@d = external local_unnamed_addr global i32, align 4
9
10define void @pr32610(i32 %a0, i32 %a1) #0 {
11; CHECK-LABEL: pr32610:
12; CHECK:       ## %bb.0: ## %entry
13; CHECK-NEXT:    pushl %ebp
14; CHECK-NEXT:    movl %esp, %ebp
15; CHECK-NEXT:    pushl %esi
16; CHECK-NEXT:    movl 8(%ebp), %ecx
17; CHECK-NEXT:    movl L_b$non_lazy_ptr, %edx
18; CHECK-NEXT:    xorl %eax, %eax
19; CHECK-NEXT:    cmpl (%edx), %ecx
20; CHECK-NEXT:    sete %al
21; CHECK-NEXT:    xorl %esi, %esi
22; CHECK-NEXT:    incl %esi
23; CHECK-NEXT:    cmpl $0, 12(%ebp)
24; CHECK-NEXT:    cmovel %esi, %eax
25; CHECK-NEXT:    cmpl (%edx), %ecx
26; CHECK-NEXT:    cmovnel %esi, %eax
27; CHECK-NEXT:    movl L_c$non_lazy_ptr, %ecx
28; CHECK-NEXT:    movl %eax, (%ecx)
29; CHECK-NEXT:    movl (%edx), %eax
30; CHECK-NEXT:    testl %eax, %eax
31; CHECK-NEXT:    movl $2, %ecx
32; CHECK-NEXT:    cmovnel %eax, %ecx
33; CHECK-NEXT:    movl L_d$non_lazy_ptr, %eax
34; CHECK-NEXT:    movl %ecx, (%eax)
35; CHECK-NEXT:    popl %esi
36; CHECK-NEXT:    popl %ebp
37; CHECK-NEXT:    retl
38entry:
39  %0 = load i32, i32* getelementptr ([1 x i32], [1 x i32]* @b, i32 0, i32 undef), align 4, !tbaa !1
40  %cmp = icmp eq i32 %a0, %0
41  %conv = zext i1 %cmp to i32
42  %tobool1.i = icmp ne i32 %a1, 0
43  %or.cond.i = and i1 %cmp, %tobool1.i
44  %cond.i = select i1 %or.cond.i, i32 %conv, i32 1
45  store i32 %cond.i, i32* @c, align 4, !tbaa !1
46  %1 = load i32, i32* getelementptr inbounds ([1 x i32], [1 x i32]* @b, i32 0, i32 0), align 4
47  %tobool = icmp ne i32 %1, 0
48  %2 = select i1 %tobool, i32 %1, i32 2
49  store i32 %2, i32* @d, align 4, !tbaa !1
50  ret void
51}
52
53attributes #0 = { norecurse nounwind optsize ssp "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="penryn" "target-features"="+cx16,+fxsr,+mmx,+sse,+sse2,+sse3,+sse4.1,+ssse3,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
54
55!llvm.ident = !{!0}
56
57!0 = !{!"clang version 5.0.0 (trunk 301507) (llvm/trunk 301505)"}
58!1 = !{!2, !2, i64 0}
59!2 = !{!"int", !3, i64 0}
60!3 = !{!"omnipotent char", !4, i64 0}
61!4 = !{!"Simple C/C++ TBAA"}
62