xref: /aosp_15_r20/external/llvm/test/CodeGen/X86/fast-isel-mem.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -fast-isel -mtriple=i386-apple-darwin -mcpu=generic | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -fast-isel -mtriple=i386-apple-darwin -mcpu=atom | FileCheck -check-prefix=ATOM %s
3*9880d681SAndroid Build Coastguard Worker
4*9880d681SAndroid Build Coastguard Worker@src = external global i32
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Worker; rdar://6653118
7*9880d681SAndroid Build Coastguard Workerdefine i32 @loadgv() nounwind {
8*9880d681SAndroid Build Coastguard Workerentry:
9*9880d681SAndroid Build Coastguard Worker	%0 = load i32, i32* @src, align 4
10*9880d681SAndroid Build Coastguard Worker	%1 = load i32, i32* @src, align 4
11*9880d681SAndroid Build Coastguard Worker        %2 = add i32 %0, %1
12*9880d681SAndroid Build Coastguard Worker        store i32 %2, i32* @src
13*9880d681SAndroid Build Coastguard Worker	ret i32 %2
14*9880d681SAndroid Build Coastguard Worker; This should fold one of the loads into the add.
15*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: loadgv:
16*9880d681SAndroid Build Coastguard Worker; CHECK: 	movl	L_src$non_lazy_ptr, %ecx
17*9880d681SAndroid Build Coastguard Worker; CHECK: 	movl	(%ecx), %eax
18*9880d681SAndroid Build Coastguard Worker; CHECK: 	addl	(%ecx), %eax
19*9880d681SAndroid Build Coastguard Worker; CHECK: 	movl	%eax, (%ecx)
20*9880d681SAndroid Build Coastguard Worker; CHECK: 	ret
21*9880d681SAndroid Build Coastguard Worker
22*9880d681SAndroid Build Coastguard Worker; ATOM:	loadgv:
23*9880d681SAndroid Build Coastguard Worker; ATOM:		movl    L_src$non_lazy_ptr, %ecx
24*9880d681SAndroid Build Coastguard Worker; ATOM:         movl    (%ecx), %eax
25*9880d681SAndroid Build Coastguard Worker; ATOM:         addl    (%ecx), %eax
26*9880d681SAndroid Build Coastguard Worker; ATOM:         movl    %eax, (%ecx)
27*9880d681SAndroid Build Coastguard Worker; ATOM:         ret
28*9880d681SAndroid Build Coastguard Worker
29*9880d681SAndroid Build Coastguard Worker}
30*9880d681SAndroid Build Coastguard Worker
31*9880d681SAndroid Build Coastguard Worker%stuff = type { i32 (...)** }
32*9880d681SAndroid Build Coastguard Worker@LotsStuff = external constant [4 x i32 (...)*]
33*9880d681SAndroid Build Coastguard Worker
34*9880d681SAndroid Build Coastguard Workerdefine void @t(%stuff* %this) nounwind {
35*9880d681SAndroid Build Coastguard Workerentry:
36*9880d681SAndroid Build Coastguard Worker	store i32 (...)** getelementptr ([4 x i32 (...)*], [4 x i32 (...)*]* @LotsStuff, i32 0, i32 2), i32 (...)*** null, align 4
37*9880d681SAndroid Build Coastguard Worker	ret void
38*9880d681SAndroid Build Coastguard Worker; CHECK: _t:
39*9880d681SAndroid Build Coastguard Worker; CHECK:	xorl    %eax, %eax
40*9880d681SAndroid Build Coastguard Worker; CHECK:	movl	L_LotsStuff$non_lazy_ptr, %ecx
41*9880d681SAndroid Build Coastguard Worker
42*9880d681SAndroid Build Coastguard Worker; ATOM: _t:
43*9880d681SAndroid Build Coastguard Worker; ATOM:         movl    L_LotsStuff$non_lazy_ptr, %e{{..}}
44*9880d681SAndroid Build Coastguard Worker; ATOM:         xorl    %e{{..}}, %e{{..}}
45*9880d681SAndroid Build Coastguard Worker
46*9880d681SAndroid Build Coastguard Worker}
47