MIPS, SH fixes for union real_extract
Zack Weinberg
zack@codesourcery.com
Tue Mar 26 21:02:00 GMT 2002
I neglected to check the .md files for embedded code that used union
real_extract. (Because no one would do that, right?) Turns out this
broke MIPS and SH.
With the appended patch I can build cc1 with --target={mips,sh}-elf.
I do not have a setup to test any more thoroughly than that.
zw
* mips.md: Use dconst1, not 1.0, as first argument of
REAL_VALUE_LDEXP. Don't use union real_extract.
* sh.md: Don't use union real_extract.
===================================================================
Index: config/mips/mips.md
--- config/mips/mips.md 2002/03/18 19:17:27 1.122
+++ config/mips/mips.md 2002/03/27 04:58:56
@@ -4504,7 +4504,7 @@ move\\t%0,%z4\\n\\
rtx reg3 = gen_reg_rtx (SImode);
rtx label1 = gen_label_rtx ();
rtx label2 = gen_label_rtx ();
- REAL_VALUE_TYPE offset = REAL_VALUE_LDEXP (1.0, 31);
+ REAL_VALUE_TYPE offset = REAL_VALUE_LDEXP (dconst1, 31);
if (reg1) /* turn off complaints about unreached code */
{
@@ -4548,7 +4548,7 @@ move\\t%0,%z4\\n\\
rtx reg3 = gen_reg_rtx (DImode);
rtx label1 = gen_label_rtx ();
rtx label2 = gen_label_rtx ();
- REAL_VALUE_TYPE offset = REAL_VALUE_LDEXP (1.0, 63);
+ REAL_VALUE_TYPE offset = REAL_VALUE_LDEXP (dconst1, 63);
if (reg1) /* turn off complaints about unreached code */
{
@@ -4592,7 +4592,7 @@ move\\t%0,%z4\\n\\
rtx reg3 = gen_reg_rtx (SImode);
rtx label1 = gen_label_rtx ();
rtx label2 = gen_label_rtx ();
- REAL_VALUE_TYPE offset = REAL_VALUE_LDEXP (1.0, 31);
+ REAL_VALUE_TYPE offset = REAL_VALUE_LDEXP (dconst1, 31);
if (reg1) /* turn off complaints about unreached code */
{
@@ -4636,7 +4636,7 @@ move\\t%0,%z4\\n\\
rtx reg3 = gen_reg_rtx (DImode);
rtx label1 = gen_label_rtx ();
rtx label2 = gen_label_rtx ();
- REAL_VALUE_TYPE offset = REAL_VALUE_LDEXP (1.0, 63);
+ REAL_VALUE_TYPE offset = REAL_VALUE_LDEXP (dconst1, 63);
if (reg1) /* turn off complaints about unreached code */
{
@@ -10616,12 +10616,12 @@ ld\\t%2,%1-%S1(%2)\;daddu\\t%2,%2,$31\\n
"TARGET_MIPS16"
"*
{
- union real_extract u;
+ REAL_VALUE_TYPE d;
if (GET_CODE (operands[0]) != CONST_DOUBLE)
abort ();
- memcpy (&u, &CONST_DOUBLE_LOW (operands[0]), sizeof u);
- assemble_real (u.d, SFmode, GET_MODE_ALIGNMENT (SFmode));
+ REAL_VALUE_FROM_CONST_DOUBLE (d, operands[0]);
+ assemble_real (d, SFmode, GET_MODE_ALIGNMENT (SFmode));
return \"\";
}"
[(set_attr "type" "unknown")
@@ -10633,12 +10633,12 @@ ld\\t%2,%1-%S1(%2)\;daddu\\t%2,%2,$31\\n
"TARGET_MIPS16"
"*
{
- union real_extract u;
+ REAL_VALUE_TYPE d;
if (GET_CODE (operands[0]) != CONST_DOUBLE)
abort ();
- memcpy (&u, &CONST_DOUBLE_LOW (operands[0]), sizeof u);
- assemble_real (u.d, DFmode, GET_MODE_ALIGNMENT (DFmode));
+ REAL_VALUE_FROM_CONST_DOUBLE (d, operands[0]);
+ assemble_real (d, DFmode, GET_MODE_ALIGNMENT (DFmode));
return \"\";
}"
[(set_attr "type" "unknown")
===================================================================
Index: config/sh/sh.md
--- config/sh/sh.md 2002/03/10 01:39:04 1.99
+++ config/sh/sh.md 2002/03/27 04:58:57
@@ -7185,9 +7185,9 @@
{
if (operands[1] != const0_rtx)
{
- union real_extract u;
- memcpy (&u, &CONST_DOUBLE_LOW (operands[0]), sizeof u);
- assemble_real (u.d, SFmode, GET_MODE_ALIGNMENT (SFmode));
+ REAL_VALUE_TYPE d;
+ REAL_VALUE_FROM_CONST_DOUBLE (d, operands[0]);
+ assemble_real (d, SFmode, GET_MODE_ALIGNMENT (SFmode));
}
return \"\";
}"
@@ -7205,9 +7205,9 @@
{
if (operands[1] != const0_rtx)
{
- union real_extract u;
- memcpy (&u, &CONST_DOUBLE_LOW (operands[0]), sizeof u);
- assemble_real (u.d, DFmode, GET_MODE_ALIGNMENT (DFmode));
+ REAL_VALUE_TYPE d;
+ REAL_VALUE_FROM_CONST_DOUBLE (d, operands[0]);
+ assemble_real (d, DFmode, GET_MODE_ALIGNMENT (DFmode));
}
return \"\";
}"
More information about the Gcc-patches
mailing list