1 ; RUN: llc < %s -O0 -fast-isel-abort -relocation-model=dynamic-no-pic -mtriple=armv7-apple-ios | FileCheck %s --check-prefix=ARM 2 ; RUN: llc < %s -O0 -fast-isel-abort -relocation-model=dynamic-no-pic -mtriple=thumbv7-apple-ios | FileCheck %s --check-prefix=THUMB 3 ; RUN: llc < %s -O0 -fast-isel-abort -relocation-model=dynamic-no-pic -mtriple=armv7-apple-ios -arm-long-calls | FileCheck %s --check-prefix=ARM-LONG 4 ; RUN: llc < %s -O0 -fast-isel-abort -relocation-model=dynamic-no-pic -mtriple=thumbv7-apple-ios -arm-long-calls | FileCheck %s --check-prefix=THUMB-LONG 5 6 @message1 = global [60 x i8] c"The LLVM Compiler Infrastructure\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", align 1 7 @temp = common global [60 x i8] zeroinitializer, align 1 8 9 define void @t1() nounwind ssp { 10 ; ARM: t1 11 ; ARM: movw r0, :lower16:_message1 12 ; ARM: movt r0, :upper16:_message1 13 ; ARM: add r0, r0, #5 14 ; ARM: movw r1, #64 15 ; ARM: movw r2, #10 16 ; ARM: uxtb r1, r1 17 ; ARM: bl _memset 18 ; ARM-LONG: t1 19 ; ARM-LONG: movw r3, :lower16:L_memset$non_lazy_ptr 20 ; ARM-LONG: movt r3, :upper16:L_memset$non_lazy_ptr 21 ; ARM-LONG: ldr r3, [r3] 22 ; ARM-LONG: blx r3 23 ; THUMB: t1 24 ; THUMB: movw r0, :lower16:_message1 25 ; THUMB: movt r0, :upper16:_message1 26 ; THUMB: adds r0, #5 27 ; THUMB: movs r1, #64 28 ; THUMB: movt r1, #0 29 ; THUMB: movs r2, #10 30 ; THUMB: movt r2, #0 31 ; THUMB: uxtb r1, r1 32 ; THUMB: bl _memset 33 ; THUMB-LONG: t1 34 ; THUMB-LONG: movw r3, :lower16:L_memset$non_lazy_ptr 35 ; THUMB-LONG: movt r3, :upper16:L_memset$non_lazy_ptr 36 ; THUMB-LONG: ldr r3, [r3] 37 ; THUMB-LONG: blx r3 38 call void @llvm.memset.p0i8.i32(i8* getelementptr inbounds ([60 x i8]* @message1, i32 0, i32 5), i8 64, i32 10, i32 1, i1 false) 39 ret void 40 } 41 42 declare void @llvm.memset.p0i8.i32(i8* nocapture, i8, i32, i32, i1) nounwind 43 44 define void @t2() nounwind ssp { 45 ; ARM: t2 46 ; ARM: movw r0, :lower16:L_temp$non_lazy_ptr 47 ; ARM: movt r0, :upper16:L_temp$non_lazy_ptr 48 ; ARM: ldr r0, [r0] 49 ; ARM: add r1, r0, #4 50 ; ARM: add r0, r0, #16 51 ; ARM: movw r2, #17 52 ; ARM: str r0, [sp] @ 4-byte Spill 53 ; ARM: mov r0, r1 54 ; ARM: ldr r1, [sp] @ 4-byte Reload 55 ; ARM: bl _memcpy 56 ; ARM-LONG: t2 57 ; ARM-LONG: movw r3, :lower16:L_memcpy$non_lazy_ptr 58 ; ARM-LONG: movt r3, :upper16:L_memcpy$non_lazy_ptr 59 ; ARM-LONG: ldr r3, [r3] 60 ; ARM-LONG: blx r3 61 ; THUMB: t2 62 ; THUMB: movw r0, :lower16:L_temp$non_lazy_ptr 63 ; THUMB: movt r0, :upper16:L_temp$non_lazy_ptr 64 ; THUMB: ldr r0, [r0] 65 ; THUMB: adds r1, r0, #4 66 ; THUMB: adds r0, #16 67 ; THUMB: movs r2, #17 68 ; THUMB: movt r2, #0 69 ; THUMB: mov r0, r1 70 ; THUMB: bl _memcpy 71 ; THUMB-LONG: t2 72 ; THUMB-LONG: movw r3, :lower16:L_memcpy$non_lazy_ptr 73 ; THUMB-LONG: movt r3, :upper16:L_memcpy$non_lazy_ptr 74 ; THUMB-LONG: ldr r3, [r3] 75 ; THUMB-LONG: blx r3 76 call void @llvm.memcpy.p0i8.p0i8.i32(i8* getelementptr inbounds ([60 x i8]* @temp, i32 0, i32 4), i8* getelementptr inbounds ([60 x i8]* @temp, i32 0, i32 16), i32 17, i32 1, i1 false) 77 ret void 78 } 79 80 declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind 81 82 define void @t3() nounwind ssp { 83 ; ARM: t3 84 ; ARM: movw r0, :lower16:L_temp$non_lazy_ptr 85 ; ARM: movt r0, :upper16:L_temp$non_lazy_ptr 86 ; ARM: ldr r0, [r0] 87 ; ARM: add r1, r0, #4 88 ; ARM: add r0, r0, #16 89 ; ARM: movw r2, #10 90 ; ARM: mov r0, r1 91 ; ARM: bl _memmove 92 ; ARM-LONG: t3 93 ; ARM-LONG: movw r3, :lower16:L_memmove$non_lazy_ptr 94 ; ARM-LONG: movt r3, :upper16:L_memmove$non_lazy_ptr 95 ; ARM-LONG: ldr r3, [r3] 96 ; ARM-LONG: blx r3 97 ; THUMB: t3 98 ; THUMB: movw r0, :lower16:L_temp$non_lazy_ptr 99 ; THUMB: movt r0, :upper16:L_temp$non_lazy_ptr 100 ; THUMB: ldr r0, [r0] 101 ; THUMB: adds r1, r0, #4 102 ; THUMB: adds r0, #16 103 ; THUMB: movs r2, #10 104 ; THUMB: movt r2, #0 105 ; THUMB: mov r0, r1 106 ; THUMB: bl _memmove 107 ; THUMB-LONG: t3 108 ; THUMB-LONG: movw r3, :lower16:L_memmove$non_lazy_ptr 109 ; THUMB-LONG: movt r3, :upper16:L_memmove$non_lazy_ptr 110 ; THUMB-LONG: ldr r3, [r3] 111 ; THUMB-LONG: blx r3 112 call void @llvm.memmove.p0i8.p0i8.i32(i8* getelementptr inbounds ([60 x i8]* @temp, i32 0, i32 4), i8* getelementptr inbounds ([60 x i8]* @temp, i32 0, i32 16), i32 10, i32 1, i1 false) 113 ret void 114 } 115 116 define void @t4() nounwind ssp { 117 ; ARM: t4 118 ; ARM: movw r0, :lower16:L_temp$non_lazy_ptr 119 ; ARM: movt r0, :upper16:L_temp$non_lazy_ptr 120 ; ARM: ldr r0, [r0] 121 ; ARM: ldr r1, [r0, #16] 122 ; ARM: str r1, [r0, #4] 123 ; ARM: ldr r1, [r0, #20] 124 ; ARM: str r1, [r0, #8] 125 ; ARM: ldrh r1, [r0, #24] 126 ; ARM: strh r1, [r0, #12] 127 ; ARM: bx lr 128 ; THUMB: movw r0, :lower16:L_temp$non_lazy_ptr 129 ; THUMB: movt r0, :upper16:L_temp$non_lazy_ptr 130 ; THUMB: ldr r0, [r0] 131 ; THUMB: ldr r1, [r0, #16] 132 ; THUMB: str r1, [r0, #4] 133 ; THUMB: ldr r1, [r0, #20] 134 ; THUMB: str r1, [r0, #8] 135 ; THUMB: ldrh r1, [r0, #24] 136 ; THUMB: strh r1, [r0, #12] 137 ; THUMB: bx lr 138 call void @llvm.memcpy.p0i8.p0i8.i32(i8* getelementptr inbounds ([60 x i8]* @temp, i32 0, i32 4), i8* getelementptr inbounds ([60 x i8]* @temp, i32 0, i32 16), i32 10, i32 1, i1 false) 139 ret void 140 } 141 142 declare void @llvm.memmove.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind 143