riscv-preferred-mode-fix.patch 737 B

12345678910111213141516171819
  1. diff -Nur gcc-git.orig/gcc/config/riscv/riscv.c gcc-git/gcc/config/riscv/riscv.c
  2. --- gcc-git.orig/gcc/config/riscv/riscv.c 2017-03-11 21:53:53.000000000 +0100
  3. +++ gcc-git/gcc/config/riscv/riscv.c 2017-03-11 22:11:38.830507954 +0100
  4. @@ -3634,8 +3634,13 @@
  5. static reg_class_t
  6. riscv_preferred_reload_class (rtx x ATTRIBUTE_UNUSED, reg_class_t rclass)
  7. {
  8. - return reg_class_subset_p (FP_REGS, rclass) ? FP_REGS :
  9. - reg_class_subset_p (GR_REGS, rclass) ? GR_REGS :
  10. + machine_mode mode = GET_MODE (x);
  11. + if ((GET_MODE_CLASS (mode) == MODE_FLOAT
  12. + || GET_MODE_CLASS (mode) == MODE_COMPLEX_FLOAT)
  13. + && reg_class_subset_p (FP_REGS, rclass))
  14. + return FP_REGS;
  15. +
  16. + return reg_class_subset_p (GR_REGS, rclass) ? GR_REGS :
  17. rclass;
  18. }