Nirav Dave | 3264c1b | 2018-03-19 20:19:46 +0000 | [diff] [blame] | 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 global %struct.anon zeroinitializer, align 4 |
| 7 | @d = local_unnamed_addr global %struct.anon* @c, align 8 |
| 8 | @a = common local_unnamed_addr global i32 0, align 4 |
| 9 | @b = common local_unnamed_addr global i32 0, align 4 |
| 10 | |
| 11 | ; Function Attrs: norecurse nounwind uwtable |
| 12 | define void @g() local_unnamed_addr #0 { |
| 13 | ; CHECK-LABEL: g: |
| 14 | ; CHECK: # %bb.0: # %entry |
| 15 | ; CHECK-NEXT: movq {{.*}}(%rip), %rax |
| 16 | ; CHECK-NEXT: movl 4(%rax), %eax |
| 17 | ; CHECK-NEXT: xorl %ecx, %ecx |
| 18 | ; CHECK-NEXT: incl {{.*}}(%rip) |
| 19 | ; CHECK-NEXT: setne %cl |
| 20 | ; CHECK-NEXT: addl %eax, %ecx |
| 21 | ; CHECK-NEXT: movl %ecx, {{.*}}(%rip) |
| 22 | ; CHECK-NEXT: retq |
| 23 | entry: |
| 24 | %0 = load %struct.anon*, %struct.anon** @d, align 8 |
| 25 | %y = getelementptr inbounds %struct.anon, %struct.anon* %0, i64 0, i32 1 |
| 26 | %1 = load i32, i32* %y, align 4 |
| 27 | %2 = load i32, i32* @b, align 4 |
| 28 | %inc = add nsw i32 %2, 1 |
| 29 | store i32 %inc, i32* @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, i32* @a, align 4 |
| 34 | ret void |
| 35 | } |