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

--- Comment #5 from Tao Wang <wangtao42 at huawei dot com> ---
(In reply to Eric Botcazou from comment #4)
> This is not a bug:
> 
>   __asm__ __volatile__ ("addiu %0, %1, 0\t\n" "movn %0, %2, %3" :
> "=&r"(g_b.s_b.c):"r"(g_b.s_b.c),"r"(g_a.s_a.c),"r"((0 == g_a.s_a.a)));
> 
> The movn instruction uses 32-bit quantities but g_a.s_a.c is only 16-bit and
> there is no implicit cast for asm operands.  You need to write it like this:
> 
>  __asm__ __volatile__ ("addiu %0, %1, 0\t\n" "movn %0, %2, %3" :
> "=&r"(g_b.s_b.c):"r"((int)g_b.s_b.c),"r"((int)g_a.s_a.c),"r"((0 ==
> g_a.s_a.a)));

But if g_a.s_a.c is 17 bits width, then there is a bit extract action like
this: ubfx    x3, x3, #0, #17.
So why does this can work and the 16 bit width can not?

Reply via email to