public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/55598] New: LRA on powerpc does not like assembler in libgcc
@ 2012-12-04 21:36 meissner at gcc dot gnu.org
  2012-12-05 11:44 ` [Bug rtl-optimization/55598] " steven at gcc dot gnu.org
  2012-12-05 16:39 ` meissner at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: meissner at gcc dot gnu.org @ 2012-12-04 21:36 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55598

             Bug #: 55598
           Summary: LRA on powerpc does not like assembler in libgcc
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: meissner@gcc.gnu.org


Created attachment 28878
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28878
Reduced case to show the problem.

I decided to see if I could switch the powerpc to using LRA for targeting a
future machine.  I made a branch, and added a -mlra option to enable using LRA.
 I then tried to bootstrap the compiler on power7 using the -mlra option, and
it fails in building 32-bit libgcc.a.  I also tried the LRA branch and got the
same result.

The failure message is:
/home/meissner/fsf-build-ppc64/meissner-lra/./gcc/xgcc
-B/home/meissner/fsf-build-ppc64/meissner-lra/./gcc/
-B/home/meissner/fsf-install-ppc64/meissner-lra/powerpc64-unknown-linux-gnu/bin/
-B/home/meissner/fsf-install-ppc64/meissner-lra/powerpc64-unknown-linux-gnu/lib/
-isystem
/home/meissner/fsf-install-ppc64/meissner-lra/powerpc64-unknown-linux-gnu/include
-isystem
/home/meissner/fsf-install-ppc64/meissner-lra/powerpc64-unknown-linux-gnu/sys-include
 -m32 -fPIC -O2 -g -mcpu=power7 -save-temps=obj -mlra -O2  -O2 -g -mcpu=power7
-save-temps=obj -mlra -DIN_GCC   -W -Wall -Wwrite-strings -Wcast-qual
-Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem
./include   -fPIC -mlong-double-128 -mno-minimal-toc -g -DIN_LIBGCC2
-fbuilding-libgcc -fno-stack-protector   -fPIC -mlong-double-128
-mno-minimal-toc -I. -I. -I../../.././gcc
-I/home/meissner/fsf-src/meissner-lra/libgcc
-I/home/meissner/fsf-src/meissner-lra/libgcc/.
-I/home/meissner/fsf-src/meissner-lra/libgcc/../gcc
-I/home/meissner/fsf-src/meissner-lra/libgcc/../include
-I/home/meissner/fsf-src/meissner-lra/libgcc/../libdecnumber/dpd
-I/home/meissner/fsf-src/meissner-lra/libgcc/../libdecnumber   -o _muldi3.o -MT
_muldi3.o -MD -MP -MF _muldi3.dep -DL_muldi3 -c
/home/meissner/fsf-src/meissner-lra/libgcc/libgcc2.c -fvisibility=hidden
-DHIDE_EXPORTS
/home/meissner/fsf-src/meissner-lra/libgcc/libgcc2.c: In function ‘__muldi3’:
/home/meissner/fsf-src/meissner-lra/libgcc/libgcc2.c:559:1: error: unable to
generate reloads for:
 }
 ^
(insn 19 51 20 2 (set (reg:SI 152 [ D.7253 ])
        (mult:SI (reg:SI 173 [ v ])
            (reg:SI 172 [ u+4 ])))
/home/meissner/fsf-src/meissner-lra/libgcc/libgcc2.c:555 119 {mulsi3}
     (expr_list:REG_DEAD (reg:SI 173 [ v ])
        (nil)))
/home/meissner/fsf-src/meissner-lra/libgcc/libgcc2.c:559:1: internal compiler
error: in curr_insn_transform, at lra-constraints.c:2749
0x107b4153 _fatal_insn(char const*, rtx_def const*, char const*, int, char
const*)
        /home/meissner/fsf-src/meissner-lra/gcc/rtl-error.c:110
0x106860c7 curr_insn_transform
        /home/meissner/fsf-src/meissner-lra/gcc/lra-constraints.c:2749
0x106885f3 lra_constraints(bool)
        /home/meissner/fsf-src/meissner-lra/gcc/lra-constraints.c:3486
0x106694b7 lra(_IO_FILE*)
        /home/meissner/fsf-src/meissner-lra/gcc/lra.c:2280
0x105ee0a3 do_reload
        /home/meissner/fsf-src/meissner-lra/gcc/ira.c:4624
0x105ee38f rest_of_handle_reload
        /home/meissner/fsf-src/meissner-lra/gcc/ira.c:4737
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
make: *** [_muldi3.o] Error 1

I did some debugging, and determined that in this case, the problem is the
assembler statement used to get the upper half of the 32x32 multiply:

DItype
__muldi3 (DItype u, DItype v)
{
  const DWunion uu = {.ll = u};
  const DWunion vv = {.ll = v};
  DWunion w;
  DWunion __w;
  USItype __m0;
  USItype __m1;

  __m0 = uu.s.low;
  __m1 = vv.s.low;
  __asm__ ("mulhwu %0,%1,%2"
       : "=r" (__w.s.high)
       : "%r" (uu.s.low), "r" (vv.s.low));

  __w.s.low = __m0 * __m1;
  w.ll =  __w.ll;
  w.s.high += ((USItype) uu.s.low * (USItype) vv.s.high
           + (USItype) uu.s.high * (USItype) vv.s.low);

  return w.ll;
}

where __w, uu, and vv are all unions with a long long member and a structure
with two 32-bit integer fields for the high/low values.  If I replace the asm
output with a scalar value, it works fine:

DItype
__muldi3 (DItype u, DItype v)
{
  const DWunion uu = {.ll = u};
  const DWunion vv = {.ll = v};
  DWunion w;
  DWunion __w;
  USItype __m0;
  USItype __m1;
  USItype __high;

  __m0 = uu.s.low;
  __m1 = vv.s.low;
  __asm__ ("mulhwu %0,%1,%2"
       : "=r" (__high)
       : "%r" (uu.s.low), "r" (vv.s.low));

  __w.s.high = __high;
  __w.s.low = __m0 * __m1;
  w.ll =  __w.ll;
  w.s.high += ((USItype) uu.s.low * (USItype) vv.s.high
           + (USItype) uu.s.high * (USItype) vv.s.low);

  return w.ll;
}


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug rtl-optimization/55598] LRA on powerpc does not like assembler in libgcc
  2012-12-04 21:36 [Bug rtl-optimization/55598] New: LRA on powerpc does not like assembler in libgcc meissner at gcc dot gnu.org
@ 2012-12-05 11:44 ` steven at gcc dot gnu.org
  2012-12-05 16:39 ` meissner at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: steven at gcc dot gnu.org @ 2012-12-05 11:44 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55598

--- Comment #1 from Steven Bosscher <steven at gcc dot gnu.org> 2012-12-05 11:44:18 UTC ---
Vlad committed a set of powerpc fixes here:
http://gcc.gnu.org/ml/gcc-patches/2012-12/msg00272.html

Perhaps you can try the patch, see if it helps?


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug rtl-optimization/55598] LRA on powerpc does not like assembler in libgcc
  2012-12-04 21:36 [Bug rtl-optimization/55598] New: LRA on powerpc does not like assembler in libgcc meissner at gcc dot gnu.org
  2012-12-05 11:44 ` [Bug rtl-optimization/55598] " steven at gcc dot gnu.org
@ 2012-12-05 16:39 ` meissner at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: meissner at gcc dot gnu.org @ 2012-12-05 16:39 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55598

--- Comment #2 from Michael Meissner <meissner at gcc dot gnu.org> 2012-12-05 16:37:46 UTC ---
I'm trying the bootstrap of the lra branch right now.  I discovered the
bootstrap fails if I enable decimal floating point (i.e.
--enable-decimal-float).  More later.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-12-05 16:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-04 21:36 [Bug rtl-optimization/55598] New: LRA on powerpc does not like assembler in libgcc meissner at gcc dot gnu.org
2012-12-05 11:44 ` [Bug rtl-optimization/55598] " steven at gcc dot gnu.org
2012-12-05 16:39 ` meissner at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).