I was recently trying to turn on some of the debug options I put in when doing
the initial power7 work to track down some performance regressions.  The
following patches fix problems that come up in telling the compiler to use the
traditional floating point insns for scalar mode on power7
(-mno-vsx-scalar-double).  It also adds reload helpers for using the VSX memory
load instructions when the compiler is allowed to use VSX memory instructions
for scalars.  There were no regressions with these patches.  Are they ok to be
checked in?

2012-01-09  Michael Meissner  <meiss...@linux.vnet.ibm.com>

        * config/rs6000/rs6000.c (rs6000_init_hard_regno_mode_ok): Add DF
        reload patterns if -mvsx-scalar-memory.

        * config/rs6000/vsx.md (vsx_xscvspdp): Allow xscvspdp to be
        generated, even -mno-vsx-scalar-double was used.
        (vsx_xscvdpsp_scalar): Likewise.
        (vsx_xscvspdp_scalar2): Likewise.

-- 
Michael Meissner, IBM
5 Technology Place Drive, M/S 2757, Westford, MA 01886-3141, USA
meiss...@linux.vnet.ibm.com     fax +1 (978) 399-6899
Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c  (revision 183033)
+++ gcc/config/rs6000/rs6000.c  (working copy)
@@ -1,6 +1,7 @@
 /* Subroutines used for code generation on IBM RS/6000.
    Copyright (C) 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
+   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
+   2012
    Free Software Foundation, Inc.
    Contributed by Richard Kenner (ken...@vlsi1.ultra.nyu.edu)
 
@@ -2332,6 +2333,11 @@ rs6000_init_hard_regno_mode_ok (bool glo
          rs6000_vector_reload[V4SFmode][1]  = CODE_FOR_reload_v4sf_di_load;
          rs6000_vector_reload[V2DFmode][0]  = CODE_FOR_reload_v2df_di_store;
          rs6000_vector_reload[V2DFmode][1]  = CODE_FOR_reload_v2df_di_load;
+         if (TARGET_VSX && TARGET_VSX_SCALAR_MEMORY)
+           {
+             rs6000_vector_reload[DFmode][0]  = CODE_FOR_reload_df_di_store;
+             rs6000_vector_reload[DFmode][1]  = CODE_FOR_reload_df_di_load;
+           }
        }
       else
        {
@@ -2347,6 +2353,11 @@ rs6000_init_hard_regno_mode_ok (bool glo
          rs6000_vector_reload[V4SFmode][1]  = CODE_FOR_reload_v4sf_si_load;
          rs6000_vector_reload[V2DFmode][0]  = CODE_FOR_reload_v2df_si_store;
          rs6000_vector_reload[V2DFmode][1]  = CODE_FOR_reload_v2df_si_load;
+         if (TARGET_VSX && TARGET_VSX_SCALAR_MEMORY)
+           {
+             rs6000_vector_reload[DFmode][0]  = CODE_FOR_reload_df_si_store;
+             rs6000_vector_reload[DFmode][1]  = CODE_FOR_reload_df_si_load;
+           }
        }
     }
 
Index: gcc/config/rs6000/vsx.md
===================================================================
--- gcc/config/rs6000/vsx.md    (revision 183033)
+++ gcc/config/rs6000/vsx.md    (working copy)
@@ -1,5 +1,5 @@
 ;; VSX patterns.
-;; Copyright (C) 2009, 2010, 2011
+;; Copyright (C) 2009, 2010, 2011, 2012
 ;; Free Software Foundation, Inc.
 ;; Contributed by Michael Meissner <meiss...@linux.vnet.ibm.com>
 
@@ -919,7 +919,7 @@ (define_insn "vsx_xscvspdp"
   [(set (match_operand:DF 0 "vsx_register_operand" "=ws,?wa")
        (unspec:DF [(match_operand:V4SF 1 "vsx_register_operand" "wa,wa")]
                   UNSPEC_VSX_CVSPDP))]
-  "VECTOR_UNIT_VSX_P (DFmode)"
+  "VECTOR_UNIT_VSX_P (V4SFmode)"
   "xscvspdp %x0,%x1"
   [(set_attr "type" "fp")])
 
@@ -929,7 +929,7 @@ (define_insn "vsx_xscvdpsp_scalar"
   [(set (match_operand:V4SF 0 "vsx_register_operand" "=wa")
        (unspec:V4SF [(match_operand:SF 1 "vsx_register_operand" "f")]
                     UNSPEC_VSX_CVSPDP))]
-  "VECTOR_UNIT_VSX_P (DFmode)"
+  "VECTOR_UNIT_VSX_P (V4SFmode)"
   "xscvdpsp %x0,%x1"
   [(set_attr "type" "fp")])
 
@@ -938,7 +938,7 @@ (define_insn "vsx_xscvspdp_scalar2"
   [(set (match_operand:SF 0 "vsx_register_operand" "=f")
        (unspec:SF [(match_operand:V4SF 1 "vsx_register_operand" "wa")]
                   UNSPEC_VSX_CVSPDP))]
-  "VECTOR_UNIT_VSX_P (DFmode)"
+  "VECTOR_UNIT_VSX_P (V4SFmode)"
   "xscvspdp %x0,%x1"
   [(set_attr "type" "fp")])
 

Reply via email to