aboutsummaryrefslogtreecommitdiff
path: root/compiler-rt/lib/builtins/riscv/save.S
diff options
context:
space:
mode:
Diffstat (limited to 'compiler-rt/lib/builtins/riscv/save.S')
-rw-r--r--compiler-rt/lib/builtins/riscv/save.S42
1 files changed, 42 insertions, 0 deletions
diff --git a/compiler-rt/lib/builtins/riscv/save.S b/compiler-rt/lib/builtins/riscv/save.S
index 85501ae..3e04417 100644
--- a/compiler-rt/lib/builtins/riscv/save.S
+++ b/compiler-rt/lib/builtins/riscv/save.S
@@ -18,6 +18,8 @@
#if __riscv_xlen == 32
+#ifndef __riscv_32e
+
.globl __riscv_save_12
.type __riscv_save_12,@function
__riscv_save_12:
@@ -92,8 +94,29 @@ __riscv_save_0:
sw ra, 12(sp)
jr t0
+#else
+
+ .globl __riscv_save_2
+ .type __riscv_save_2,@function
+ .globl __riscv_save_1
+ .type __riscv_save_1,@function
+ .globl __riscv_save_0
+ .type __riscv_save_0,@function
+__riscv_save_2:
+__riscv_save_1:
+__riscv_save_0:
+ addi sp, sp, -12
+ sw s1, 0(sp)
+ sw s0, 4(sp)
+ sw ra, 8(sp)
+ jr t0
+
+#endif
+
#elif __riscv_xlen == 64
+#ifndef __riscv_64e
+
.globl __riscv_save_12
.type __riscv_save_12,@function
__riscv_save_12:
@@ -182,5 +205,24 @@ __riscv_save_0:
jr t0
#else
+
+ .globl __riscv_save_2
+ .type __riscv_save_2,@function
+ .globl __riscv_save_1
+ .type __riscv_save_1,@function
+ .globl __riscv_save_0
+ .type __riscv_save_0,@function
+__riscv_save_2:
+__riscv_save_1:
+__riscv_save_0:
+ addi sp, sp, -24
+ sd s1, 0(sp)
+ sd s0, 8(sp)
+ sd ra, 16(sp)
+ jr t0
+
+#endif
+
+#else
# error "xlen must be 32 or 64 for save-restore implementation
#endif