xref: /llvm-project/llvm/test/CodeGen/X86/pr36312.ll (revision 2f448bf509432c1a19ec46ab8cbc7353c03c6280)
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu | FileCheck %s
3
4%struct.anon = type { i32, i32 }
5
6@c = common dso_local global %struct.anon zeroinitializer, align 4
7@d = dso_local local_unnamed_addr global ptr @c, align 8
8@a = common dso_local local_unnamed_addr global i32 0, align 4
9@b = common dso_local local_unnamed_addr global i32 0, align 4
10
11; Function Attrs: norecurse nounwind uwtable
12define  void @g() local_unnamed_addr #0 {
13; CHECK-LABEL: g:
14; CHECK:       # %bb.0: # %entry
15; CHECK-NEXT:    movq d(%rip), %rax
16; CHECK-NEXT:    movl 4(%rax), %eax
17; CHECK-NEXT:    xorl %ecx, %ecx
18; CHECK-NEXT:    incl b(%rip)
19; CHECK-NEXT:    setne %cl
20; CHECK-NEXT:    addl %eax, %ecx
21; CHECK-NEXT:    movl %ecx, a(%rip)
22; CHECK-NEXT:    retq
23entry:
24  %0 = load ptr, ptr @d, align 8
25  %y = getelementptr inbounds %struct.anon, ptr %0, i64 0, i32 1
26  %1 = load i32, ptr %y, align 4
27  %2 = load i32, ptr @b, align 4
28  %inc = add nsw i32 %2, 1
29  store i32 %inc, ptr @b, align 4
30  %tobool = icmp ne i32 %inc, 0
31  %land.ext = zext i1 %tobool to i32
32  %add = add nsw i32 %1, %land.ext
33  store i32 %add, ptr @a, align 4
34  ret void
35}
36