diff mbox

: Fix PR middle-end/56382 -- Only move MODE_COMPLEX_FLOAT by parts if we can create pseudos

Message ID 5204824.c27S7jqm0W@polaris
State New
Headers show

Commit Message

Eric Botcazou Sept. 2, 2013, 4:19 p.m. UTC
> Eric, your patch works for me.  Tested on hppa2.0w-hp-hpux11.11 and
> hppa64-hp-hpux11.11.

Thanks, also tested on x86-64/Linux and applied on the mainline.


2013-09-02  Eric Botcazou  <ebotcazou@adacore.com>

	PR middle-end/56382
	* expr.c (emit_move_complex): Do not move complex FP values as parts if
	the source or the destination is a single hard register.
diff mbox

Patch

Index: expr.c
===================================================================
--- expr.c	(revision 202160)
+++ expr.c	(working copy)
@@ -3232,11 +3232,16 @@  emit_move_complex (enum machine_mode mod
   if (push_operand (x, mode))
     return emit_move_complex_push (mode, x, y);
 
-  /* See if we can coerce the target into moving both values at once.  */
-
-  /* Move floating point as parts.  */
+  /* See if we can coerce the target into moving both values at once, except
+     for floating point where we favor moving as parts if this is easy.  */
   if (GET_MODE_CLASS (mode) == MODE_COMPLEX_FLOAT
-      && optab_handler (mov_optab, GET_MODE_INNER (mode)) != CODE_FOR_nothing)
+      && optab_handler (mov_optab, GET_MODE_INNER (mode)) != CODE_FOR_nothing
+      && !(REG_P (x)
+	   && HARD_REGISTER_P (x)
+	   && hard_regno_nregs[REGNO(x)][mode] == 1)
+      && !(REG_P (y)
+	   && HARD_REGISTER_P (y)
+	   && hard_regno_nregs[REGNO(y)][mode] == 1))
     try_int = false;
   /* Not possible if the values are inherently not adjacent.  */
   else if (GET_CODE (x) == CONCAT || GET_CODE (y) == CONCAT)