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

--- Comment #21 from Uroš Bizjak <ubizjak at gmail dot com> ---
Just before the patch from Comment #20, the compiler creates (-O2 -mavx):

--cut here--
        vmovdqa .LC1(%rip), %xmm0
        vmovdqa %xmm0, -24(%rsp)
        vmovdqu (%rdi), %xmm0
        vpxor   .LC0(%rip), %xmm0, %xmm0
        vptest  %xmm0, %xmm0
        je      .L5
.L2:
        movl    $1, %eax
        testl   %eax, %eax
        sete    %al
        ret
.L5:
        vmovdqu 16(%rdi), %xmm0
        vpxor   -24(%rsp), %xmm0, %xmm0
        vptest  %xmm0, %xmm0
        jne     .L2
        xorl    %eax, %eax
        testl   %eax, %eax
        sete    %al
        ret
--cut here--

Please note the creative way of returning 0 and 1 ... :

        movl    $1, %eax
        testl   %eax, %eax
        sete    %al
        ret

Even the new code (From comment #20) is unnecessarily convoluted:

    .L2:    movl    $1, %eax
            xorl    $1, %eax
            ret
    .L5:    xorl    %eax, %eax
            xorl    $1, %eax
            ret

Reply via email to