1 ; RUN: llc < %s -fast-isel -mtriple=i386-apple-darwin -mcpu=generic | FileCheck %s
2 ; RUN: llc < %s -fast-isel -mtriple=i386-apple-darwin -mcpu=atom | FileCheck -check-prefix=ATOM %s
4 @src = external global i32
7 define i32 @loadgv() nounwind {
9 %0 = load i32, i32* @src, align 4
10 %1 = load i32, i32* @src, align 4
12 store i32 %2, i32* @src
14 ; This should fold one of the loads into the add.
15 ; CHECK-LABEL: loadgv:
16 ; CHECK: movl L_src$non_lazy_ptr, %ecx
17 ; CHECK: movl (%ecx), %eax
18 ; CHECK: addl (%ecx), %eax
19 ; CHECK: movl %eax, (%ecx)
23 ; ATOM: movl L_src$non_lazy_ptr, %ecx
24 ; ATOM: movl (%ecx), %eax
25 ; ATOM: addl (%ecx), %eax
26 ; ATOM: movl %eax, (%ecx)
31 %stuff = type { i32 (...)** }
32 @LotsStuff = external constant [4 x i32 (...)*]
34 define void @t(%stuff* %this) nounwind {
36 store i32 (...)** getelementptr ([4 x i32 (...)*], [4 x i32 (...)*]* @LotsStuff, i32 0, i32 2), i32 (...)*** null, align 4
39 ; CHECK: xorl %eax, %eax
40 ; CHECK: movl L_LotsStuff$non_lazy_ptr, %ecx
43 ; ATOM: movl L_LotsStuff$non_lazy_ptr, %e{{..}}
44 ; ATOM: xorl %e{{..}}, %e{{..}}