Help with inline assembly constraints

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We have received multiple reports of miscompilation with the following
code in the case of i_count == 128:

static ALWAYS_INLINE int array_non_zero_int_mmx( void *v, int i_count )
{
    if(i_count == 128)
    {
        int nonzero = 0;
        asm(
            "movq     (%1),    %%mm0 \n"
            "por      8(%1),   %%mm0 \n"
            "por      16(%1),  %%mm0 \n"
            "por      24(%1),  %%mm0 \n"
            "por      32(%1),  %%mm0 \n"
            "por      40(%1),  %%mm0 \n"
            "por      48(%1),  %%mm0 \n"
            "por      56(%1),  %%mm0 \n"
            "por      64(%1),  %%mm0 \n"
            "por      72(%1),  %%mm0 \n"
            "por      80(%1),  %%mm0 \n"
            "por      88(%1),  %%mm0 \n"
            "por      96(%1),  %%mm0 \n"
            "por      104(%1), %%mm0 \n"
            "por      112(%1), %%mm0 \n"
            "por      120(%1), %%mm0 \n"
            "packsswb %%mm0,   %%mm0 \n"
            "movd     %%mm0,   %0    \n"
            :"=r"(nonzero)
            :"r"(v), "m"(*(struct {int16_t x[64];} *)v)
        );
        return !!nonzero;
    }
    else return array_non_zero_int_c( v, i_count );
}

I would have thought the constraints would be enough to ensure that
GCC compiled this correctly; is there anything that could be missing,
or is this a GCC bug?

Dark Shikari

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux