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

            Bug ID: 127565
           Summary: usmul<mode> should be defined
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---
            Target: aarch64

Created attachment 65664
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=65664&action=edit
testcase

So aarch64 backend does not have usmul<mode> defined.  So for 32 widening to
128bit and finding an unsigned saturated mutliply, does not give decent code.

Even code using __builtin_umul_overflow will cause to use cmp with lsr rather
than just a tst instruction.

all 3 functions of the attached sources should produce something like:
```
        umull   x0, w0, w1
        cmp     xzr, x0, lsr 32
        csinv   w0, w0, wzr, eq
        ret
```

or (which is what clang does)
```
        umull   x8, w0, w1
        tst     x8, #0xffffffff00000000
        csinv   w0, w8, wzr, eq
        ret
```
  • [Bug target/127565] New: usmul<... pinskia at gcc dot gnu.org via Gcc-bugs

Reply via email to