Matthias Braun | e2d2ce9 | 2017-08-01 22:20:41 +0000 | [diff] [blame] | 1 | ; RUN: llc -mtriple=ppc64-- -ppc-always-use-base-pointer < %s | FileCheck %s --check-prefix CHECK --check-prefix PPC64 |
Stefan Pintilie | 046eff5 | 2018-11-16 18:36:21 +0000 | [diff] [blame] | 2 | ; RUN: llc -ppc-always-use-base-pointer -relocation-model=static < %s | FileCheck %s --check-prefix CHECK --check-prefix PPC32 |
| 3 | ; RUN: llc -ppc-always-use-base-pointer -relocation-model=pic < %s | FileCheck %s --check-prefix CHECK --check-prefix PPC32PIC |
Krzysztof Parzyszek | 2b05331 | 2017-05-17 13:25:09 +0000 | [diff] [blame] | 4 | |
| 5 | ; CHECK-LABEL: fred: |
| 6 | |
| 7 | ; Check for saving/restoring frame pointer (X31) and base pointer (X30) |
| 8 | ; on ppc64: |
| 9 | ; PPC64: std 31, -8(1) |
| 10 | ; PPC64: std 30, -16(1) |
| 11 | ; PPC64: ld 31, -8(1) |
| 12 | ; PPC64: ld 30, -16(1) |
| 13 | |
| 14 | ; Check for saving/restoring frame pointer (R31) and base pointer (R30) |
| 15 | ; on ppc32: |
| 16 | ; PPC32: stwux 1, 1, 0 |
| 17 | ; PPC32; addic 0, 0, -4 |
| 18 | ; PPC32: stwx 31, 0, 0 |
| 19 | ; PPC32: addic 0, 0, -4 |
| 20 | ; PPC32: stwx 30, 0, 0 |
| 21 | ; The restore sequence: |
| 22 | ; PPC32: lwz 31, 0(1) |
| 23 | ; PPC32: addic 30, 0, 8 |
| 24 | ; PPC32: lwz 0, -4(31) |
| 25 | ; PPC32: lwz 30, -8(31) |
| 26 | ; PPC32: mr 1, 31 |
| 27 | ; PPC32: mr 31, 0 |
| 28 | |
| 29 | ; Check for saving/restoring frame pointer (R31) and base pointer (R29) |
| 30 | ; on ppc32/pic. This is mostly the same as without pic, except that base |
| 31 | ; pointer is in R29. |
| 32 | ; PPC32PIC: stwux 1, 1, 0 |
| 33 | ; PPC32PIC; addic 0, 0, -4 |
| 34 | ; PPC32PIC: stwx 31, 0, 0 |
| 35 | ; PPC32PIC: addic 0, 0, -8 |
| 36 | ; PPC32PIC: stwx 29, 0, 0 |
| 37 | ; The restore sequence: |
| 38 | ; PPC32PIC: lwz 31, 0(1) |
| 39 | ; PPC32PIC: addic 29, 0, 12 |
| 40 | ; PPC32PIC: lwz 0, -4(31) |
| 41 | ; PPC32PIC: lwz 29, -12(31) |
| 42 | ; PPC32PIC: mr 1, 31 |
| 43 | ; PPC32PIC: mr 31, 0 |
| 44 | |
| 45 | |
| 46 | target datalayout = "E-m:e-p:32:32-i64:64-n32" |
| 47 | target triple = "powerpc-unknown-freebsd" |
| 48 | |
| 49 | define i64 @fred() local_unnamed_addr #0 { |
| 50 | entry: |
| 51 | ret i64 0 |
| 52 | } |
| 53 | |
| 54 | attributes #0 = { norecurse readnone nounwind sspstrong "no-frame-pointer-elim"="true" "target-cpu"="ppc" } |