* [commit] Fix trapping arithmetic libcalls on SPU
@ 2011-02-07 15:27 Ulrich Weigand
0 siblings, 0 replies; only message in thread
From: Ulrich Weigand @ 2011-02-07 15:27 UTC (permalink / raw)
To: gcc-patches
Hello,
a couple of -ftrapv test cases were failing on SPU:
FAIL: gcc.dg/ftrapv-1.c (test for excess errors)
WARNING: gcc.dg/ftrapv-1.c compilation failed to produce executable
FAIL: gcc.dg/ftrapv-2.c (test for excess errors)
WARNING: gcc.dg/ftrapv-2.c compilation failed to produce executable
FAIL: gcc.dg/pr30286.c (test for excess errors)
WARNING: gcc.dg/pr30286.c compilation failed to produce executable
FAIL: gcc.dg/pr38364.c (test for excess errors)
WARNING: gcc.dg/pr38364.c compilation failed to produce executable
The reason is that by default, optabs does not install libcall
functions for integer modes smaller than word_mode -- which is
TImode on SPU. Thus optabs would always expand all trapping
arithmetic operations to TImode, and then fail, because there
actually is no TImode libcall in the library (because libgcc
is built as if word_mode were SImode).
The fix is to install those functions manually in spu_init_libfuncs,
as is already done for a number of other libcalls.
Tested on spu-elf, fixes the above failures.
Committed to mainline.
Bye,
Ulrich
ChangeLog:
* config/spu/spu.c (spu_init_libfuncs): Install SImode and
DImode trapping arithmetic libfuncs.
Index: gcc/config/spu/spu.c
===================================================================
*** gcc/config/spu/spu.c (revision 169851)
--- gcc/config/spu/spu.c (working copy)
*************** spu_init_libfuncs (void)
*** 5641,5646 ****
--- 5641,5659 ----
set_conv_libfunc (ufloat_optab, DFmode, SImode, "__float_unssidf");
set_conv_libfunc (ufloat_optab, DFmode, DImode, "__float_unsdidf");
+ set_optab_libfunc (addv_optab, SImode, "__addvsi3");
+ set_optab_libfunc (subv_optab, SImode, "__subvsi3");
+ set_optab_libfunc (smulv_optab, SImode, "__mulvsi3");
+ set_optab_libfunc (sdivv_optab, SImode, "__divvsi3");
+ set_optab_libfunc (negv_optab, SImode, "__negvsi2");
+ set_optab_libfunc (absv_optab, SImode, "__absvsi2");
+ set_optab_libfunc (addv_optab, DImode, "__addvdi3");
+ set_optab_libfunc (subv_optab, DImode, "__subvdi3");
+ set_optab_libfunc (smulv_optab, DImode, "__mulvdi3");
+ set_optab_libfunc (sdivv_optab, DImode, "__divvdi3");
+ set_optab_libfunc (negv_optab, DImode, "__negvdi2");
+ set_optab_libfunc (absv_optab, DImode, "__absvdi2");
+
set_optab_libfunc (smul_optab, TImode, "__multi3");
set_optab_libfunc (sdiv_optab, TImode, "__divti3");
set_optab_libfunc (smod_optab, TImode, "__modti3");
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-02-07 15:27 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-07 15:27 [commit] Fix trapping arithmetic libcalls on SPU Ulrich Weigand
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).