rv64.S (3973B)
1 // Consolidated save/restore helpers for kit's libkit_rt.a (RISC-V rv64). 2 // The build assembles only this one file for rv64; the per-op files are 3 // #included as snippets and not directly built. 4 // License: Apache-2.0 WITH LLVM-exception (see lib/LICENSE-compiler-rt.txt). 5 6 // ---- save_rv64.S ---- 7 .text 8 9 .globl __riscv_save_12 10 .type __riscv_save_12,@function 11 __riscv_save_12: 12 addi sp, sp, -112 13 mv t1, zero 14 sd s11, 8(sp) 15 j .Lriscv_save_11_10 16 17 .globl __riscv_save_11 18 .type __riscv_save_11,@function 19 .globl __riscv_save_10 20 .type __riscv_save_10,@function 21 __riscv_save_11: 22 __riscv_save_10: 23 addi sp, sp, -112 24 li t1, 16 25 .Lriscv_save_11_10: 26 sd s10, 16(sp) 27 sd s9, 24(sp) 28 j .Lriscv_save_9_8 29 30 .globl __riscv_save_9 31 .type __riscv_save_9,@function 32 .globl __riscv_save_8 33 .type __riscv_save_8,@function 34 __riscv_save_9: 35 __riscv_save_8: 36 addi sp, sp, -112 37 li t1, 32 38 .Lriscv_save_9_8: 39 sd s8, 32(sp) 40 sd s7, 40(sp) 41 j .Lriscv_save_7_6 42 43 .globl __riscv_save_7 44 .type __riscv_save_7,@function 45 .globl __riscv_save_6 46 .type __riscv_save_6,@function 47 __riscv_save_7: 48 __riscv_save_6: 49 addi sp, sp, -112 50 li t1, 48 51 .Lriscv_save_7_6: 52 sd s6, 48(sp) 53 sd s5, 56(sp) 54 j .Lriscv_save_5_4 55 56 .globl __riscv_save_5 57 .type __riscv_save_5,@function 58 .globl __riscv_save_4 59 .type __riscv_save_4,@function 60 __riscv_save_5: 61 __riscv_save_4: 62 addi sp, sp, -112 63 li t1, 64 64 .Lriscv_save_5_4: 65 sd s4, 64(sp) 66 sd s3, 72(sp) 67 j .Lriscv_save_3_2 68 69 .globl __riscv_save_3 70 .type __riscv_save_3,@function 71 .globl __riscv_save_2 72 .type __riscv_save_2,@function 73 __riscv_save_3: 74 __riscv_save_2: 75 addi sp, sp, -112 76 li t1, 80 77 .Lriscv_save_3_2: 78 sd s2, 80(sp) 79 sd s1, 88(sp) 80 sd s0, 96(sp) 81 sd ra, 104(sp) 82 add sp, sp, t1 83 jr t0 84 85 .globl __riscv_save_1 86 .type __riscv_save_1,@function 87 .globl __riscv_save_0 88 .type __riscv_save_0,@function 89 __riscv_save_1: 90 __riscv_save_0: 91 addi sp, sp, -16 92 sd s0, 0(sp) 93 sd ra, 8(sp) 94 jr t0 95 // ---- restore_rv64.S ---- 96 .text 97 98 .globl __riscv_restore_12 99 .type __riscv_restore_12,@function 100 __riscv_restore_12: 101 ld s11, 8(sp) 102 addi sp, sp, 16 103 // fallthrough into __riscv_restore_11/10 104 105 .globl __riscv_restore_11 106 .type __riscv_restore_11,@function 107 .globl __riscv_restore_10 108 .type __riscv_restore_10,@function 109 __riscv_restore_11: 110 __riscv_restore_10: 111 ld s10, 0(sp) 112 ld s9, 8(sp) 113 addi sp, sp, 16 114 // fallthrough into __riscv_restore_9/8 115 116 .globl __riscv_restore_9 117 .type __riscv_restore_9,@function 118 .globl __riscv_restore_8 119 .type __riscv_restore_8,@function 120 __riscv_restore_9: 121 __riscv_restore_8: 122 ld s8, 0(sp) 123 ld s7, 8(sp) 124 addi sp, sp, 16 125 // fallthrough into __riscv_restore_7/6 126 127 .globl __riscv_restore_7 128 .type __riscv_restore_7,@function 129 .globl __riscv_restore_6 130 .type __riscv_restore_6,@function 131 __riscv_restore_7: 132 __riscv_restore_6: 133 ld s6, 0(sp) 134 ld s5, 8(sp) 135 addi sp, sp, 16 136 // fallthrough into __riscv_restore_5/4 137 138 .globl __riscv_restore_5 139 .type __riscv_restore_5,@function 140 .globl __riscv_restore_4 141 .type __riscv_restore_4,@function 142 __riscv_restore_5: 143 __riscv_restore_4: 144 ld s4, 0(sp) 145 ld s3, 8(sp) 146 addi sp, sp, 16 147 // fallthrough into __riscv_restore_3/2 148 149 .globl __riscv_restore_3 150 .type __riscv_restore_3,@function 151 .globl __riscv_restore_2 152 .type __riscv_restore_2,@function 153 __riscv_restore_3: 154 __riscv_restore_2: 155 ld s2, 0(sp) 156 ld s1, 8(sp) 157 addi sp, sp, 16 158 // fallthrough into __riscv_restore_1/0 159 160 .globl __riscv_restore_1 161 .type __riscv_restore_1,@function 162 .globl __riscv_restore_0 163 .type __riscv_restore_0,@function 164 __riscv_restore_1: 165 __riscv_restore_0: 166 ld s0, 0(sp) 167 ld ra, 8(sp) 168 addi sp, sp, 16 169 ret