This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[committed] Fix PR target/30039: HPPA: Incorrect code generated on 64bit host
- From: "John David Anglin" <dave at hiauly1 dot hia dot nrc dot ca>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 8 Dec 2006 22:48:44 -0500 (EST)
- Subject: [committed] Fix PR target/30039: HPPA: Incorrect code generated on 64bit host
The following change corrects the handling of 64-bit constants
on 64-bit hosts cross compiling to 32-bit PA targets. The change
shouldn't affect native builds, or 32 to 64-bit crosses.
The change was tested on hppa-unknown-linux-gnu, hppa2.0w-hp-hpux11.11
and hppa64-hp-hpux11.11. It was also checked that testcase for the
PR was correctly assembled on sparc64-*-netbsd*. Committed to active
branches.
Dave
--
J. David Anglin dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6602)
2006-12-08 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
PR target/30039
* pa.md (high:DI and lo_sum:DI): Handle 64-bit CONST_INTs in 32-bit
patterns. Correct length of high:DI instruction sequence.
Index: config/pa/pa.md
===================================================================
--- config/pa/pa.md (revision 119660)
+++ config/pa/pa.md (working copy)
@@ -4427,6 +4427,7 @@
switch (GET_CODE (op1))
{
case CONST_INT:
+#if HOST_BITS_PER_WIDE_INT <= 32
operands[0] = operand_subword (op0, 1, 0, DImode);
output_asm_insn (\"ldil L'%1,%0\", operands);
@@ -4435,6 +4436,15 @@
output_asm_insn (\"ldi -1,%0\", operands);
else
output_asm_insn (\"ldi 0,%0\", operands);
+#else
+ operands[0] = operand_subword (op0, 1, 0, DImode);
+ operands[1] = GEN_INT (INTVAL (op1) & 0xffffffff);
+ output_asm_insn (\"ldil L'%1,%0\", operands);
+
+ operands[0] = operand_subword (op0, 0, 0, DImode);
+ operands[1] = GEN_INT (INTVAL (op1) >> 32);
+ output_asm_insn (singlemove_string (operands), operands);
+#endif
break;
case CONST_DOUBLE:
@@ -4453,7 +4463,7 @@
return \"\";
}"
[(set_attr "type" "move")
- (set_attr "length" "8")])
+ (set_attr "length" "12")])
(define_insn ""
[(set (match_operand:DI 0 "move_dest_operand"
@@ -4613,6 +4623,9 @@
handle it correctly. */
if (GET_CODE (operands[2]) == CONST_DOUBLE)
operands[2] = GEN_INT (CONST_DOUBLE_LOW (operands[2]));
+ else if (HOST_BITS_PER_WIDE_INT > 32
+ && GET_CODE (operands[2]) == CONST_INT)
+ operands[2] = GEN_INT (INTVAL (operands[2]) & 0xffffffff);
if (which_alternative == 1)
output_asm_insn (\"copy %1,%0\", operands);
return \"ldo R'%G2(%R1),%R0\";