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

            Bug ID: 109046
           Summary: 13 regresion caused by complex lower.
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: crazylht at gmail dot com
  Target Milestone: ---

commit f9d4c3b45c5ed5f45c8089c990dbd4e181929c3d
Author: liuhongt <hongtao....@intel.com>
Date:   Tue Jul 19 17:24:52 2022 +0800

    Lower complex type move to enable vectorization for complex type
load&store.

    2022-07-20  Richard Biener  <richard.guent...@gmail.com>
                Hongtao Liu  <hongtao....@intel.com>

    gcc/ChangeLog:

            PR tree-optimization/106010
            * tree-complex.cc (init_dont_simulate_again): Lower complex
            type move.
            (expand_complex_move): Also expand COMPLEX_CST for rhs.


My r13-1762-gf9d4c3b45c5ed5 lower complex type for load&store but somehow
caused a regression in phoronix benchmark

#include <complex.h>

extern void push1(void *p, float _Complex x);

void foo(void * _q, float _Complex * _x)
{
    push1(_q, *_x);
}


foo(void*, float _Complex*):
        vmovss  4(%rsi), %xmm0
        vmovss  (%rsi), %xmm1
        vmovss  %xmm0, -12(%rsp)
        vmovss  %xmm1, -16(%rsp)
        vmovq   -16(%rsp), %xmm0
        jmp     push1(void*, float _Complex)

gcc12 generates

foo(void*, float _Complex*):
        vmovq   (%rsi), %xmm0
        jmp     push1(void*, float _Complex)

Since complex lower is only for vectorization, maybe it should be gimplified
back to a complex load after vectorization if there're things like

  _6 = REALPART_EXPR <*_x_3(D)>;
  _7 = IMAGPART_EXPR <*_x_3(D)>;
  _1 = COMPLEX_EXPR <_6, _7>;

Reply via email to