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

            Bug ID: 88403
           Summary: [Mips,AArch64] The gcse prevents if-conversion
           Product: gcc
           Version: 7.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dragan.mladjeno...@rt-rk.com
  Target Milestone: ---

Created attachment 45183
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45183&action=edit
mark.c

If I compile the marck.c with aarch64-linux-gnu-gcc -O3 or mipsel-linux-gnu-gcc
-mips32r6 -mbranch-cost=5 the inner if does not get transformed to use
conditional moves. 

mips32r6 example:

        li      $13,5000                        # 0x1388
$L4:
...
        subu    $3,$2,$3
        bgec    $13,$3,$L3
        addiu   $2,$2,5000
        sra     $4,$2,31 <-- inserted by gcse
$L3:

        muh     $2,$2,$9
        sra     $2,$2,12
        subu    $2,$4,$2
...

The if-conversion fails because it refuses to speculate both instructions whose
set regs are alive. If I use -fno-gcse or -ftree-loop-if-convert the problem
disappears.

Is there something that can be done here w/o resolving to ftree-loop-if-convert
?

Tried:

mipsel-linux-gnu-gcc --version
mipsel-linux-gnu-gcc-7 (Debian 7.3.0-28) 7.3.0

xgcc --version
xgcc (GCC) 9.0.0 20181203 (experimental)

Reply via email to