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

Michael Meissner meissner@linux.vnet.ibm.com
Fri Nov 5 22:48:00 GMT 2010


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.

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")])
 


-- 
Michael Meissner, IBM
5 Technology Place Drive, M/S 2757, Westford, MA 01886-3141, USA
meissner@linux.vnet.ibm.com



More information about the Gcc-patches mailing list