1 //===-- restore.S - restore up to 12 callee-save registers ----------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // Multiple entry points depending on number of registers to restore
11 //===----------------------------------------------------------------------===//
13 // All of the entry points are in the same section since we rely on many of
14 // them falling through into each other and don't want the linker to
15 // accidentally split them up, garbage collect, or reorder them.
17 // The entry points are grouped up into 2s for rv64 and 4s for rv32 since this
18 // is the minimum grouping which will maintain the required 16-byte stack
23 #if __riscv_xlen == 32
25 .globl __riscv_restore_12
26 .type __riscv_restore_12,@function
30 // fallthrough into __riscv_restore_11/10/9/8
32 .globl __riscv_restore_11
33 .type __riscv_restore_11,@function
34 .globl __riscv_restore_10
35 .type __riscv_restore_10,@function
36 .globl __riscv_restore_9
37 .type __riscv_restore_9,@function
38 .globl __riscv_restore_8
39 .type __riscv_restore_8,@function
49 // fallthrough into __riscv_restore_7/6/5/4
51 .globl __riscv_restore_7
52 .type __riscv_restore_7,@function
53 .globl __riscv_restore_6
54 .type __riscv_restore_6,@function
55 .globl __riscv_restore_5
56 .type __riscv_restore_5,@function
57 .globl __riscv_restore_4
58 .type __riscv_restore_4,@function
68 // fallthrough into __riscv_restore_3/2/1/0
70 .globl __riscv_restore_3
71 .type __riscv_restore_3,@function
72 .globl __riscv_restore_2
73 .type __riscv_restore_2,@function
74 .globl __riscv_restore_1
75 .type __riscv_restore_1,@function
76 .globl __riscv_restore_0
77 .type __riscv_restore_0,@function
89 #elif __riscv_xlen == 64
91 .globl __riscv_restore_12
92 .type __riscv_restore_12,@function
96 // fallthrough into __riscv_restore_11/10
98 .globl __riscv_restore_11
99 .type __riscv_restore_11,@function
100 .globl __riscv_restore_10
101 .type __riscv_restore_10,@function
107 // fallthrough into __riscv_restore_9/8
109 .globl __riscv_restore_9
110 .type __riscv_restore_9,@function
111 .globl __riscv_restore_8
112 .type __riscv_restore_8,@function
118 // fallthrough into __riscv_restore_7/6
120 .globl __riscv_restore_7
121 .type __riscv_restore_7,@function
122 .globl __riscv_restore_6
123 .type __riscv_restore_6,@function
129 // fallthrough into __riscv_restore_5/4
131 .globl __riscv_restore_5
132 .type __riscv_restore_5,@function
133 .globl __riscv_restore_4
134 .type __riscv_restore_4,@function
140 // fallthrough into __riscv_restore_3/2
142 .globl __riscv_restore_3
143 .type __riscv_restore_3,@function
144 .globl __riscv_restore_2
145 .type __riscv_restore_2,@function
151 // fallthrough into __riscv_restore_1/0
153 .globl __riscv_restore_1
154 .type __riscv_restore_1,@function
155 .globl __riscv_restore_0
156 .type __riscv_restore_0,@function
165 # error "xlen must be 32 or 64 for save-restore implementation