[llvm] [RISCV] Prefer Zcmp push/pop instead of save-restore calls. (PR #66046)

Yeting Kuo via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 12 05:21:24 PDT 2023


================
@@ -131,27 +129,26 @@ define i32 @pushpopret0(i32 signext %size){
 ;
 ; RV32IZCMP-SR-LABEL: pushpopret0:
 ; RV32IZCMP-SR:       # %bb.0: # %entry
-; RV32IZCMP-SR-NEXT:    call t0, __riscv_save_1
+; RV32IZCMP-SR-NEXT:    cm.push {ra, s0}, -16
 ; RV32IZCMP-SR-NEXT:    .cfi_def_cfa_offset 16
-; RV32IZCMP-SR-NEXT:    .cfi_offset ra, -4
-; RV32IZCMP-SR-NEXT:    .cfi_offset s0, -8
----------------
yetingk wrote:

Actually I think the behavior of `cm.push {ra, s0}, -16` is
```
sd s0, -4(sp)
sd ra, -8(sp)
addi sp, sp, -16
```
And there is a llvm fix https://reviews.llvm.org/D156437 about that.

https://github.com/llvm/llvm-project/pull/66046


More information about the llvm-commits mailing list