Commit 7fecf2c7 by Andrew Pinski

optabs.c (prepare_float_lib_cmp): Use libgcc_cmp_return_mode instead of word_mode.

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.

From-SVN: r128005
parent 973bb832
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> 2007-08-31 Joseph Myers <joseph@codesourcery.com>
* tree-pretty-print.c: Include output.h. * tree-pretty-print.c: Include output.h.
...@@ -39,6 +51,7 @@ ...@@ -39,6 +51,7 @@
split out from expand_binop. split out from expand_binop.
(avoid_expensive_constant): New function. (avoid_expensive_constant): New function.
(expand_binop_directly): Remove commutative_op argument and (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 call cummutative_optab_p instead. Do not change op0 or op1
when swapping xop0 and xop1. Apply avoid_expensive_constant when swapping xop0 and xop1. Apply avoid_expensive_constant
to each argument after potential swapping. Enforce the to each argument after potential swapping. Enforce the
......
...@@ -454,9 +454,9 @@ typedef unsigned int USItype __attribute__ ((mode (SI))); ...@@ -454,9 +454,9 @@ typedef unsigned int USItype __attribute__ ((mode (SI)));
typedef unsigned int UDItype __attribute__ ((mode (DI))); typedef unsigned int UDItype __attribute__ ((mode (DI)));
/* The type of the result of a decimal float comparison. This must /* 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. */ /* Prototypes. */
......
...@@ -108,9 +108,9 @@ typedef int TItype __attribute__ ((mode (TI))); ...@@ -108,9 +108,9 @@ typedef int TItype __attribute__ ((mode (TI)));
#endif #endif
/* The type of the result of a floating point comparison. This must /* 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 #ifndef CMPtype
typedef int CMPtype __attribute__ ((mode (word))); typedef int CMPtype __attribute__ ((mode (__libgcc_cmp_return__)));
#endif #endif
typedef unsigned int UHItype __attribute__ ((mode (HI))); typedef unsigned int UHItype __attribute__ ((mode (HI)));
......
...@@ -174,6 +174,12 @@ static int cpat_info(unsigned char *arr, int size, int *prun, int *pstart); ...@@ -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, static enum immediate_class classify_immediate (rtx op,
enum machine_mode mode); 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. */ /* Built in types. */
tree spu_builtin_types[SPU_BTI_MAX]; tree spu_builtin_types[SPU_BTI_MAX];
...@@ -275,6 +281,12 @@ const struct attribute_spec spu_attribute_table[]; ...@@ -275,6 +281,12 @@ const struct attribute_spec spu_attribute_table[];
#undef TARGET_VECTOR_ALIGNMENT_REACHABLE #undef TARGET_VECTOR_ALIGNMENT_REACHABLE
#define TARGET_VECTOR_ALIGNMENT_REACHABLE spu_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; struct gcc_target targetm = TARGET_INITIALIZER;
void void
...@@ -5502,4 +5514,21 @@ spu_init_expanders (void) ...@@ -5502,4 +5514,21 @@ spu_init_expanders (void)
* expanding the prologue. */ * expanding the prologue. */
if (cfun) if (cfun)
REGNO_POINTER_ALIGN (HARD_FRAME_POINTER_REGNUM) = 8; 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;
}
...@@ -4232,10 +4232,11 @@ prepare_float_lib_cmp (rtx *px, rtx *py, enum rtx_code *pcomparison, ...@@ -4232,10 +4232,11 @@ prepare_float_lib_cmp (rtx *px, rtx *py, enum rtx_code *pcomparison,
rtx x = *px; rtx x = *px;
rtx y = *py; rtx y = *py;
enum machine_mode orig_mode = GET_MODE (x); enum machine_mode orig_mode = GET_MODE (x);
enum machine_mode mode; enum machine_mode mode, cmp_mode;
rtx value, target, insns, equiv; rtx value, target, insns, equiv;
rtx libfunc = 0; rtx libfunc = 0;
bool reversed_p = false; bool reversed_p = false;
cmp_mode = targetm.libgcc_cmp_return_mode ();
for (mode = orig_mode; for (mode = orig_mode;
mode != VOIDmode; mode != VOIDmode;
...@@ -4274,14 +4275,14 @@ prepare_float_lib_cmp (rtx *px, rtx *py, enum rtx_code *pcomparison, ...@@ -4274,14 +4275,14 @@ prepare_float_lib_cmp (rtx *px, rtx *py, enum rtx_code *pcomparison,
condition can be determined at compile-time. */ condition can be determined at compile-time. */
if (comparison == UNORDERED) if (comparison == UNORDERED)
{ {
rtx temp = simplify_gen_relational (NE, word_mode, mode, x, x); rtx temp = simplify_gen_relational (NE, cmp_mode, mode, x, x);
equiv = simplify_gen_relational (NE, word_mode, mode, y, y); equiv = simplify_gen_relational (NE, cmp_mode, mode, y, y);
equiv = simplify_gen_ternary (IF_THEN_ELSE, word_mode, word_mode, equiv = simplify_gen_ternary (IF_THEN_ELSE, cmp_mode, cmp_mode,
temp, const_true_rtx, equiv); temp, const_true_rtx, equiv);
} }
else 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)) if (! FLOAT_LIB_COMPARE_RETURNS_BOOL (mode, comparison))
{ {
rtx true_rtx, false_rtx; rtx true_rtx, false_rtx;
...@@ -4321,18 +4322,18 @@ prepare_float_lib_cmp (rtx *px, rtx *py, enum rtx_code *pcomparison, ...@@ -4321,18 +4322,18 @@ prepare_float_lib_cmp (rtx *px, rtx *py, enum rtx_code *pcomparison,
default: default:
gcc_unreachable (); 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); equiv, true_rtx, false_rtx);
} }
} }
start_sequence (); start_sequence ();
value = emit_library_call_value (libfunc, NULL_RTX, LCT_CONST, 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 (); insns = get_insns ();
end_sequence (); end_sequence ();
target = gen_reg_rtx (word_mode); target = gen_reg_rtx (cmp_mode);
emit_libcall_block (insns, target, value, equiv); emit_libcall_block (insns, target, value, equiv);
if (comparison == UNORDERED if (comparison == UNORDERED
...@@ -4341,7 +4342,7 @@ prepare_float_lib_cmp (rtx *px, rtx *py, enum rtx_code *pcomparison, ...@@ -4341,7 +4342,7 @@ prepare_float_lib_cmp (rtx *px, rtx *py, enum rtx_code *pcomparison,
*px = target; *px = target;
*py = const0_rtx; *py = const0_rtx;
*pmode = word_mode; *pmode = cmp_mode;
*pcomparison = comparison; *pcomparison = comparison;
*punsignedp = 0; *punsignedp = 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment