1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -o - %s -mtriple=x86_64--unknown-linux-gnu | FileCheck %s
4 ; When compiled and run this should print zero.
7 @c = common dso_local local_unnamed_addr global i32 0, align 4
8 @f = common dso_local local_unnamed_addr global i32 0, align 4
9 @e = common dso_local local_unnamed_addr global i32 0, align 4
10 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
12 ; We should only see a single store to f (a bytes store to f+3).
13 define dso_local void @k(i32 %l) {
16 ; CHECK-NEXT: movl e(%rip), %eax
17 ; CHECK-NEXT: orl f(%rip), %eax
18 ; CHECK-NEXT: shrl $24, %eax
19 ; CHECK-NEXT: movb %al, f+3(%rip)
21 %load = load i32, ptr @c, align 4
22 %load6 = load i32, ptr @f, align 4
23 %clear7 = and i32 %load6, 16777215
24 store i32 %clear7, ptr @c, align 4
25 %neg = and i32 %load6, 2097151
26 %value = xor i32 %neg, 2097151
27 store i32 %load, ptr @c, align 4
28 %t0 = load i32, ptr @e, align 4
29 %value15 = xor i32 %t0, %value
30 %clear16 = and i32 %load6, -16777216
31 %set17 = or i32 %value15, %clear16
32 store i32 %set17, ptr @f, align 4
33 %clear25 = and i32 %set17, -16777216
34 %set26 = or i32 %clear25, %clear7
35 store i32 %set26, ptr @f, align 4
39 declare i32 @printf(ptr nocapture readonly, ...)
41 define dso_local i32 @main() {
44 ; CHECK-NEXT: pushq %rax
45 ; CHECK-NEXT: .cfi_def_cfa_offset 16
46 ; CHECK-NEXT: movl $1, %edi
48 ; CHECK-NEXT: movl f(%rip), %esi
49 ; CHECK-NEXT: movl $.L.str.1, %edi
50 ; CHECK-NEXT: xorl %eax, %eax
51 ; CHECK-NEXT: callq printf@PLT
52 ; CHECK-NEXT: xorl %eax, %eax
53 ; CHECK-NEXT: popq %rcx
54 ; CHECK-NEXT: .cfi_def_cfa_offset 8
56 tail call void @k(i32 1)
57 %load = load i32, ptr @f, align 4
58 %call = tail call i32 (ptr, ...) @printf(ptr @.str.1, i32 %load)