xref: /aosp_15_r20/external/llvm/test/CodeGen/X86/inline-asm-stack-realign3.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=x86 -no-integrated-as < %s | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Workerdeclare void @bar(i32* %junk)
4*9880d681SAndroid Build Coastguard Worker
5*9880d681SAndroid Build Coastguard Workerdefine i32 @foo(i1 %cond) {
6*9880d681SAndroid Build Coastguard Workerentry:
7*9880d681SAndroid Build Coastguard Worker  %r = alloca i32, align 128
8*9880d681SAndroid Build Coastguard Worker  store i32 -1, i32* %r, align 128
9*9880d681SAndroid Build Coastguard Worker  br i1 %cond, label %doit, label %skip
10*9880d681SAndroid Build Coastguard Worker
11*9880d681SAndroid Build Coastguard Workerdoit:
12*9880d681SAndroid Build Coastguard Worker  call void asm sideeffect "xor %ecx, %ecx\0A\09mov %ecx, $0", "=*m,~{ecx},~{flags}"(i32* %r)
13*9880d681SAndroid Build Coastguard Worker  %junk = alloca i32
14*9880d681SAndroid Build Coastguard Worker  call void @bar(i32* %junk)
15*9880d681SAndroid Build Coastguard Worker  br label %skip
16*9880d681SAndroid Build Coastguard Worker
17*9880d681SAndroid Build Coastguard Workerskip:
18*9880d681SAndroid Build Coastguard Worker  %0 = load i32, i32* %r, align 128
19*9880d681SAndroid Build Coastguard Worker  ret i32 %0
20*9880d681SAndroid Build Coastguard Worker}
21*9880d681SAndroid Build Coastguard Worker
22*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: foo:
23*9880d681SAndroid Build Coastguard Worker; CHECK: pushl %ebp
24*9880d681SAndroid Build Coastguard Worker; CHECK: andl $-128, %esp
25*9880d681SAndroid Build Coastguard Worker; CHECK: xor %ecx, %ecx
26*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: mov %ecx, (%esi)
27*9880d681SAndroid Build Coastguard Worker; CHECK: movl (%esi), %eax
28*9880d681SAndroid Build Coastguard Worker; CHECK: popl %ebp
29*9880d681SAndroid Build Coastguard Worker; CHECK: ret
30