xref: /llvm-project/llvm/test/CodeGen/AArch64/framelayout-unaligned-fp.ll (revision 5ddce70ef0e5a641d7fea95e31fc5e2439cb98cb)
1; RUN: llc -verify-machineinstrs < %s | FileCheck %s
2
3; The purpose of this test is to construct a scenario where an odd number
4; of callee-saved GPRs as well as an odd number of callee-saved FPRs are
5; used. This caused the frame pointer to be aligned to a multiple of 8
6; on non-Darwin platforms, rather than a multiple of 16 as usual.
7
8target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
9target triple = "aarch64-unknown-linux-gnu"
10
11@a = global i64 0, align 4
12
13
14define i64 @b() uwtable {
15entry:
16  %call = tail call i64 @d()
17  %0 = alloca i8, i64 ptrtoint (ptr @d to i64), align 16
18  %1 = ptrtoint ptr %0 to i64
19  store i64 %1, ptr @a, align 4
20  %call1 = call i64 @e()
21  %conv = sitofp i64 %call1 to float
22  %2 = load i64, ptr @a, align 4
23  %call2 = call i64 @f(i64 %2)
24  %conv3 = fptosi float %conv to i64
25  ret i64 %conv3
26}
27
28; CHECK-LABEL: b:
29; CHECK:       str     d8, [sp, #-32]!
30; CHECK-NEXT:  .cfi_def_cfa_offset 32
31; CHECK-NEXT:  stp     x29, x30, [sp, #8]
32; CHECK-NEXT:  str     x19, [sp, #24]
33; CHECK-NEXT:  add     x29, sp, #8
34
35; CHECK:       sub     sp, x29, #8
36; CHECK-NEXT:  .cfi_def_cfa wsp, 32
37; CHECK-NEXT:  ldp     x29, x30, [sp, #8]
38; CHECK-NEXT:  ldr     x19, [sp, #24]
39; CHECK-NEXT:  ldr     d8, [sp], #32
40; CHECK-NEXT: .cfi_def_cfa_offset 0
41; CHECK-NEXT: .cfi_restore w19
42; CHECK-NEXT: .cfi_restore w30
43; CHECK-NEXT: .cfi_restore w29
44; CHECK-NEXT: .cfi_restore b8
45; CHECK-NEXT:  ret
46
47declare i64 @d()
48declare i64 @e()
49declare i64 @f(i64)
50