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

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
Created attachment 52693
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52693&action=edit
Demonstrator patch

This patch adds:
- modeling of insn sad.u32 in the .md file
- peephole2 to generate it
  (which is incomplete, it needs some safety-checks related to
  using unique intermediate regs)
- extra instance of peephole2 pass (otherwise, the peephole is not triggered)
- extra instance of fast_rtl_dce pass (otherwise, unused intermediate
  insn are not cleaned up)

So for the usad_2 in the test-case, we have without the patch:
...
                cvt.u64.u32     %r32, %r28;                                     
                cvt.u64.u32     %r33, %r29;                                     
                sub.u64 %r34, %r32, %r33;                                       
                abs.s64 %r35, %r34;                                             
                cvt.u32.u64     %r36, %r35;                                     
                add.u32 %value, %r36, %r30;                                     
...
and with:
...
                sad.u32 %value, %r28, %r29, %r30;                               
...

Reply via email to