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

            Bug ID: 127309
           Summary: [17 regression] ~30% libquantum regression on riscv64
                    rva23
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mpe+gcc at ellerman dot id.au
  Target Milestone: ---
            Target: riscv64-unknown-linux-gnu

Created attachment 65548
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=65548&action=edit
Minimal reproducer

I'm seeing a ~30% wall-clock regression on 462.libquantum from CPU2006 when run
on Spacemit K3 (X100).

Bisect points to commit r17-3794-g14665d8a97e ("ifcvt: Handle extended
conditional
arithmetic").

Reverting that commit on top of trunk recovers most of the loss. Original
runtime was 511s, the regression 660s, with the revert 517s.

The cause seems to be a well-predicted branch gets replaced by a czero.

I've attached a minimal program which has a similar pattern and shows a ~15%
regression after the change. Build with:

  riscv64-unknown-linux-gnu-gcc -O2 -march=rv64gc_zicond -mabi=lp64d \
    -mbranch-cost=4 -static ifcvt_zicond_bench.c -o ifcvt_zicond_bench

I'm building spec with:
  -Ofast -funroll-loops -flto -flto-partition=one -fno-builtin-memcpy
-fno-builtin-memmove -march=rva23u64 -mabi=lp64d -mtune=generic-ooo -static

Reply via email to