On Sun, May 31, 2026 at 05:34:13PM +0200, Georg-Johann Lay wrote:
> Am 23.05.26 um 08:58 schrieb Dimitar Dimitrov:
> > Refactor patterns to use hard register constraints.  With this, all the
> > single-register classes currently defined for PRU can be removed.
> > 
> > gcc/ChangeLog:
> > 
> >     * config/pru/constraints.md (MULDST_REGS): Remove constraint.
> >     (MULSRC0_REGS): Ditto.
> >     (MULSRC1_REGS): Ditto.
> >     * config/pru/predicates.md (pru_muldst_operand): Compare
> >     register number directly.
> >     (pru_mulsrc0_operand): Ditto.
> >     (pru_mulsrc1_operand): Ditto.
> >     * config/pru/pru.h (enum reg_class): Remove single-reg classes.
> >     (REG_CLASS_NAMES): Ditto.
> >     (REGNO_REG_CLASS): Ditto.
> >     * config/pru/pru.md (mulsi3): Switch to hard register constraints.
> >     (umulsidi3): Ditto.
> > 
> > Signed-off-by: Dimitar Dimitrov <[email protected]>
> > ---
> >   gcc/config/pru/constraints.md | 14 --------------
> >   gcc/config/pru/predicates.md  |  9 +++------
> >   gcc/config/pru/pru.h          | 18 +-----------------
> >   gcc/config/pru/pru.md         | 14 +++++++-------
> >   4 files changed, 11 insertions(+), 44 deletions(-)
> > 
> > diff --git a/gcc/config/pru/pru.md b/gcc/config/pru/pru.md
> > index 93638963d29..50ef65fc512 100644
> > --- a/gcc/config/pru/pru.md
> > +++ b/gcc/config/pru/pru.md
> > @@ -1208,26 +1208,26 @@ (define_insn "one_cmpldi2"
> >     [(set_attr "type" "alu")
> >      (set_attr "length" "8")])
> >   
> > -;; Multiply instruction.  The nop is required to ensure that Rmd0 and Rms0
> > +;; Multiply instruction.  The nop is required to ensure that source
> >   ;; registers are sampled and multiplication is executed on those values.
> >   ;; Only after that one cycle can xin obtain the result.
> >   (define_insn "mulsi3"
> > -  [(set (match_operand:SI 0 "pru_muldst_operand"      "=Rmd0")
> > -   (mult:SI (match_operand:SI 1 "pru_mulsrc0_operand" "%Rms0")
> > -            (match_operand:SI 2 "pru_mulsrc1_operand" "Rms1")))]
> > +  [(set (match_operand:SI 0 "pru_muldst_operand"      "={r26}")
> > +   (mult:SI (match_operand:SI 1 "pru_mulsrc0_operand" "%{r28}")
> > +            (match_operand:SI 2 "pru_mulsrc1_operand" "{r29}")))]
> 
> Hi Dimitar,
> 
> from my experience, in order to make the "%" work with hard-reg
> constraints, a 2nd constraint alternative with swapped constraints is
> needed.  And RA needs some patching to make it work, see for example
> 
> https://gcc.gnu.org/pipermail/gcc-patches/2026-May/718682.html
> 
> and the patch attached there.

Thank you for the tip.  I confirm that the "%" modifier does not
work with hard-reg constraints, so I'll revert this patch.  

Regards,
Dimitar

Reply via email to