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 3 4; When compiled and run this should print zero. 5 6 7@c = common local_unnamed_addr global i32 0, align 4 8@f = common local_unnamed_addr global i32 0, align 4 9@e = common local_unnamed_addr global i32 0, align 4 10@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 11 12; We should only see a single store to f (a bytes store to f+3). 13define void @k(i32 %l) { 14; CHECK-LABEL: k: 15; CHECK: # %bb.0: 16; CHECK-NEXT: movl {{.*}}(%rip), %eax 17; CHECK-NEXT: orl {{.*}}(%rip), %eax 18; CHECK-NEXT: shrl $24, %eax 19; CHECK-NEXT: movb %al, f+{{.*}}(%rip) 20; CHECK-NEXT: retq 21 %load = load i32, i32* @c, align 4 22 %load6 = load i32, i32* @f, align 4 23 %clear7 = and i32 %load6, 16777215 24 store i32 %clear7, i32* @c, align 4 25 %neg = and i32 %load6, 2097151 26 %value = xor i32 %neg, 2097151 27 store i32 %load, i32* @c, align 4 28 %t0 = load i32, i32* @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, i32* @f, align 4 33 %clear25 = and i32 %set17, -16777216 34 %set26 = or i32 %clear25, %clear7 35 store i32 %set26, i32* @f, align 4 36 ret void 37} 38 39declare i32 @printf(i8* nocapture readonly, ...) 40 41define i32 @main() { 42; CHECK-LABEL: main: 43; CHECK: # %bb.0: 44; CHECK-NEXT: pushq %rax 45; CHECK-NEXT: .cfi_def_cfa_offset 16 46; CHECK-NEXT: movl $1, %edi 47; CHECK-NEXT: callq k 48; CHECK-NEXT: movl {{.*}}(%rip), %esi 49; CHECK-NEXT: movl $.L.str.1, %edi 50; CHECK-NEXT: xorl %eax, %eax 51; CHECK-NEXT: callq printf 52; CHECK-NEXT: xorl %eax, %eax 53; CHECK-NEXT: popq %rcx 54; CHECK-NEXT: .cfi_def_cfa_offset 8 55; CHECK-NEXT: retq 56 tail call void @k(i32 1) 57 %load = load i32, i32* @f, align 4 58 %call = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %load) 59 ret i32 0 60} 61