Commit 33521f7d by Eric Christopher Committed by Eric Christopher

builtins.c (apply_args_size): Use reg_raw_mode.

2004-03-17  Eric Christopher  <echristo@redhat.com>

	* builtins.c (apply_args_size): Use reg_raw_mode.
	(apply_result_size): Ditto.

From-SVN: r79609
parent 86881a7b
2004-03-17 Eric Christopher <echristo@redhat.com>
* builtins.c (apply_args_size): Use reg_raw_mode.
(apply_result_size): Ditto.
2004-03-17 Ralf Corsepius <corsepiu@faw.uni-ulm.de> 2004-03-17 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
PR target/14620 PR target/14620
......
...@@ -261,7 +261,7 @@ c_strlen (tree src, int only_value) ...@@ -261,7 +261,7 @@ c_strlen (tree src, int only_value)
len1 = c_strlen (TREE_OPERAND (src, 1), only_value); len1 = c_strlen (TREE_OPERAND (src, 1), only_value);
len2 = c_strlen (TREE_OPERAND (src, 2), only_value); len2 = c_strlen (TREE_OPERAND (src, 2), only_value);
if (tree_int_cst_equal (len1, len2)) if (tree_int_cst_equal (len1, len2))
return len1; return len1;
} }
...@@ -904,42 +904,8 @@ apply_args_size (void) ...@@ -904,42 +904,8 @@ apply_args_size (void)
for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
if (FUNCTION_ARG_REGNO_P (regno)) if (FUNCTION_ARG_REGNO_P (regno))
{ {
/* Search for the proper mode for copying this register's mode = reg_raw_mode[regno];
value. I'm not sure this is right, but it works so far. */
enum machine_mode best_mode = VOIDmode;
for (mode = GET_CLASS_NARROWEST_MODE (MODE_INT);
mode != VOIDmode;
mode = GET_MODE_WIDER_MODE (mode))
if (HARD_REGNO_MODE_OK (regno, mode)
&& hard_regno_nregs[regno][mode] == 1)
best_mode = mode;
if (best_mode == VOIDmode)
for (mode = GET_CLASS_NARROWEST_MODE (MODE_FLOAT);
mode != VOIDmode;
mode = GET_MODE_WIDER_MODE (mode))
if (HARD_REGNO_MODE_OK (regno, mode)
&& have_insn_for (SET, mode))
best_mode = mode;
if (best_mode == VOIDmode)
for (mode = GET_CLASS_NARROWEST_MODE (MODE_VECTOR_FLOAT);
mode != VOIDmode;
mode = GET_MODE_WIDER_MODE (mode))
if (HARD_REGNO_MODE_OK (regno, mode)
&& have_insn_for (SET, mode))
best_mode = mode;
if (best_mode == VOIDmode)
for (mode = GET_CLASS_NARROWEST_MODE (MODE_VECTOR_INT);
mode != VOIDmode;
mode = GET_MODE_WIDER_MODE (mode))
if (HARD_REGNO_MODE_OK (regno, mode)
&& have_insn_for (SET, mode))
best_mode = mode;
mode = best_mode;
if (mode == VOIDmode) if (mode == VOIDmode)
abort (); abort ();
...@@ -977,41 +943,8 @@ apply_result_size (void) ...@@ -977,41 +943,8 @@ apply_result_size (void)
for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
if (FUNCTION_VALUE_REGNO_P (regno)) if (FUNCTION_VALUE_REGNO_P (regno))
{ {
/* Search for the proper mode for copying this register's mode = reg_raw_mode[regno];
value. I'm not sure this is right, but it works so far. */
enum machine_mode best_mode = VOIDmode;
for (mode = GET_CLASS_NARROWEST_MODE (MODE_INT);
mode != TImode;
mode = GET_MODE_WIDER_MODE (mode))
if (HARD_REGNO_MODE_OK (regno, mode))
best_mode = mode;
if (best_mode == VOIDmode)
for (mode = GET_CLASS_NARROWEST_MODE (MODE_FLOAT);
mode != VOIDmode;
mode = GET_MODE_WIDER_MODE (mode))
if (HARD_REGNO_MODE_OK (regno, mode)
&& have_insn_for (SET, mode))
best_mode = mode;
if (best_mode == VOIDmode)
for (mode = GET_CLASS_NARROWEST_MODE (MODE_VECTOR_FLOAT);
mode != VOIDmode;
mode = GET_MODE_WIDER_MODE (mode))
if (HARD_REGNO_MODE_OK (regno, mode)
&& have_insn_for (SET, mode))
best_mode = mode;
if (best_mode == VOIDmode)
for (mode = GET_CLASS_NARROWEST_MODE (MODE_VECTOR_INT);
mode != VOIDmode;
mode = GET_MODE_WIDER_MODE (mode))
if (HARD_REGNO_MODE_OK (regno, mode)
&& have_insn_for (SET, mode))
best_mode = mode;
mode = best_mode;
if (mode == VOIDmode) if (mode == VOIDmode)
abort (); abort ();
...@@ -1109,7 +1042,7 @@ expand_builtin_apply_args_1 (void) ...@@ -1109,7 +1042,7 @@ expand_builtin_apply_args_1 (void)
NULL_RTX); NULL_RTX);
#endif #endif
emit_move_insn (adjust_address (registers, Pmode, 0), tem); emit_move_insn (adjust_address (registers, Pmode, 0), tem);
size = GET_MODE_SIZE (Pmode); size = GET_MODE_SIZE (Pmode);
/* Save the structure value address unless this is passed as an /* Save the structure value address unless this is passed as an
...@@ -1895,7 +1828,7 @@ expand_builtin_mathfn_2 (tree exp, rtx target, rtx subtarget) ...@@ -1895,7 +1828,7 @@ expand_builtin_mathfn_2 (tree exp, rtx target, rtx subtarget)
multiplications to inline before calling the system library's pow multiplications to inline before calling the system library's pow
function. powi(x,n) requires at worst 2*bits(n)-2 multiplications, function. powi(x,n) requires at worst 2*bits(n)-2 multiplications,
so this default never requires calling pow, powf or powl. */ so this default never requires calling pow, powf or powl. */
#ifndef POWI_MAX_MULTS #ifndef POWI_MAX_MULTS
#define POWI_MAX_MULTS (2*HOST_BITS_PER_WIDE_INT-2) #define POWI_MAX_MULTS (2*HOST_BITS_PER_WIDE_INT-2)
#endif #endif
...@@ -2012,7 +1945,7 @@ powi_cost (HOST_WIDE_INT n) ...@@ -2012,7 +1945,7 @@ powi_cost (HOST_WIDE_INT n)
result++; result++;
} }
} }
return result + powi_lookup_cost (val, cache); return result + powi_lookup_cost (val, cache);
} }
...@@ -2061,7 +1994,7 @@ expand_powi_1 (enum machine_mode mode, unsigned HOST_WIDE_INT n, rtx *cache) ...@@ -2061,7 +1994,7 @@ expand_powi_1 (enum machine_mode mode, unsigned HOST_WIDE_INT n, rtx *cache)
/* Expand the RTL to evaluate powi(x,n) in mode MODE. X is the /* Expand the RTL to evaluate powi(x,n) in mode MODE. X is the
floating point operand in mode MODE, and N is the exponent. This floating point operand in mode MODE, and N is the exponent. This
function needs to be kept in sync with powi_cost above. */ function needs to be kept in sync with powi_cost above. */
static rtx static rtx
expand_powi (rtx x, enum machine_mode mode, HOST_WIDE_INT n) expand_powi (rtx x, enum machine_mode mode, HOST_WIDE_INT n)
{ {
...@@ -2622,7 +2555,7 @@ expand_builtin_mempcpy (tree arglist, rtx target, enum machine_mode mode, ...@@ -2622,7 +2555,7 @@ expand_builtin_mempcpy (tree arglist, rtx target, enum machine_mode mode,
/* If LEN is not constant, call the normal function. */ /* If LEN is not constant, call the normal function. */
if (! host_integerp (len, 1)) if (! host_integerp (len, 1))
return 0; return 0;
/* If the LEN parameter is zero, return DEST. */ /* If the LEN parameter is zero, return DEST. */
if (tree_low_cst (len, 1) == 0) if (tree_low_cst (len, 1) == 0)
{ {
...@@ -3195,7 +3128,7 @@ expand_builtin_memcmp (tree exp ATTRIBUTE_UNUSED, tree arglist, rtx target, ...@@ -3195,7 +3128,7 @@ expand_builtin_memcmp (tree exp ATTRIBUTE_UNUSED, tree arglist, rtx target,
insn_mode = insn_data[(int) CODE_FOR_cmpstrsi].operand[0].mode; insn_mode = insn_data[(int) CODE_FOR_cmpstrsi].operand[0].mode;
else else
#endif #endif
return 0; return 0;
/* If we don't have POINTER_TYPE, call the function. */ /* If we don't have POINTER_TYPE, call the function. */
if (arg1_align == 0 || arg2_align == 0) if (arg1_align == 0 || arg2_align == 0)
...@@ -3597,7 +3530,7 @@ expand_builtin_strcat (tree arglist, rtx target, enum machine_mode mode) ...@@ -3597,7 +3530,7 @@ expand_builtin_strcat (tree arglist, rtx target, enum machine_mode mode)
pieces into (dst + strlen(dst)). */ pieces into (dst + strlen(dst)). */
tree newdst, arglist, tree newdst, arglist,
strlen_fn = implicit_built_in_decls[BUILT_IN_STRLEN]; strlen_fn = implicit_built_in_decls[BUILT_IN_STRLEN];
/* This is the length argument. */ /* This is the length argument. */
arglist = build_tree_list (NULL_TREE, arglist = build_tree_list (NULL_TREE,
fold (size_binop (PLUS_EXPR, fold (size_binop (PLUS_EXPR,
...@@ -3605,7 +3538,7 @@ expand_builtin_strcat (tree arglist, rtx target, enum machine_mode mode) ...@@ -3605,7 +3538,7 @@ expand_builtin_strcat (tree arglist, rtx target, enum machine_mode mode)
ssize_int (1)))); ssize_int (1))));
/* Prepend src argument. */ /* Prepend src argument. */
arglist = tree_cons (NULL_TREE, src, arglist); arglist = tree_cons (NULL_TREE, src, arglist);
/* We're going to use dst more than once. */ /* We're going to use dst more than once. */
dst = save_expr (dst); dst = save_expr (dst);
...@@ -3619,7 +3552,7 @@ expand_builtin_strcat (tree arglist, rtx target, enum machine_mode mode) ...@@ -3619,7 +3552,7 @@ expand_builtin_strcat (tree arglist, rtx target, enum machine_mode mode)
/* Prepend the new dst argument. */ /* Prepend the new dst argument. */
arglist = tree_cons (NULL_TREE, newdst, arglist); arglist = tree_cons (NULL_TREE, newdst, arglist);
/* We don't want to get turned into a memcpy if the /* We don't want to get turned into a memcpy if the
target is const0_rtx, i.e. when the return value target is const0_rtx, i.e. when the return value
isn't used. That would produce pessimized code so isn't used. That would produce pessimized code so
...@@ -4638,7 +4571,7 @@ build_string_literal (int len, const char *str) ...@@ -4638,7 +4571,7 @@ build_string_literal (int len, const char *str)
/* Expand a call to printf or printf_unlocked with argument list ARGLIST. /* Expand a call to printf or printf_unlocked with argument list ARGLIST.
Return 0 if a normal call should be emitted rather than transforming Return 0 if a normal call should be emitted rather than transforming
the function inline. If convenient, the result should be placed in the function inline. If convenient, the result should be placed in
TARGET with mode MODE. UNLOCKED indicates this is a printf_unlocked TARGET with mode MODE. UNLOCKED indicates this is a printf_unlocked
call. */ call. */
static rtx static rtx
expand_builtin_printf (tree arglist, rtx target, enum machine_mode mode, expand_builtin_printf (tree arglist, rtx target, enum machine_mode mode,
...@@ -4741,7 +4674,7 @@ expand_builtin_printf (tree arglist, rtx target, enum machine_mode mode, ...@@ -4741,7 +4674,7 @@ expand_builtin_printf (tree arglist, rtx target, enum machine_mode mode,
/* Expand a call to fprintf or fprintf_unlocked with argument list ARGLIST. /* Expand a call to fprintf or fprintf_unlocked with argument list ARGLIST.
Return 0 if a normal call should be emitted rather than transforming Return 0 if a normal call should be emitted rather than transforming
the function inline. If convenient, the result should be placed in the function inline. If convenient, the result should be placed in
TARGET with mode MODE. UNLOCKED indicates this is a fprintf_unlocked TARGET with mode MODE. UNLOCKED indicates this is a fprintf_unlocked
call. */ call. */
static rtx static rtx
expand_builtin_fprintf (tree arglist, rtx target, enum machine_mode mode, expand_builtin_fprintf (tree arglist, rtx target, enum machine_mode mode,
...@@ -6209,7 +6142,7 @@ fold_builtin_logarithm (tree exp, const REAL_VALUE_TYPE *value) ...@@ -6209,7 +6142,7 @@ fold_builtin_logarithm (tree exp, const REAL_VALUE_TYPE *value)
tree type = TREE_TYPE (TREE_TYPE (fndecl)); tree type = TREE_TYPE (TREE_TYPE (fndecl));
tree arg = TREE_VALUE (arglist); tree arg = TREE_VALUE (arglist);
const enum built_in_function fcode = builtin_mathfn_code (arg); const enum built_in_function fcode = builtin_mathfn_code (arg);
/* Optimize logN(1.0) = 0.0. */ /* Optimize logN(1.0) = 0.0. */
if (real_onep (arg)) if (real_onep (arg))
return build_real (type, dconst0); return build_real (type, dconst0);
...@@ -6224,7 +6157,7 @@ fold_builtin_logarithm (tree exp, const REAL_VALUE_TYPE *value) ...@@ -6224,7 +6157,7 @@ fold_builtin_logarithm (tree exp, const REAL_VALUE_TYPE *value)
if (real_dconstp (arg, &value_truncate)) if (real_dconstp (arg, &value_truncate))
return build_real (type, dconst1); return build_real (type, dconst1);
} }
/* Special case, optimize logN(expN(x)) = x. */ /* Special case, optimize logN(expN(x)) = x. */
if (flag_unsafe_math_optimizations if (flag_unsafe_math_optimizations
&& ((value == &dconste && ((value == &dconste
...@@ -6244,7 +6177,7 @@ fold_builtin_logarithm (tree exp, const REAL_VALUE_TYPE *value) ...@@ -6244,7 +6177,7 @@ fold_builtin_logarithm (tree exp, const REAL_VALUE_TYPE *value)
if (flag_unsafe_math_optimizations) if (flag_unsafe_math_optimizations)
{ {
tree exponent = 0, x = 0; tree exponent = 0, x = 0;
switch (fcode) switch (fcode)
{ {
case BUILT_IN_EXP: case BUILT_IN_EXP:
...@@ -6311,7 +6244,7 @@ fold_builtin_logarithm (tree exp, const REAL_VALUE_TYPE *value) ...@@ -6311,7 +6244,7 @@ fold_builtin_logarithm (tree exp, const REAL_VALUE_TYPE *value)
return 0; return 0;
} }
/* A subroutine of fold_builtin to fold the various exponent /* A subroutine of fold_builtin to fold the various exponent
functions. EXP is the CALL_EXPR of a call to a builtin function. functions. EXP is the CALL_EXPR of a call to a builtin function.
VALUE is the value which will be raised to a power. */ VALUE is the value which will be raised to a power. */
......
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