1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -stack-symbol-ordering=0 -march=x86 -mtriple=i386-apple-darwin9 -mcpu=generic -regalloc=fast -optimize-regalloc=0 -no-x86-call-frame-opt | FileCheck %s 2*9880d681SAndroid Build Coastguard Worker; RUN: llc -O0 < %s -stack-symbol-ordering=0 -march=x86 -mtriple=i386-apple-darwin9 -mcpu=generic -regalloc=fast -no-x86-call-frame-opt | FileCheck %s 3*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -stack-symbol-ordering=0 -march=x86 -mtriple=i386-apple-darwin9 -mcpu=atom -regalloc=fast -optimize-regalloc=0 -no-x86-call-frame-opt | FileCheck -check-prefix=ATOM %s 4*9880d681SAndroid Build Coastguard Worker; CHECKed instructions should be the same with or without -O0 except on Intel Atom due to instruction scheduling. 5*9880d681SAndroid Build Coastguard Worker 6*9880d681SAndroid Build Coastguard Worker@.str = private constant [12 x i8] c"x + y = %i\0A\00", align 1 ; <[12 x i8]*> [#uses=1] 7*9880d681SAndroid Build Coastguard Worker 8*9880d681SAndroid Build Coastguard Workerdefine i32 @main() nounwind { 9*9880d681SAndroid Build Coastguard Workerentry: 10*9880d681SAndroid Build Coastguard Worker; CHECK: movl 24(%esp), %eax 11*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: movl 12*9880d681SAndroid Build Coastguard Worker; CHECK: movl %eax, 36(%esp) 13*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: movl 14*9880d681SAndroid Build Coastguard Worker; CHECK: movl 28(%esp), %ebx 15*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: movl 16*9880d681SAndroid Build Coastguard Worker; CHECK: movl %ebx, 40(%esp) 17*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: movl 18*9880d681SAndroid Build Coastguard Worker; CHECK: addl %ebx, %eax 19*9880d681SAndroid Build Coastguard Worker 20*9880d681SAndroid Build Coastguard Worker; On Intel Atom the scheduler moves a movl instruction 21*9880d681SAndroid Build Coastguard Worker; used for the printf call to follow movl 24(%esp), %eax 22*9880d681SAndroid Build Coastguard Worker; ATOM: movl 24(%esp), %eax 23*9880d681SAndroid Build Coastguard Worker; ATOM: movl 24*9880d681SAndroid Build Coastguard Worker; ATOM: movl %eax, 36(%esp) 25*9880d681SAndroid Build Coastguard Worker; ATOM-NOT: movl 26*9880d681SAndroid Build Coastguard Worker; ATOM: movl 28(%esp), %ebx 27*9880d681SAndroid Build Coastguard Worker; ATOM-NOT: movl 28*9880d681SAndroid Build Coastguard Worker; ATOM: movl %ebx, 40(%esp) 29*9880d681SAndroid Build Coastguard Worker; ATOM-NOT: movl 30*9880d681SAndroid Build Coastguard Worker; ATOM: addl %ebx, %eax 31*9880d681SAndroid Build Coastguard Worker 32*9880d681SAndroid Build Coastguard Worker %retval = alloca i32 ; <i32*> [#uses=2] 33*9880d681SAndroid Build Coastguard Worker %"%ebx" = alloca i32 ; <i32*> [#uses=1] 34*9880d681SAndroid Build Coastguard Worker %"%eax" = alloca i32 ; <i32*> [#uses=2] 35*9880d681SAndroid Build Coastguard Worker %result = alloca i32 ; <i32*> [#uses=2] 36*9880d681SAndroid Build Coastguard Worker %y = alloca i32 ; <i32*> [#uses=2] 37*9880d681SAndroid Build Coastguard Worker %x = alloca i32 ; <i32*> [#uses=2] 38*9880d681SAndroid Build Coastguard Worker %0 = alloca i32 ; <i32*> [#uses=2] 39*9880d681SAndroid Build Coastguard Worker %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0] 40*9880d681SAndroid Build Coastguard Worker store i32 1, i32* %x, align 4 41*9880d681SAndroid Build Coastguard Worker store i32 2, i32* %y, align 4 42*9880d681SAndroid Build Coastguard Worker call void asm sideeffect alignstack "# top of block", "~{dirflag},~{fpsr},~{flags},~{edi},~{esi},~{edx},~{ecx},~{eax}"() nounwind 43*9880d681SAndroid Build Coastguard Worker %asmtmp = call i32 asm sideeffect alignstack "movl $1, $0", "=={eax},*m,~{dirflag},~{fpsr},~{flags},~{memory}"(i32* %x) nounwind ; <i32> [#uses=1] 44*9880d681SAndroid Build Coastguard Worker store i32 %asmtmp, i32* %"%eax" 45*9880d681SAndroid Build Coastguard Worker %asmtmp1 = call i32 asm sideeffect alignstack "movl $1, $0", "=={ebx},*m,~{dirflag},~{fpsr},~{flags},~{memory}"(i32* %y) nounwind ; <i32> [#uses=1] 46*9880d681SAndroid Build Coastguard Worker store i32 %asmtmp1, i32* %"%ebx" 47*9880d681SAndroid Build Coastguard Worker %1 = call i32 asm "", "={bx}"() nounwind ; <i32> [#uses=1] 48*9880d681SAndroid Build Coastguard Worker %2 = call i32 asm "", "={ax}"() nounwind ; <i32> [#uses=1] 49*9880d681SAndroid Build Coastguard Worker %asmtmp2 = call i32 asm sideeffect alignstack "addl $1, $0", "=={eax},{ebx},{eax},~{dirflag},~{fpsr},~{flags},~{memory}"(i32 %1, i32 %2) nounwind ; <i32> [#uses=1] 50*9880d681SAndroid Build Coastguard Worker store i32 %asmtmp2, i32* %"%eax" 51*9880d681SAndroid Build Coastguard Worker %3 = call i32 asm "", "={ax}"() nounwind ; <i32> [#uses=1] 52*9880d681SAndroid Build Coastguard Worker call void asm sideeffect alignstack "movl $0, $1", "{eax},*m,~{dirflag},~{fpsr},~{flags},~{memory}"(i32 %3, i32* %result) nounwind 53*9880d681SAndroid Build Coastguard Worker %4 = load i32, i32* %result, align 4 ; <i32> [#uses=1] 54*9880d681SAndroid Build Coastguard Worker %5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i32 0, i32 0), i32 %4) nounwind ; <i32> [#uses=0] 55*9880d681SAndroid Build Coastguard Worker store i32 0, i32* %0, align 4 56*9880d681SAndroid Build Coastguard Worker %6 = load i32, i32* %0, align 4 ; <i32> [#uses=1] 57*9880d681SAndroid Build Coastguard Worker store i32 %6, i32* %retval, align 4 58*9880d681SAndroid Build Coastguard Worker br label %return 59*9880d681SAndroid Build Coastguard Worker 60*9880d681SAndroid Build Coastguard Workerreturn: ; preds = %entry 61*9880d681SAndroid Build Coastguard Worker %retval3 = load i32, i32* %retval ; <i32> [#uses=1] 62*9880d681SAndroid Build Coastguard Worker ret i32 %retval3 63*9880d681SAndroid Build Coastguard Worker} 64*9880d681SAndroid Build Coastguard Worker 65*9880d681SAndroid Build Coastguard Workerdeclare i32 @printf(i8*, ...) nounwind 66