1 ; RUN: llc < %s -O0 -verify-machineinstrs -fast-isel-abort -mtriple=armv7-apple-darwin | FileCheck %s --check-prefix=DARWIN-ARM 2 ; RUN: llc < %s -O0 -verify-machineinstrs -fast-isel-abort -mtriple=armv7-linux-gnueabi | FileCheck %s --check-prefix=LINUX-ARM 3 ; RUN: llc < %s -O0 -verify-machineinstrs -fast-isel-abort -mtriple=thumbv7-apple-darwin | FileCheck %s --check-prefix=DARWIN-THUMB2 4 ; RUN: llc < %s -O0 -verify-machineinstrs -fast-isel-abort -mtriple=thumbv7-linux-gnueabi | FileCheck %s --check-prefix=LINUX-THUMB2 5 6 define i8* @frameaddr_index0() nounwind { 7 entry: 8 ; DARWIN-ARM-LABEL: frameaddr_index0: 9 ; DARWIN-ARM: push {r7} 10 ; DARWIN-ARM: mov r7, sp 11 ; DARWIN-ARM: mov r0, r7 12 13 ; DARWIN-THUMB2-LABEL: frameaddr_index0: 14 ; DARWIN-THUMB2: str r7, [sp, #-4]! 15 ; DARWIN-THUMB2: mov r7, sp 16 ; DARWIN-THUMB2: mov r0, r7 17 18 ; LINUX-ARM-LABEL: frameaddr_index0: 19 ; LINUX-ARM: push {r11} 20 ; LINUX-ARM: mov r11, sp 21 ; LINUX-ARM: mov r0, r11 22 23 ; LINUX-THUMB2-LABEL: frameaddr_index0: 24 ; LINUX-THUMB2: str r7, [sp, #-4]! 25 ; LINUX-THUMB2: mov r7, sp 26 ; LINUX-THUMB2: mov r0, r7 27 28 %0 = call i8* @llvm.frameaddress(i32 0) 29 ret i8* %0 30 } 31 32 define i8* @frameaddr_index1() nounwind { 33 entry: 34 ; DARWIN-ARM-LABEL: frameaddr_index1: 35 ; DARWIN-ARM: push {r7} 36 ; DARWIN-ARM: mov r7, sp 37 ; DARWIN-ARM: mov r0, r7 38 ; DARWIN-ARM: ldr r0, [r0] 39 40 ; DARWIN-THUMB2-LABEL: frameaddr_index1: 41 ; DARWIN-THUMB2: str r7, [sp, #-4]! 42 ; DARWIN-THUMB2: mov r7, sp 43 ; DARWIN-THUMB2: mov r0, r7 44 ; DARWIN-THUMB2: ldr r0, [r0] 45 46 ; LINUX-ARM-LABEL: frameaddr_index1: 47 ; LINUX-ARM: push {r11} 48 ; LINUX-ARM: mov r11, sp 49 ; LINUX-ARM: ldr r0, [r11] 50 51 ; LINUX-THUMB2-LABEL: frameaddr_index1: 52 ; LINUX-THUMB2: str r7, [sp, #-4]! 53 ; LINUX-THUMB2: mov r7, sp 54 ; LINUX-THUMB2: mov r0, r7 55 ; LINUX-THUMB2: ldr r0, [r0] 56 57 %0 = call i8* @llvm.frameaddress(i32 1) 58 ret i8* %0 59 } 60 61 define i8* @frameaddr_index3() nounwind { 62 entry: 63 ; DARWIN-ARM-LABEL: frameaddr_index3: 64 ; DARWIN-ARM: push {r7} 65 ; DARWIN-ARM: mov r7, sp 66 ; DARWIN-ARM: mov r0, r7 67 ; DARWIN-ARM: ldr r0, [r0] 68 ; DARWIN-ARM: ldr r0, [r0] 69 ; DARWIN-ARM: ldr r0, [r0] 70 71 ; DARWIN-THUMB2-LABEL: frameaddr_index3: 72 ; DARWIN-THUMB2: str r7, [sp, #-4]! 73 ; DARWIN-THUMB2: mov r7, sp 74 ; DARWIN-THUMB2: mov r0, r7 75 ; DARWIN-THUMB2: ldr r0, [r0] 76 ; DARWIN-THUMB2: ldr r0, [r0] 77 ; DARWIN-THUMB2: ldr r0, [r0] 78 79 ; LINUX-ARM-LABEL: frameaddr_index3: 80 ; LINUX-ARM: push {r11} 81 ; LINUX-ARM: mov r11, sp 82 ; LINUX-ARM: ldr r0, [r11] 83 ; LINUX-ARM: ldr r0, [r0] 84 ; LINUX-ARM: ldr r0, [r0] 85 86 ; LINUX-THUMB2-LABEL: frameaddr_index3: 87 ; LINUX-THUMB2: str r7, [sp, #-4]! 88 ; LINUX-THUMB2: mov r7, sp 89 ; LINUX-THUMB2: mov r0, r7 90 ; LINUX-THUMB2: ldr r0, [r0] 91 ; LINUX-THUMB2: ldr r0, [r0] 92 ; LINUX-THUMB2: ldr r0, [r0] 93 94 %0 = call i8* @llvm.frameaddress(i32 3) 95 ret i8* %0 96 } 97 98 declare i8* @llvm.frameaddress(i32) nounwind readnone 99