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

            Bug ID: 86722
           Summary: ifcvt produces x&0 that is never cleaned up
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: glisse at gcc dot gnu.org
  Target Milestone: ---
            Target: x86_64-*-*

(could be rtl-optimization or target)

void f(double*d,double*e){
  for(;d<e;++d)
    *d=(*d<.5)?.7:0;
}

Compiling at -O2, noce_try_cmove is triggered and produces

        pxor    %xmm4, %xmm4
[...]
        cmpltsd %xmm2, %xmm0
        andpd   %xmm0, %xmm3
        andnpd  %xmm4, %xmm0
        orpd    %xmm3, %xmm0

The last 2 instructions are useless since xmm4 is 0. I don't know if we should
have something to cleanup x&0 later than pass ce2 or if the cmove expansion
should have a special case for the value 0.

Reply via email to