Commit 3403a1a9 by Anatoly Sokolov Committed by Anatoly Sokolov

Use lowpart_subreg instead of simplify_gen_subreg

From-SVN: r226417
parent e8fa3817
2015-07-30 Anatoly Sokolov <aesok@post.ru>
* rtl.h (lowpart_subreg): Move in file.
* loop-iv.c (lowpart_subreg): Move to...
* simplify-rtx.c (lowpart_subreg): ...here.
(simplify_binary_operation_1): Use lowpart_subreg instead of
simplify_gen_subreg.
* expr.c (expand_expr_real_2): Ditto.
* emit-rtl.c (gen_lowpart_common): Ditto.
* combine.c (gen_lowpart_for_combine): Ditto.
* cfgexpand.c (convert_debug_memory_address, expand_debug_expr,
expand_debug_source_expr): Ditto.
2015-07-30 Richard Sandiford <richard.sandiford@arm.com> 2015-07-30 Richard Sandiford <richard.sandiford@arm.com>
* builtins.c (HAVE_atomic_clear, gen_atomic_clear): Delete. * builtins.c (HAVE_atomic_clear, gen_atomic_clear): Delete.
......
...@@ -3632,9 +3632,7 @@ convert_debug_memory_address (machine_mode mode, rtx x, ...@@ -3632,9 +3632,7 @@ convert_debug_memory_address (machine_mode mode, rtx x,
return x; return x;
if (GET_MODE_PRECISION (mode) < GET_MODE_PRECISION (xmode)) if (GET_MODE_PRECISION (mode) < GET_MODE_PRECISION (xmode))
x = simplify_gen_subreg (mode, x, xmode, x = lowpart_subreg (mode, x, xmode);
subreg_lowpart_offset
(mode, xmode));
else if (POINTERS_EXTEND_UNSIGNED > 0) else if (POINTERS_EXTEND_UNSIGNED > 0)
x = gen_rtx_ZERO_EXTEND (mode, x); x = gen_rtx_ZERO_EXTEND (mode, x);
else if (!POINTERS_EXTEND_UNSIGNED) else if (!POINTERS_EXTEND_UNSIGNED)
...@@ -3850,9 +3848,7 @@ expand_debug_expr (tree exp) ...@@ -3850,9 +3848,7 @@ expand_debug_expr (tree exp)
if (SCALAR_INT_MODE_P (opmode) if (SCALAR_INT_MODE_P (opmode)
&& (GET_MODE_PRECISION (opmode) && (GET_MODE_PRECISION (opmode)
< GET_MODE_PRECISION (inner_mode))) < GET_MODE_PRECISION (inner_mode)))
op1 = simplify_gen_subreg (opmode, op1, inner_mode, op1 = lowpart_subreg (opmode, op1, inner_mode);
subreg_lowpart_offset (opmode,
inner_mode));
} }
break; break;
default: default:
...@@ -4011,9 +4007,7 @@ expand_debug_expr (tree exp) ...@@ -4011,9 +4007,7 @@ expand_debug_expr (tree exp)
} }
else if (CONSTANT_P (op0) else if (CONSTANT_P (op0)
|| GET_MODE_PRECISION (mode) <= GET_MODE_PRECISION (inner_mode)) || GET_MODE_PRECISION (mode) <= GET_MODE_PRECISION (inner_mode))
op0 = simplify_gen_subreg (mode, op0, inner_mode, op0 = lowpart_subreg (mode, op0, inner_mode);
subreg_lowpart_offset (mode,
inner_mode));
else if (UNARY_CLASS_P (exp) else if (UNARY_CLASS_P (exp)
? TYPE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 0))) ? TYPE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 0)))
: unsignedp) : unsignedp)
...@@ -4141,9 +4135,7 @@ expand_debug_expr (tree exp) ...@@ -4141,9 +4135,7 @@ expand_debug_expr (tree exp)
offmode = TYPE_MODE (TREE_TYPE (offset)); offmode = TYPE_MODE (TREE_TYPE (offset));
if (addrmode != offmode) if (addrmode != offmode)
op1 = simplify_gen_subreg (addrmode, op1, offmode, op1 = lowpart_subreg (addrmode, op1, offmode);
subreg_lowpart_offset (addrmode,
offmode));
/* Don't use offset_address here, we don't need a /* Don't use offset_address here, we don't need a
recognizable address, and we don't want to generate recognizable address, and we don't want to generate
...@@ -4868,8 +4860,7 @@ expand_debug_source_expr (tree exp) ...@@ -4868,8 +4860,7 @@ expand_debug_source_expr (tree exp)
} }
else if (CONSTANT_P (op0) else if (CONSTANT_P (op0)
|| GET_MODE_BITSIZE (mode) <= GET_MODE_BITSIZE (inner_mode)) || GET_MODE_BITSIZE (mode) <= GET_MODE_BITSIZE (inner_mode))
op0 = simplify_gen_subreg (mode, op0, inner_mode, op0 = lowpart_subreg (mode, op0, inner_mode);
subreg_lowpart_offset (mode, inner_mode));
else if (TYPE_UNSIGNED (TREE_TYPE (exp))) else if (TYPE_UNSIGNED (TREE_TYPE (exp)))
op0 = simplify_gen_unary (ZERO_EXTEND, mode, op0, inner_mode); op0 = simplify_gen_unary (ZERO_EXTEND, mode, op0, inner_mode);
else else
......
...@@ -11194,10 +11194,8 @@ gen_lowpart_for_combine (machine_mode omode, rtx x) ...@@ -11194,10 +11194,8 @@ gen_lowpart_for_combine (machine_mode omode, rtx x)
include an explicit SUBREG or we may simplify it further in combine. */ include an explicit SUBREG or we may simplify it further in combine. */
else else
{ {
int offset = 0;
rtx res; rtx res;
offset = subreg_lowpart_offset (omode, imode);
if (imode == VOIDmode) if (imode == VOIDmode)
{ {
imode = int_mode_for_mode (omode); imode = int_mode_for_mode (omode);
...@@ -11205,7 +11203,7 @@ gen_lowpart_for_combine (machine_mode omode, rtx x) ...@@ -11205,7 +11203,7 @@ gen_lowpart_for_combine (machine_mode omode, rtx x)
if (x == NULL) if (x == NULL)
goto fail; goto fail;
} }
res = simplify_gen_subreg (omode, x, imode, offset); res = lowpart_subreg (omode, x, imode);
if (res) if (res)
return res; return res;
} }
......
...@@ -1377,7 +1377,6 @@ gen_lowpart_common (machine_mode mode, rtx x) ...@@ -1377,7 +1377,6 @@ gen_lowpart_common (machine_mode mode, rtx x)
{ {
int msize = GET_MODE_SIZE (mode); int msize = GET_MODE_SIZE (mode);
int xsize; int xsize;
int offset = 0;
machine_mode innermode; machine_mode innermode;
/* Unfortunately, this routine doesn't take a parameter for the mode of X, /* Unfortunately, this routine doesn't take a parameter for the mode of X,
...@@ -1405,8 +1404,6 @@ gen_lowpart_common (machine_mode mode, rtx x) ...@@ -1405,8 +1404,6 @@ gen_lowpart_common (machine_mode mode, rtx x)
if (SCALAR_FLOAT_MODE_P (mode) && msize > xsize) if (SCALAR_FLOAT_MODE_P (mode) && msize > xsize)
return 0; return 0;
offset = subreg_lowpart_offset (mode, innermode);
if ((GET_CODE (x) == ZERO_EXTEND || GET_CODE (x) == SIGN_EXTEND) if ((GET_CODE (x) == ZERO_EXTEND || GET_CODE (x) == SIGN_EXTEND)
&& (GET_MODE_CLASS (mode) == MODE_INT && (GET_MODE_CLASS (mode) == MODE_INT
|| GET_MODE_CLASS (mode) == MODE_PARTIAL_INT)) || GET_MODE_CLASS (mode) == MODE_PARTIAL_INT))
...@@ -1429,7 +1426,7 @@ gen_lowpart_common (machine_mode mode, rtx x) ...@@ -1429,7 +1426,7 @@ gen_lowpart_common (machine_mode mode, rtx x)
else if (GET_CODE (x) == SUBREG || REG_P (x) else if (GET_CODE (x) == SUBREG || REG_P (x)
|| GET_CODE (x) == CONCAT || GET_CODE (x) == CONST_VECTOR || GET_CODE (x) == CONCAT || GET_CODE (x) == CONST_VECTOR
|| CONST_DOUBLE_AS_FLOAT_P (x) || CONST_SCALAR_INT_P (x)) || CONST_DOUBLE_AS_FLOAT_P (x) || CONST_SCALAR_INT_P (x))
return simplify_gen_subreg (mode, x, innermode, offset); return lowpart_subreg (mode, x, innermode);
/* Otherwise, we can't do this. */ /* Otherwise, we can't do this. */
return 0; return 0;
......
...@@ -8137,9 +8137,7 @@ expand_expr_real_2 (sepops ops, rtx target, machine_mode tmode, ...@@ -8137,9 +8137,7 @@ expand_expr_real_2 (sepops ops, rtx target, machine_mode tmode,
inner_mode = TYPE_MODE (inner_type); inner_mode = TYPE_MODE (inner_type);
if (modifier == EXPAND_INITIALIZER) if (modifier == EXPAND_INITIALIZER)
op0 = simplify_gen_subreg (mode, op0, inner_mode, op0 = lowpart_subreg (mode, op0, inner_mode);
subreg_lowpart_offset (mode,
inner_mode));
else else
op0= convert_modes (mode, inner_mode, op0, op0= convert_modes (mode, inner_mode, op0,
TYPE_UNSIGNED (inner_type)); TYPE_UNSIGNED (inner_type));
......
...@@ -205,17 +205,6 @@ dump_iv_info (FILE *file, struct rtx_iv *iv) ...@@ -205,17 +205,6 @@ dump_iv_info (FILE *file, struct rtx_iv *iv)
fprintf (file, " (first special)"); fprintf (file, " (first special)");
} }
/* Generates a subreg to get the least significant part of EXPR (in mode
INNER_MODE) to OUTER_MODE. */
rtx
lowpart_subreg (machine_mode outer_mode, rtx expr,
machine_mode inner_mode)
{
return simplify_gen_subreg (outer_mode, expr, inner_mode,
subreg_lowpart_offset (outer_mode, inner_mode));
}
static void static void
check_iv_ref_table_size (void) check_iv_ref_table_size (void)
{ {
......
...@@ -2731,10 +2731,6 @@ extern rtx immed_double_const (HOST_WIDE_INT, HOST_WIDE_INT, ...@@ -2731,10 +2731,6 @@ extern rtx immed_double_const (HOST_WIDE_INT, HOST_WIDE_INT,
machine_mode); machine_mode);
#endif #endif
/* In loop-iv.c */
extern rtx lowpart_subreg (machine_mode, rtx, machine_mode);
/* In varasm.c */ /* In varasm.c */
extern rtx force_const_mem (machine_mode, rtx); extern rtx force_const_mem (machine_mode, rtx);
...@@ -2866,6 +2862,7 @@ extern rtx simplify_subreg (machine_mode, rtx, machine_mode, ...@@ -2866,6 +2862,7 @@ extern rtx simplify_subreg (machine_mode, rtx, machine_mode,
unsigned int); unsigned int);
extern rtx simplify_gen_subreg (machine_mode, rtx, machine_mode, extern rtx simplify_gen_subreg (machine_mode, rtx, machine_mode,
unsigned int); unsigned int);
extern rtx lowpart_subreg (machine_mode, rtx, machine_mode);
extern rtx simplify_replace_fn_rtx (rtx, const_rtx, extern rtx simplify_replace_fn_rtx (rtx, const_rtx,
rtx (*fn) (rtx, const_rtx, void *), void *); rtx (*fn) (rtx, const_rtx, void *), void *);
extern rtx simplify_replace_rtx (rtx, const_rtx, rtx); extern rtx simplify_replace_rtx (rtx, const_rtx, rtx);
......
...@@ -3224,9 +3224,7 @@ simplify_binary_operation_1 (enum rtx_code code, machine_mode mode, ...@@ -3224,9 +3224,7 @@ simplify_binary_operation_1 (enum rtx_code code, machine_mode mode,
GET_MODE (SUBREG_REG (op0)), GET_MODE (SUBREG_REG (op0)),
XEXP (SUBREG_REG (op0), 0), XEXP (SUBREG_REG (op0), 0),
tmp); tmp);
return simplify_gen_subreg (mode, tmp, inner_mode, return lowpart_subreg (mode, tmp, inner_mode);
subreg_lowpart_offset (mode,
inner_mode));
} }
canonicalize_shift: canonicalize_shift:
if (SHIFT_COUNT_TRUNCATED && CONST_INT_P (op1)) if (SHIFT_COUNT_TRUNCATED && CONST_INT_P (op1))
...@@ -6027,6 +6025,17 @@ simplify_gen_subreg (machine_mode outermode, rtx op, ...@@ -6027,6 +6025,17 @@ simplify_gen_subreg (machine_mode outermode, rtx op,
return NULL_RTX; return NULL_RTX;
} }
/* Generates a subreg to get the least significant part of EXPR (in mode
INNER_MODE) to OUTER_MODE. */
rtx
lowpart_subreg (machine_mode outer_mode, rtx expr,
machine_mode inner_mode)
{
return simplify_gen_subreg (outer_mode, expr, inner_mode,
subreg_lowpart_offset (outer_mode, inner_mode));
}
/* Simplify X, an rtx expression. /* Simplify X, an rtx expression.
Return the simplified expression or NULL if no simplifications Return the simplified expression or NULL if no simplifications
......
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