[Bug target/103861] [i386] vectorize v2qi vectors

ubizjak at gmail dot com gcc-bugzilla@gcc.gnu.org
Wed Dec 29 18:21:12 GMT 2021


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

--- Comment #3 from Uroš Bizjak <ubizjak at gmail dot com> ---
The patched compiler compiles the testcase from Comment #0 on x86_64 with -O2
to:

plus:
        movl    %edi, %edx
        movl    %esi, %eax
        addb    %sil, %dl
        addb    %ah, %dh
        movl    %edx, %eax
        ret

and the testcase from Comment #1 to:

foo:
        movzwl  a(%rip), %edx
        movzwl  b(%rip), %eax
        addb    %dl, %al
        addb    %dh, %ah
        movw    %ax, r(%rip)
        ret

Some additional examples:

char r[2], a[2], b[2];

void maxs (void)
{
  int i;

  for (i = 0; i < 2; i++)
    r[i] = a[i] > b[i] ? a[i] : b[i];
}

compiles with -O2 -msse4 to:

maxs:
        pinsrw  $0, b(%rip), %xmm0
        pinsrw  $0, a(%rip), %xmm1
        pmaxsb  %xmm1, %xmm0
        pextrw  $0, %xmm0, r(%rip)
        ret


More information about the Gcc-bugs mailing list