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

Hongtao Liu <liuhongt at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lin1.hu at intel dot com,
                   |                            |liuhongt at gcc dot gnu.org

--- Comment #8 from Hongtao Liu <liuhongt at gcc dot gnu.org> ---
(In reply to Uroš Bizjak from comment #6)
> (In reply to Uroš Bizjak from comment #5)
> 
> > However, the compiler generates quite unoptimal code here:
> STV pass would cover this (and similar bit-twiddling on float bit patterns -
> the fabs/copysign-style masks done by hand). CC STV masters.

We're working on a patch to support $v alternative in and/xor/or{si,di}
patterns so RA can handle testcase like 

union fu { float f; unsigned u; };
float f (float x, unsigned mask)
{ union fu a; a.f = x; a.u &= mask; return a.f; }

So compiler can generates

movd  %edi, %xmm1
andps %xmm1, %xmm0

instead of
movd  %xmm0, %eax
andl  %edi, %eax
movd  %eax, %xmm0

with the patch, it could generate

f:
.LFB11:
        .cfi_startproc
        cmpl    $1, %edi
        je      .L5
        cmpl    $2, %edi
        je      .L6
        ret
        .p2align 4,,10
        .p2align 3
.L6:
        xorps   .LC0(%rip), %xmm0
        ret
        .p2align 4,,10
        .p2align 3
.L5:
        ret

Reply via email to