-
- Downloads
RISC-V: Save and restore FCSR in interrupt functions to avoid program errors.
In order to avoid interrupt functions to change the FCSR, it needs to be saved and restored at the beginning and end of the function. gcc/ChangeLog: * config/riscv/riscv.cc (riscv_compute_frame_info): Allocate frame for FCSR. (riscv_for_each_saved_reg): Save and restore FCSR in interrupt functions. * config/riscv/riscv.md (riscv_frcsr): New patterns. (riscv_fscsr): Likewise. gcc/testsuite/ChangeLog: * gcc.target/riscv/interrupt-fcsr-1.c: New test. * gcc.target/riscv/interrupt-fcsr-2.c: New test. * gcc.target/riscv/interrupt-fcsr-3.c: New test.
Showing
- gcc/config/riscv/riscv.cc 45 additions, 3 deletionsgcc/config/riscv/riscv.cc
- gcc/config/riscv/riscv.md 13 additions, 0 deletionsgcc/config/riscv/riscv.md
- gcc/testsuite/gcc.target/riscv/interrupt-fcsr-1.c 15 additions, 0 deletionsgcc/testsuite/gcc.target/riscv/interrupt-fcsr-1.c
- gcc/testsuite/gcc.target/riscv/interrupt-fcsr-2.c 15 additions, 0 deletionsgcc/testsuite/gcc.target/riscv/interrupt-fcsr-2.c
- gcc/testsuite/gcc.target/riscv/interrupt-fcsr-3.c 14 additions, 0 deletionsgcc/testsuite/gcc.target/riscv/interrupt-fcsr-3.c
Loading
Please register or sign in to comment