From: Richard Braun <[email protected]>

Instructions have two time-related units associated with them: the
number of delay slots, and the functional unit latency. But some
floating-point multiplication instructions have a functional unit
latency that actually varies depending on the following instructions
scheduled on the same functional unit [1].

For example, the MPYDP instruction is described with a functional unit
latency of 4, but there are additional "cycle-other resource conflicts"
with a following MPYSPDP instruction.

In order to describe that, this patch introduces one pseudo functional
unit per affected instruction, and augments reservations individually
for all implemented instructions that may be affected when following.

[1] 4.3.2 .M-Unit Constraints - SPRUFE8B TMS320C674x DSP CPU and
Instruction Set Reference Guide

gcc/
        * gcc/config/c6x/c6x-sched.md.in (mpydp_m_N__CROSS_,
        mpyspdp_m_N__CROSS_, mpysp2dp_m_N__CROSS_): Update reservations.
        * gcc/config/c6x/c6x.md (m1dp, m1spdp, m2dp, m2spdp): New CPU units.

Signed-off-by: Richard Braun <[email protected]>
---
 gcc/config/c6x/c6x-sched.md.in | 6 +++---
 gcc/config/c6x/c6x.md          | 4 ++++
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/gcc/config/c6x/c6x-sched.md.in b/gcc/config/c6x/c6x-sched.md.in
index 33146a97ccc..3469485f699 100644
--- a/gcc/config/c6x/c6x-sched.md.in
+++ b/gcc/config/c6x/c6x-sched.md.in
@@ -213,18 +213,18 @@
        (and (eq_attr "cross" "_CROSS_")
            (and (eq_attr "units" "m")
                 (eq_attr "dest_regfile" "_RF_"))))
-  "(m_N__CUNIT_)*4,nothing*4,m_N_w*2")
+  "(m_N__CUNIT_)*4+m_N_dp*4,m_N_spdp*3,nothing,m_N_w*2")
 
 (define_insn_reservation "mpyspdp_m_N__CROSS_" 7
   (and (eq_attr "type" "mpyspdp")
        (and (eq_attr "cross" "_CROSS_")
            (and (eq_attr "units" "m")
                 (eq_attr "dest_regfile" "_RF_"))))
-  "(m_N__CUNIT_)*2,nothing*3,m_N_w*2")
+  "(m_N__CUNIT_)*3+m_N_spdp*3,m_N_dp,nothing,m_N_w*2")
 
 (define_insn_reservation "mpysp2dp_m_N__CROSS_" 5
   (and (eq_attr "type" "mpysp2dp")
        (and (eq_attr "cross" "_CROSS_")
            (and (eq_attr "units" "m")
                 (eq_attr "dest_regfile" "_RF_"))))
-  "m_N__CUNIT_,nothing*2,m_N_w*2")
+  "(m_N__CUNIT_)*2+m_N_dp*2+m_N_spdp*2,nothing,m_N_w*2")
diff --git a/gcc/config/c6x/c6x.md b/gcc/config/c6x/c6x.md
index 88b9291ae23..a2c9ccfd816 100644
--- a/gcc/config/c6x/c6x.md
+++ b/gcc/config/c6x/c6x.md
@@ -274,12 +274,16 @@
 (define_cpu_unit "l1w,s1w" "c6x_1")
 (define_query_cpu_unit "m1" "c6x_m1")
 (define_cpu_unit "m1w" "c6x_m1")
+(define_cpu_unit "m1dp" "c6x_m1")
+(define_cpu_unit "m1spdp" "c6x_m1")
 (define_cpu_unit "t1" "c6x_t1")
 (define_query_cpu_unit "d2,l2,s2" "c6x_2")
 (define_cpu_unit "x2" "c6x_2")
 (define_cpu_unit "l2w,s2w" "c6x_2")
 (define_query_cpu_unit "m2" "c6x_m2")
 (define_cpu_unit "m2w" "c6x_m2")
+(define_cpu_unit "m2dp" "c6x_m1")
+(define_cpu_unit "m2spdp" "c6x_m2")
 (define_cpu_unit "t2" "c6x_t2")
 ;; A special set of units used to identify specific reservations, rather than
 ;; just units.
-- 
2.47.3

Reply via email to