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

--- Comment #15 from Richard Biener <rguenth at gcc dot gnu.org> ---
Btw, unpatched and with a cross to sparc-linux (didn't figure out a working
solaris triplet that builds) and

unsigned int foo (unsigned short *x)
{
  return x[0] << 16 | x[1];
}

I see

32 bit load in host endianness found at: _8 = (int) load_dst_11;
foo (short unsigned int * x)
{
  short unsigned int _3;
  int _4;
  int _5;
  short unsigned int _6;
  int _7;
  int _8;
  unsigned int _9;
  short unsigned int * load_src_10;
  unsigned int load_dst_11;

  <bb 2>:
  _3 = *x_2(D);
  _4 = (int) _3;
  _5 = _4 << 16;
  _6 = MEM[(short unsigned int *)x_2(D) + 2B];
  _7 = (int) _6;
  load_src_10 = x_2(D);
  load_dst_11 = MEM[(short unsigned int *)load_src_10];
  _8 = (int) load_dst_11;
  _9 = (unsigned int) _8;
  return _9;

expanding from

  <bb 2>:
  load_dst_11 = MEM[(short unsigned int *)x_2(D)];
  return load_dst_11;

gets you

foo:
        lduh    [%o0], %g1
        lduh    [%o0+2], %o0
        sll     %g1, 16, %g1
        jmp     %o7+8
         or     %o0, %g1, %o0

which looks perfect to me.

So it must be sth else that breaks the libjava case?

Can someone please provide preprocessed source for jcf-parse.c and
point out the error in the assembly at least?

Reply via email to