Fix SPARC64 int-to-TFmode conversions
Joseph S. Myers
joseph@codesourcery.com
Wed Aug 13 19:38:00 GMT 2008
Tests of conversion of integers to TFmode were failing for SPARC64,
because these were implemented by passing an SImode value to a
libcall, and the libcall expansion could not know whether that value
needed to be sign or zero extended to go in a 64-bit argument
register. This patch adds the necessary explicit extensions. (The
problem case I reduced a test to was a signed value being wrongly
zero-extended, but it seems cleanest to insert the extensions for both
signed and unsigned values, whther or not required in both cases.)
Tested with no regressions with cross to sparc64-linux-gnu, where it
fixes the following test failures. OK to commit?
FAIL: gcc.c-torture/execute/conversion.c execution, -O0
FAIL: gcc.dg/torture/fp-int-convert-long-double.c -O0 execution test
FAIL: gcc.dg/torture/fp-int-convert-long-double.c -O1 execution test
FAIL: gcc.dg/torture/fp-int-convert-long-double.c -O2 execution test
FAIL: gcc.dg/torture/fp-int-convert-long-double.c -O3 -fomit-frame-pointer execution test
FAIL: gcc.dg/torture/fp-int-convert-long-double.c -O3 -g execution test
FAIL: gcc.dg/torture/fp-int-convert-long-double.c -Os execution test
2008-08-13 Joseph Myers <joseph@codesourcery.com>
* config/sparc/sparc.c (emit_soft_tfmode_cvt): Explicitly sign or
zero extend SImode values being converted to TFmode before passing
to libcalls.
Index: config/sparc/sparc.c
===================================================================
--- config/sparc/sparc.c (revision 139036)
+++ config/sparc/sparc.c (working copy)
@@ -2371,6 +2371,8 @@
{
case SImode:
func = "_Qp_itoq";
+ if (TARGET_ARCH64)
+ operands[1] = gen_rtx_SIGN_EXTEND (DImode, operands[1]);
break;
case DImode:
func = "_Qp_xtoq";
@@ -2385,6 +2387,8 @@
{
case SImode:
func = "_Qp_uitoq";
+ if (TARGET_ARCH64)
+ operands[1] = gen_rtx_ZERO_EXTEND (DImode, operands[1]);
break;
case DImode:
func = "_Qp_uxtoq";
--
Joseph S. Myers
joseph@codesourcery.com
More information about the Gcc-patches
mailing list