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

Barnabás Pőcze <pobrn at protonmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pobrn at protonmail dot com

--- Comment #15 from Barnabás Pőcze <pobrn at protonmail dot com> ---
Sorry, I haven't found a better issue. But I think the example below exhibits
the same or a very similar issue.

I would expect the following code

void f(unsigned char *p, std::uint32_t x, std::uint32_t y)
{
    p[0] = x >> 24;
    p[1] = x >> 16;
    p[2] = x >>  8;
    p[3] = x >>  0;

    p[4] = y >> 24;
    p[5] = y >> 16;
    p[6] = y >>  8;
    p[7] = y >>  0;
}

to be compiled to something along the lines of

f(unsigned char*, unsigned int, unsigned int):
        bswap   esi
        bswap   edx
        mov     DWORD PTR [rdi], esi
        mov     DWORD PTR [rdi+4], edx
        ret

however, I get scores of bitwise operations instead if `-fno-tree-vectorize` is
not specified.

https://gcc.godbolt.org/z/z51K6qorv

Reply via email to