Fix PR 45585, darwin did not like the last fp optimization patches on powerpc

Submitted by Michael Meissner on Nov. 5, 2010, 10:46 p.m.

Details

Message ID 20101105224632.GA10680@hungry-tiger.westford.ibm.com
State New
Headers show

Commit Message

Michael Meissner Nov. 5, 2010, 10:46 p.m.
This patch fixes the problem in bug 45585 that only shows up on Darwin-powerpc.

What is happening is before my patches were checked in on August 23rd, if you
were loading up a static 64-bit integer variable to convert it to floating
point, the compiler would first load the variable into a GPR, then store it on
the stack, and then load the value from the stack to the FPR.

My optimization allowed the fp convert to take memory operands so it didn't
have to go through the GPR registers.  However, since Darwin has its own
patterns for load/store for LO_SUM address, it didn't go through the normal
move patterns, and was overlooked.

I have bootstrapped a powerpc64-linux compiler with the changes, and did a unit
test to verify that the problem has been fixed.  However, I don't currently
have a working Darwin system, so I can't determine if there were uninteded
consquences to the patch.

Is it ok to apply?

2010-11-05  Michael Meissner  <meissner@linux.vnet.ibm.com>

	PR target/45585
	* config/rs6000/darwin.md (movdi_low): Allow DImode values to be
	in FPR registers.
	(movdi_low_st): Ditto.

Comments

Mike Stump Nov. 8, 2010, 9:41 p.m.
On Nov 5, 2010, at 3:46 PM, Michael Meissner wrote:
> This patch fixes the problem in bug 45585 that only shows up on Darwin-powerpc.

> Is it ok to apply?

Ok.

Watch for regressions on Geoff's tester if you've not heard back from a ppc darwin person...
Michael Meissner Nov. 8, 2010, 10:24 p.m.
On Mon, Nov 08, 2010 at 01:41:30PM -0800, Mike Stump wrote:
> On Nov 5, 2010, at 3:46 PM, Michael Meissner wrote:
> > This patch fixes the problem in bug 45585 that only shows up on Darwin-powerpc.
> 
> > Is it ok to apply?
> 
> Ok.
> 
> Watch for regressions on Geoff's tester if you've not heard back from a ppc darwin person...

dominiq@lps.ens.fr did a bootstrap with no regressions before I committed the change.

Patch hide | download patch | download mbox

Index: gcc/config/rs6000/darwin.md
===================================================================
--- gcc/config/rs6000/darwin.md	(revision 166360)
+++ gcc/config/rs6000/darwin.md	(working copy)
@@ -141,11 +141,13 @@  (define_insn "movsf_low_st_di"
 
 ;; 64-bit MachO load/store support
 (define_insn "movdi_low"
-  [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
-        (mem:DI (lo_sum:DI (match_operand:DI 1 "gpc_reg_operand" "b")
+  [(set (match_operand:DI 0 "gpc_reg_operand" "=r,*!d")
+        (mem:DI (lo_sum:DI (match_operand:DI 1 "gpc_reg_operand" "b,b")
                            (match_operand 2 "" ""))))]
   "TARGET_MACHO && TARGET_64BIT"
-  "{l|ld} %0,lo16(%2)(%1)"
+  "@
+   {l|ld} %0,lo16(%2)(%1)
+   lfd %0,lo16(%2)(%1)"
   [(set_attr "type" "load")
    (set_attr "length" "4")])
 
@@ -159,11 +161,13 @@  (define_insn "movsi_low_st"
    (set_attr "length" "4")])
 
 (define_insn "movdi_low_st"
-  [(set (mem:DI (lo_sum:DI (match_operand:DI 1 "gpc_reg_operand" "b")
+  [(set (mem:DI (lo_sum:DI (match_operand:DI 1 "gpc_reg_operand" "b,b")
                            (match_operand 2 "" "")))
-	(match_operand:DI 0 "gpc_reg_operand" "r"))]
+	(match_operand:DI 0 "gpc_reg_operand" "r,*!d"))]
   "TARGET_MACHO && TARGET_64BIT"
-  "{st|std} %0,lo16(%2)(%1)"
+  "@
+   {st|std} %0,lo16(%2)(%1)
+   stfd %0,lo16(%2)(%1)"
   [(set_attr "type" "store")
    (set_attr "length" "4")])