https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108248

            Bug ID: 108248
           Summary: Some insns in the risc-v backend do not have mappings
                    to functional units
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: law at gcc dot gnu.org
                CC: rzinsly at ventanamicro dot com
  Target Milestone: ---
            Target: risc-v

If you review scheduling dumps for risc-v you will see various insns with no
reservations.  For example:

;;       11--> b  3: i  58 r184=smax(r154,r183)                    :nothing
;;        3--> b  3: i  55 r182=r180<<0x3+r160                     :nothing
;;        8--> b  0: i  16 r167=r193<<0x3+r193                     :nothing
;;       13--> b  0: i  19 r155=r167<<0x3+r188                     :nothing
;;        0--> b  0: i  26 r172=r164<<0x3+r164                     :nothing
;;        2--> b  0: i  23 r144=r161<<0x3+r159                     :nothing

It's worth noting these all seem to be coming from the bitmanip extensions. 
However, there well could be others.

It would be advisable to ensure that all insns have appropriate mappings to
functional units.

This patch from Jivan would help, but I think a thorough review to ensure
everything has a mapping would be advisable:
diff --git a/gcc/config/riscv/generic.md b/gcc/config/riscv/generic.md
index 1a209dcb997..296c4e24923 100644
--- a/gcc/config/riscv/generic.md
+++ b/gcc/config/riscv/generic.md
@@ -88,3 +88,8 @@
   (and (eq_attr "tune" "generic")
        (eq_attr "type" "fsqrt"))
   "fdivsqrt*25")
+
+(define_insn_reservation "generic_smax" 1
+  (and (eq_attr "tune" "generic")
+       (eq_attr "type" "bitmanip"))
+  "alu")

Reply via email to