rv32.S (3590B)
1 // Consolidated save/restore helpers for kit's libkit_rt.a (RISC-V rv32). 2 // The build assembles only this one file for rv32; 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_rv32.S ---- 7 .text 8 9 .globl __riscv_save_12 10 .type __riscv_save_12,@function 11 __riscv_save_12: 12 addi sp, sp, -64 13 mv t1, zero 14 sw s11, 12(sp) 15 j .Lriscv_save_11_8 16 17 .globl __riscv_save_11 18 .type __riscv_save_11,@function 19 .globl __riscv_save_10 20 .type __riscv_save_10,@function 21 .globl __riscv_save_9 22 .type __riscv_save_9,@function 23 .globl __riscv_save_8 24 .type __riscv_save_8,@function 25 __riscv_save_11: 26 __riscv_save_10: 27 __riscv_save_9: 28 __riscv_save_8: 29 addi sp, sp, -64 30 li t1, 16 31 .Lriscv_save_11_8: 32 sw s10, 16(sp) 33 sw s9, 20(sp) 34 sw s8, 24(sp) 35 sw s7, 28(sp) 36 j .Lriscv_save_7_4 37 38 .globl __riscv_save_7 39 .type __riscv_save_7,@function 40 .globl __riscv_save_6 41 .type __riscv_save_6,@function 42 .globl __riscv_save_5 43 .type __riscv_save_5,@function 44 .globl __riscv_save_4 45 .type __riscv_save_4,@function 46 __riscv_save_7: 47 __riscv_save_6: 48 __riscv_save_5: 49 __riscv_save_4: 50 addi sp, sp, -64 51 li t1, 32 52 .Lriscv_save_7_4: 53 sw s6, 32(sp) 54 sw s5, 36(sp) 55 sw s4, 40(sp) 56 sw s3, 44(sp) 57 sw s2, 48(sp) 58 sw s1, 52(sp) 59 sw s0, 56(sp) 60 sw ra, 60(sp) 61 add sp, sp, t1 62 jr t0 63 64 .globl __riscv_save_3 65 .type __riscv_save_3,@function 66 .globl __riscv_save_2 67 .type __riscv_save_2,@function 68 .globl __riscv_save_1 69 .type __riscv_save_1,@function 70 .globl __riscv_save_0 71 .type __riscv_save_0,@function 72 __riscv_save_3: 73 __riscv_save_2: 74 __riscv_save_1: 75 __riscv_save_0: 76 addi sp, sp, -16 77 sw s2, 0(sp) 78 sw s1, 4(sp) 79 sw s0, 8(sp) 80 sw ra, 12(sp) 81 jr t0 82 // ---- restore_rv32.S ---- 83 .text 84 85 .globl __riscv_restore_12 86 .type __riscv_restore_12,@function 87 __riscv_restore_12: 88 lw s11, 12(sp) 89 addi sp, sp, 16 90 // fallthrough into __riscv_restore_11/10/9/8 91 92 .globl __riscv_restore_11 93 .type __riscv_restore_11,@function 94 .globl __riscv_restore_10 95 .type __riscv_restore_10,@function 96 .globl __riscv_restore_9 97 .type __riscv_restore_9,@function 98 .globl __riscv_restore_8 99 .type __riscv_restore_8,@function 100 __riscv_restore_11: 101 __riscv_restore_10: 102 __riscv_restore_9: 103 __riscv_restore_8: 104 lw s10, 0(sp) 105 lw s9, 4(sp) 106 lw s8, 8(sp) 107 lw s7, 12(sp) 108 addi sp, sp, 16 109 // fallthrough into __riscv_restore_7/6/5/4 110 111 .globl __riscv_restore_7 112 .type __riscv_restore_7,@function 113 .globl __riscv_restore_6 114 .type __riscv_restore_6,@function 115 .globl __riscv_restore_5 116 .type __riscv_restore_5,@function 117 .globl __riscv_restore_4 118 .type __riscv_restore_4,@function 119 __riscv_restore_7: 120 __riscv_restore_6: 121 __riscv_restore_5: 122 __riscv_restore_4: 123 lw s6, 0(sp) 124 lw s5, 4(sp) 125 lw s4, 8(sp) 126 lw s3, 12(sp) 127 addi sp, sp, 16 128 // fallthrough into __riscv_restore_3/2/1/0 129 130 .globl __riscv_restore_3 131 .type __riscv_restore_3,@function 132 .globl __riscv_restore_2 133 .type __riscv_restore_2,@function 134 .globl __riscv_restore_1 135 .type __riscv_restore_1,@function 136 .globl __riscv_restore_0 137 .type __riscv_restore_0,@function 138 __riscv_restore_3: 139 __riscv_restore_2: 140 __riscv_restore_1: 141 __riscv_restore_0: 142 lw s2, 0(sp) 143 lw s1, 4(sp) 144 lw s0, 8(sp) 145 lw ra, 12(sp) 146 addi sp, sp, 16 147 ret