xref: /llvm-project/llvm/test/CodeGen/X86/pr32588.ll (revision 2f448bf509432c1a19ec46ab8cbc7353c03c6280)
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mcpu=generic -mtriple=x86_64-linux | FileCheck %s
3
4@c = external dso_local local_unnamed_addr global i32, align 4
5@b = external dso_local local_unnamed_addr global i32, align 4
6@d = external dso_local local_unnamed_addr global i32, align 4
7
8define void @fn1() {
9; CHECK-LABEL: fn1:
10; CHECK:       # %bb.0:
11; CHECK-NEXT:    xorl %eax, %eax
12; CHECK-NEXT:    cmpl $0, c(%rip)
13; CHECK-NEXT:    sete %al
14; CHECK-NEXT:    movl %eax, d(%rip)
15; CHECK-NEXT:    retq
16  %t0 = load i32, ptr @c, align 4
17  %tobool1 = icmp eq i32 %t0, 0
18  %xor = zext i1 %tobool1 to i32
19  %t1 = load i32, ptr @b, align 4
20  %tobool2 = icmp ne i32 %t1, 0
21  %t2 = load i32, ptr @d, align 4
22  %tobool4 = icmp ne i32 %t2, 0
23  %t3 = and i1 %tobool4, %tobool2
24  %sub = sext i1 %t3 to i32
25  %div = sdiv i32 %sub, 2
26  %add = add nsw i32 %div, %xor
27  store i32 %add, ptr @d, align 4
28  ret void
29}
30