OSDN Git Service

2007-08-31 Andrew Pinski <andrew_pinski@playstation.sony.com>
authorpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 31 Aug 2007 22:45:43 +0000 (22:45 +0000)
committerpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 31 Aug 2007 22:45:43 +0000 (22:45 +0000)
        * optabs.c (prepare_float_lib_cmp): Use
        libgcc_cmp_return_mode instead of word_mode.
        * config/dfp-bit.h: Likewise.
        * config/fp-bit.h: Likewise.
        * config/spu/spu.c (spu_libgcc_cmp_return_mode):
        New function.
        (spu_libgcc_shift_count_mode): New function.
        (TARGET_LIBGCC_CMP_RETURN_MODE): Define.
        (TARGET_LIBGCC_SHIFT_COUNT_MODE): Define.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@128005 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/dfp-bit.h
gcc/config/fp-bit.h
gcc/config/spu/spu.c
gcc/optabs.c

index bed7f66..8edd7f4 100644 (file)
@@ -1,3 +1,15 @@
+2007-08-31  Andrew Pinski  <andrew_pinski@playstation.sony.com>
+
+       * optabs.c (prepare_float_lib_cmp): Use
+       libgcc_cmp_return_mode instead of word_mode.
+       * config/dfp-bit.h: Likewise.
+       * config/fp-bit.h: Likewise.
+       * config/spu/spu.c (spu_libgcc_cmp_return_mode):
+       New function.
+       (spu_libgcc_shift_count_mode): New function.
+       (TARGET_LIBGCC_CMP_RETURN_MODE): Define.
+       (TARGET_LIBGCC_SHIFT_COUNT_MODE): Define.
+
 2007-08-31  Joseph Myers  <joseph@codesourcery.com>
 
        * tree-pretty-print.c: Include output.h.
@@ -39,6 +51,7 @@
        split out from expand_binop.
        (avoid_expensive_constant): New function.
        (expand_binop_directly): Remove commutative_op argument and
+       (expand_binop_directly): Remove commutative_op argument and
        call cummutative_optab_p instead.  Do not change op0 or op1
        when swapping xop0 and xop1.  Apply avoid_expensive_constant
        to each argument after potential swapping.  Enforce the
index 5238a2b..dfbf4f4 100644 (file)
@@ -454,9 +454,9 @@ typedef unsigned int USItype __attribute__ ((mode (SI)));
 typedef unsigned int UDItype __attribute__ ((mode (DI)));
 
 /* The type of the result of a decimal float comparison.  This must
-   match `word_mode' in GCC for the target.  */
+   match `__libgcc_cmp_return__' in GCC for the target.  */
 
-typedef int CMPtype __attribute__ ((mode (word)));
+typedef int CMPtype __attribute__ ((mode (__libgcc_cmp_return__)));
 
 /* Prototypes.  */
 
index 0f03f87..5f9082c 100644 (file)
@@ -108,9 +108,9 @@ typedef int TItype __attribute__ ((mode (TI)));
 #endif
 
 /* The type of the result of a floating point comparison.  This must
-   match `word_mode' in GCC for the target.  */
+   match `__libgcc_cmp_return__' in GCC for the target.  */
 #ifndef CMPtype
-typedef int CMPtype __attribute__ ((mode (word)));
+typedef int CMPtype __attribute__ ((mode (__libgcc_cmp_return__)));
 #endif
 
 typedef unsigned int UHItype __attribute__ ((mode (HI)));
index eda0de0..7fcc942 100644 (file)
@@ -174,6 +174,12 @@ static int cpat_info(unsigned char *arr, int size, int *prun, int *pstart);
 static enum immediate_class classify_immediate (rtx op,
                                                enum machine_mode mode);
 
+static enum machine_mode
+spu_libgcc_cmp_return_mode (void);
+
+static enum machine_mode
+spu_libgcc_shift_count_mode (void);
+
 /* Built in types.  */
 tree spu_builtin_types[SPU_BTI_MAX];
 \f
@@ -275,6 +281,12 @@ const struct attribute_spec spu_attribute_table[];
 #undef TARGET_VECTOR_ALIGNMENT_REACHABLE
 #define TARGET_VECTOR_ALIGNMENT_REACHABLE spu_vector_alignment_reachable
 
+#undef TARGET_LIBGCC_CMP_RETURN_MODE
+#define TARGET_LIBGCC_CMP_RETURN_MODE spu_libgcc_cmp_return_mode
+
+#undef TARGET_LIBGCC_SHIFT_COUNT_MODE
+#define TARGET_LIBGCC_SHIFT_COUNT_MODE spu_libgcc_shift_count_mode
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 void
@@ -5502,4 +5514,21 @@ spu_init_expanders (void)
    * expanding the prologue. */
   if (cfun)
     REGNO_POINTER_ALIGN (HARD_FRAME_POINTER_REGNUM) = 8;
-}       
+}
+
+static enum machine_mode
+spu_libgcc_cmp_return_mode (void)
+{
+
+/* For SPU word mode is TI mode so it is better to use SImode
+   for compare returns.  */
+  return SImode;
+}
+
+static enum machine_mode
+spu_libgcc_shift_count_mode (void)
+{
+/* For SPU word mode is TI mode so it is better to use SImode
+   for shift counts.  */
+  return SImode;
+}
index 6b29263..9731971 100644 (file)
@@ -4232,10 +4232,11 @@ prepare_float_lib_cmp (rtx *px, rtx *py, enum rtx_code *pcomparison,
   rtx x = *px;
   rtx y = *py;
   enum machine_mode orig_mode = GET_MODE (x);
-  enum machine_mode mode;
+  enum machine_mode mode, cmp_mode;
   rtx value, target, insns, equiv;
   rtx libfunc = 0;
   bool reversed_p = false;
+  cmp_mode = targetm.libgcc_cmp_return_mode ();
 
   for (mode = orig_mode;
        mode != VOIDmode;
@@ -4274,14 +4275,14 @@ prepare_float_lib_cmp (rtx *px, rtx *py, enum rtx_code *pcomparison,
      condition can be determined at compile-time.  */
   if (comparison == UNORDERED)
     {
-      rtx temp = simplify_gen_relational (NE, word_mode, mode, x, x);
-      equiv = simplify_gen_relational (NE, word_mode, mode, y, y);
-      equiv = simplify_gen_ternary (IF_THEN_ELSE, word_mode, word_mode,
+      rtx temp = simplify_gen_relational (NE, cmp_mode, mode, x, x);
+      equiv = simplify_gen_relational (NE, cmp_mode, mode, y, y);
+      equiv = simplify_gen_ternary (IF_THEN_ELSE, cmp_mode, cmp_mode,
                                    temp, const_true_rtx, equiv);
     }
   else
     {
-      equiv = simplify_gen_relational (comparison, word_mode, mode, x, y);
+      equiv = simplify_gen_relational (comparison, cmp_mode, mode, x, y);
       if (! FLOAT_LIB_COMPARE_RETURNS_BOOL (mode, comparison))
        {
          rtx true_rtx, false_rtx;
@@ -4321,18 +4322,18 @@ prepare_float_lib_cmp (rtx *px, rtx *py, enum rtx_code *pcomparison,
            default:
              gcc_unreachable ();
            }
-         equiv = simplify_gen_ternary (IF_THEN_ELSE, word_mode, word_mode,
+         equiv = simplify_gen_ternary (IF_THEN_ELSE, cmp_mode, cmp_mode,
                                        equiv, true_rtx, false_rtx);
        }
     }
 
   start_sequence ();
   value = emit_library_call_value (libfunc, NULL_RTX, LCT_CONST,
-                                  word_mode, 2, x, mode, y, mode);
+                                  cmp_mode, 2, x, mode, y, mode);
   insns = get_insns ();
   end_sequence ();
 
-  target = gen_reg_rtx (word_mode);
+  target = gen_reg_rtx (cmp_mode);
   emit_libcall_block (insns, target, value, equiv);
 
   if (comparison == UNORDERED
@@ -4341,7 +4342,7 @@ prepare_float_lib_cmp (rtx *px, rtx *py, enum rtx_code *pcomparison,
 
   *px = target;
   *py = const0_rtx;
-  *pmode = word_mode;
+  *pmode = cmp_mode;
   *pcomparison = comparison;
   *punsignedp = 0;
 }