xref: /aosp_15_r20/external/llvm/test/CodeGen/X86/fold-push.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=i686-windows | FileCheck %s -check-prefix=CHECK -check-prefix=NORMAL
2*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=i686-windows -mattr=call-reg-indirect | FileCheck %s -check-prefix=CHECK -check-prefix=SLM
3*9880d681SAndroid Build Coastguard Worker
4*9880d681SAndroid Build Coastguard Workerdeclare void @foo(i32 %r)
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Workerdefine void @test(i32 %a, i32 %b) optsize nounwind {
7*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test:
8*9880d681SAndroid Build Coastguard Worker; CHECK: movl [[EAX:%e..]], (%esp)
9*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: pushl [[EAX]]
10*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: calll
11*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: addl $4, %esp
12*9880d681SAndroid Build Coastguard Worker; CHECK: nop
13*9880d681SAndroid Build Coastguard Worker; NORMAL: pushl (%esp)
14*9880d681SAndroid Build Coastguard Worker; SLM: movl (%esp), [[RELOAD:%e..]]
15*9880d681SAndroid Build Coastguard Worker; SLM-NEXT: pushl [[RELOAD]]
16*9880d681SAndroid Build Coastguard Worker; CHECK: calll
17*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: addl $8, %esp
18*9880d681SAndroid Build Coastguard Worker  %c = add i32 %a, %b
19*9880d681SAndroid Build Coastguard Worker  call void @foo(i32 %c)
20*9880d681SAndroid Build Coastguard Worker  call void asm sideeffect "nop", "~{ax},~{bx},~{cx},~{dx},~{bp},~{si},~{di}"()
21*9880d681SAndroid Build Coastguard Worker  call void @foo(i32 %c)
22*9880d681SAndroid Build Coastguard Worker  ret void
23*9880d681SAndroid Build Coastguard Worker}
24*9880d681SAndroid Build Coastguard Worker
25*9880d681SAndroid Build Coastguard Workerdefine void @test_min(i32 %a, i32 %b) minsize nounwind {
26*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test_min:
27*9880d681SAndroid Build Coastguard Worker; CHECK: movl [[EAX:%e..]], (%esp)
28*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: pushl [[EAX]]
29*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: calll
30*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: popl
31*9880d681SAndroid Build Coastguard Worker; CHECK: nop
32*9880d681SAndroid Build Coastguard Worker; CHECK: pushl (%esp)
33*9880d681SAndroid Build Coastguard Worker; CHECK: calll
34*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: popl
35*9880d681SAndroid Build Coastguard Worker  %c = add i32 %a, %b
36*9880d681SAndroid Build Coastguard Worker  call void @foo(i32 %c)
37*9880d681SAndroid Build Coastguard Worker  call void asm sideeffect "nop", "~{ax},~{bx},~{cx},~{dx},~{bp},~{si},~{di}"()
38*9880d681SAndroid Build Coastguard Worker  call void @foo(i32 %c)
39*9880d681SAndroid Build Coastguard Worker  ret void
40*9880d681SAndroid Build Coastguard Worker}
41