+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.
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
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
#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
* 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;
+}
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;
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;
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
*px = target;
*py = const0_rtx;
- *pmode = word_mode;
+ *pmode = cmp_mode;
*pcomparison = comparison;
*punsignedp = 0;
}