This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: rs6000 target support for decimal float moves



On 09/01/2006, at 5:04 PM, Ben Elliston wrote:



Hi Geoff



the description of the patch doesn't explain why it's necessary.
Why can't optabs synthesize the decimal mode moves from the existing
integer mode moves?  There don't seem to be any new machine
instructions involved.



Here is a revised and much smaller patch. Okay for the trunk?



Much better! This is OK.


:REVIEWMAIL:


:ADDPATCH target:

2006-01-10 Ben Elliston <bje@au.ibm.com>

* config/rs6000/predicates.md (easy_fp_constant): Discount decimal
float modes.
* config/rs6000/rs6000.c (rs6000_scalar_mode_supported_p): New.
(TARGET_SCALAR_MODE_SUPPORTED_P): Define.
(USE_FP_FOR_ARG): Reject decimal float modes.
(function_arg_advance): Likewise.
(output_toc): Handle emitting TDmode, DDmode and SDmode constants.
(rs6000_handle_altivec_attribute): Do not permit decimal floating
point types in AltiVec vectors.
(rs6000_function_value): Use GP_ARG_RETURN for decimal floats.
(rs6000_libcall_value): Likewise.


Index: config/rs6000/predicates.md
===================================================================
--- config/rs6000/predicates.md (revision 109518)
+++ config/rs6000/predicates.md (working copy)
@@ -195,6 +195,9 @@ (define_predicate "easy_fp_constant"
       && mode != DImode)
     return 1;

+ if (DECIMAL_FLOAT_MODE_P (mode))
+ return 0;
+
/* If we are using V.4 style PIC, consider all constants to be hard. */
if (flag_pic && DEFAULT_ABI == ABI_V4)
return 0;
Index: config/rs6000/rs6000.c
===================================================================
--- config/rs6000/rs6000.c (revision 109518)
+++ config/rs6000/rs6000.c (working copy)
@@ -742,6 +742,7 @@ static void rs6000_darwin_file_start (vo
static tree rs6000_build_builtin_va_list (void);
static tree rs6000_gimplify_va_arg (tree, tree, tree *, tree *);
static bool rs6000_must_pass_in_stack (enum machine_mode, tree);
+static bool rs6000_scalar_mode_supported_p (enum machine_mode);
static bool rs6000_vector_mode_supported_p (enum machine_mode);
static int get_vec_cmp_insn (enum rtx_code, enum machine_mode,
enum machine_mode);
@@ -981,6 +982,9 @@ static const char alt_reg_names[][8] =
#undef TARGET_EH_RETURN_FILTER_MODE
#define TARGET_EH_RETURN_FILTER_MODE rs6000_eh_return_filter_mode


+#undef TARGET_SCALAR_MODE_SUPPORTED_P
+#define TARGET_SCALAR_MODE_SUPPORTED_P rs6000_scalar_mode_supported_p
+
 #undef TARGET_VECTOR_MODE_SUPPORTED_P
 #define TARGET_VECTOR_MODE_SUPPORTED_P rs6000_vector_mode_supported_p

@@ -4140,6 +4144,7 @@ rs6000_emit_move (rtx dest, rtx source,
/* Nonzero if we can use a floating-point register to pass this arg. */
#define USE_FP_FOR_ARG_P(CUM,MODE,TYPE) \
(SCALAR_FLOAT_MODE_P (MODE) \
+ && !DECIMAL_FLOAT_MODE_P (MODE) \
&& (CUM)->fregno <= FP_ARG_MAX_REG \
&& TARGET_HARD_FLOAT && TARGET_FPRS)


@@ -4664,6 +4669,7 @@ function_arg_advance (CUMULATIVE_ARGS *c
       cum->words = align_words + n_words;

       if (SCALAR_FLOAT_MODE_P (mode)
+         && !DECIMAL_FLOAT_MODE_P (mode)
          && TARGET_HARD_FLOAT && TARGET_FPRS)
        cum->fregno += (GET_MODE_SIZE (mode) + 7) >> 3;

@@ -15746,13 +15752,17 @@ output_toc (FILE *file, rtx x, int label
/* Handle FP constants specially. Note that if we have a minimal
TOC, things we put here aren't actually in the TOC, so we can allow
FP constants. */
- if (GET_CODE (x) == CONST_DOUBLE && GET_MODE (x) == TFmode)
+ if (GET_CODE (x) == CONST_DOUBLE &&
+ (GET_MODE (x) == TFmode || GET_MODE (x) == TDmode))
{
REAL_VALUE_TYPE rv;
long k[4];


       REAL_VALUE_FROM_CONST_DOUBLE (rv, x);
-      REAL_VALUE_TO_TARGET_LONG_DOUBLE (rv, k);
+      if (DECIMAL_FLOAT_MODE_P (GET_MODE (x)))
+       REAL_VALUE_TO_TARGET_DECIMAL128 (rv, k);
+      else
+       REAL_VALUE_TO_TARGET_LONG_DOUBLE (rv, k);

       if (TARGET_64BIT)
        {
@@ -15781,13 +15791,18 @@ output_toc (FILE *file, rtx x, int label
          return;
        }
     }
-  else if (GET_CODE (x) == CONST_DOUBLE && GET_MODE (x) == DFmode)
+  else if (GET_CODE (x) == CONST_DOUBLE &&
+          (GET_MODE (x) == DFmode || GET_MODE (x) == DDmode))
     {
       REAL_VALUE_TYPE rv;
       long k[2];

       REAL_VALUE_FROM_CONST_DOUBLE (rv, x);
-      REAL_VALUE_TO_TARGET_DOUBLE (rv, k);
+
+      if (DECIMAL_FLOAT_MODE_P (GET_MODE (x)))
+       REAL_VALUE_TO_TARGET_DECIMAL64 (rv, k);
+      else
+       REAL_VALUE_TO_TARGET_DOUBLE (rv, k);

       if (TARGET_64BIT)
        {
@@ -15812,13 +15827,17 @@ output_toc (FILE *file, rtx x, int label
          return;
        }
     }
-  else if (GET_CODE (x) == CONST_DOUBLE && GET_MODE (x) == SFmode)
+  else if (GET_CODE (x) == CONST_DOUBLE &&
+          (GET_MODE (x) == SFmode || GET_MODE (x) == SDmode))
     {
       REAL_VALUE_TYPE rv;
       long l;

       REAL_VALUE_FROM_CONST_DOUBLE (rv, x);
-      REAL_VALUE_TO_TARGET_SINGLE (rv, l);
+      if (DECIMAL_FLOAT_MODE_P (GET_MODE (x)))
+       REAL_VALUE_TO_TARGET_DECIMAL32 (rv, l);
+      else
+       REAL_VALUE_TO_TARGET_SINGLE (rv, l);

if (TARGET_64BIT)
{
@@ -17299,6 +17318,8 @@ rs6000_handle_altivec_attribute (tree *n
error ("use of boolean types in AltiVec types is invalid");
else if (TREE_CODE (type) == COMPLEX_TYPE)
error ("use of %<complex%> in AltiVec types is invalid");
+ else if (DECIMAL_FLOAT_MODE_P (mode))
+ error ("use of decimal floating point types in AltiVec types is invalid");


   switch (altivec_type)
     {
@@ -19010,7 +19031,9 @@ rs6000_function_value (tree valtype, tre
   else
     mode = TYPE_MODE (valtype);

- if (SCALAR_FLOAT_TYPE_P (valtype) && TARGET_HARD_FLOAT && TARGET_FPRS)
+ if (DECIMAL_FLOAT_MODE_P (mode))
+ regno = GP_ARG_RETURN;
+ else if (SCALAR_FLOAT_TYPE_P (valtype) && TARGET_HARD_FLOAT && TARGET_FPRS)
regno = FP_ARG_RETURN;
else if (TREE_CODE (valtype) == COMPLEX_TYPE
&& targetm.calls.split_complex_arg)
@@ -19049,7 +19072,9 @@ rs6000_libcall_value (enum machine_mode
GEN_INT (4))));
}


-  if (SCALAR_FLOAT_MODE_P (mode)
+  if (DECIMAL_FLOAT_MODE_P (mode))
+    regno = GP_ARG_RETURN;
+  else if (SCALAR_FLOAT_MODE_P (mode)
           && TARGET_HARD_FLOAT && TARGET_FPRS)
     regno = FP_ARG_RETURN;
   else if (ALTIVEC_VECTOR_MODE (mode)
@@ -19177,6 +19202,16 @@ rs6000_eh_return_filter_mode (void)
   return TARGET_32BIT ? SImode : word_mode;
 }

+/* Target hook for scalar_mode_supported_p.  */
+static bool
+rs6000_scalar_mode_supported_p (enum machine_mode mode)
+{
+  if (DECIMAL_FLOAT_MODE_P (mode))
+    return true;
+  else
+    return default_scalar_mode_supported_p (mode);
+}
+
 /* Target hook for vector_mode_supported_p.  */
 static bool
 rs6000_vector_mode_supported_p (enum machine_mode mode)





Attachment: smime.p7s
Description: S/MIME cryptographic signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]