xref: /aosp_15_r20/external/llvm/test/CodeGen/ARM/Windows/vla.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc -mtriple=thumbv7-windows-itanium -mcpu=cortex-a9 -o - %s \
2*9880d681SAndroid Build Coastguard Worker; RUN:  | FileCheck %s -check-prefix CHECK-SMALL-CODE
3*9880d681SAndroid Build Coastguard Worker; RUN: llc -mtriple=thumbv7-windows-itanium -mcpu=cortex-a9 -code-model=large -o - %s \
4*9880d681SAndroid Build Coastguard Worker; RUN:  | FileCheck %s -check-prefix CHECK-LARGE-CODE
5*9880d681SAndroid Build Coastguard Worker; RUN: llc -mtriple=thumbv7-windows-msvc -mcpu=cortex-a9 -o - %s \
6*9880d681SAndroid Build Coastguard Worker; RUN:  | FileCheck %s -check-prefix CHECK-MSVC
7*9880d681SAndroid Build Coastguard Worker
8*9880d681SAndroid Build Coastguard Workerdefine arm_aapcs_vfpcc i8 @function(i32 %sz, i32 %idx) {
9*9880d681SAndroid Build Coastguard Workerentry:
10*9880d681SAndroid Build Coastguard Worker  %vla = alloca i8, i32 %sz, align 1
11*9880d681SAndroid Build Coastguard Worker  %arrayidx = getelementptr inbounds i8, i8* %vla, i32 %idx
12*9880d681SAndroid Build Coastguard Worker  %0 = load volatile i8, i8* %arrayidx, align 1
13*9880d681SAndroid Build Coastguard Worker  ret i8 %0
14*9880d681SAndroid Build Coastguard Worker}
15*9880d681SAndroid Build Coastguard Worker
16*9880d681SAndroid Build Coastguard Worker; CHECK-SMALL-CODE:   adds [[R4:r[0-9]+]], #7
17*9880d681SAndroid Build Coastguard Worker; CHECK-SMALL-CODE:   bic [[R4]], [[R4]], #7
18*9880d681SAndroid Build Coastguard Worker; CHECK-SMALL-CODE:   lsrs r4, [[R4]], #2
19*9880d681SAndroid Build Coastguard Worker; CHECK-SMALL-CODE:   bl __chkstk
20*9880d681SAndroid Build Coastguard Worker; CHECK-SMALL-CODE:   sub.w sp, sp, r4
21*9880d681SAndroid Build Coastguard Worker
22*9880d681SAndroid Build Coastguard Worker; CHECK-LARGE-CODE:   adds  [[R4:r[0-9]+]], #7
23*9880d681SAndroid Build Coastguard Worker; CHECK-LARGE-CODE:   bic   [[R4]], [[R4]], #7
24*9880d681SAndroid Build Coastguard Worker; CHECK-LARGE-CODE:   lsrs  r4, [[R4]], #2
25*9880d681SAndroid Build Coastguard Worker; CHECK-LARGE-CODE:   movw  [[IP:r[0-9]+]], :lower16:__chkstk
26*9880d681SAndroid Build Coastguard Worker; CHECK-LARGE-CODE:   movt  [[IP]], :upper16:__chkstk
27*9880d681SAndroid Build Coastguard Worker; CHECK-LARGE-CODE:   blx   [[IP]]
28*9880d681SAndroid Build Coastguard Worker; CHECK-LARGE-CODE:   sub.w sp, sp, r4
29*9880d681SAndroid Build Coastguard Worker
30*9880d681SAndroid Build Coastguard Worker; CHECK-MSVC-NOT: __chkstk
31*9880d681SAndroid Build Coastguard Worker
32