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

--- Comment #3 from Stefan Schulze Frielinghaus <stefansf at gcc dot gnu.org> 
---
Thanks for the ping.  The test is skipped for -m31 and fails for -m64.  Maybe
this is some sort of endianness thingy?

typedef __attribute__((__vector_size__ (64))) unsigned __int128 VV;

__attribute__ ((noipa))
unsigned char
foo (VV vv)
{
  return ((VC) vv)[0];
}

int
main (void)
{
  unsigned char x = foo ((VV) { -0xff });
  __builtin_printf ("%u\n", x);
}

prints 255 on s390 and 1 on x86_64.  At start of function foo we have

(gdb) x/16xb $r2
0x3ffffff9450:  0xff    0xff    0xff    0xff    0xff    0xff    0xff    0xff
0x3ffffff9458:  0xff    0xff    0xff    0xff    0xff    0xff    0xff    0x01

In foo we then load the most significant byte:

<foo>         llgc    %r2,0(%r2)
<foo+6>       br      %r14

and zero extend it.

Reply via email to