Commit 4aa81c2e by Kyrylo Tkachov Committed by Kyrylo Tkachov

[AArch64] Use REG_P and CONST_INT_P instead of GET_CODE + comparison.

	* config/aarch64/aarch64.c (aarch64_classify_address): Use REG_P and
	CONST_INT_P instead of GET_CODE and compare.
	(aarch64_select_cc_mode): Likewise.
	(aarch64_print_operand): Likewise.
	(aarch64_rtx_costs): Likewise.
	(aarch64_simd_valid_immediate): Likewise.
	(aarch64_simd_check_vect_par_cnst_half): Likewise.
	(aarch64_simd_emit_pair_result_insn): Likewise.

From-SVN: r213651
parent 0483b363
2014-08-06 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* config/aarch64/aarch64.c (aarch64_classify_address): Use REG_P and
CONST_INT_P instead of GET_CODE and compare.
(aarch64_select_cc_mode): Likewise.
(aarch64_print_operand): Likewise.
(aarch64_rtx_costs): Likewise.
(aarch64_simd_valid_immediate): Likewise.
(aarch64_simd_check_vect_par_cnst_half): Likewise.
(aarch64_simd_emit_pair_result_insn): Likewise.
2014-08-05 David Malcolm <dmalcolm@redhat.com> 2014-08-05 David Malcolm <dmalcolm@redhat.com>
* gdbhooks.py (find_gcc_source_dir): New helper function. * gdbhooks.py (find_gcc_source_dir): New helper function.
......
...@@ -3250,11 +3250,11 @@ aarch64_classify_address (struct aarch64_address_info *info, ...@@ -3250,11 +3250,11 @@ aarch64_classify_address (struct aarch64_address_info *info,
op1 = XEXP (x, 1); op1 = XEXP (x, 1);
if (! strict_p if (! strict_p
&& GET_CODE (op0) == REG && REG_P (op0)
&& (op0 == virtual_stack_vars_rtx && (op0 == virtual_stack_vars_rtx
|| op0 == frame_pointer_rtx || op0 == frame_pointer_rtx
|| op0 == arg_pointer_rtx) || op0 == arg_pointer_rtx)
&& GET_CODE (op1) == CONST_INT) && CONST_INT_P (op1))
{ {
info->type = ADDRESS_REG_IMM; info->type = ADDRESS_REG_IMM;
info->base = op0; info->base = op0;
...@@ -3542,7 +3542,7 @@ aarch64_select_cc_mode (RTX_CODE code, rtx x, rtx y) ...@@ -3542,7 +3542,7 @@ aarch64_select_cc_mode (RTX_CODE code, rtx x, rtx y)
the comparison will have to be swapped when we emit the assembly the comparison will have to be swapped when we emit the assembly
code. */ code. */
if ((GET_MODE (x) == SImode || GET_MODE (x) == DImode) if ((GET_MODE (x) == SImode || GET_MODE (x) == DImode)
&& (GET_CODE (y) == REG || GET_CODE (y) == SUBREG) && (REG_P (y) || GET_CODE (y) == SUBREG)
&& (GET_CODE (x) == ASHIFT || GET_CODE (x) == ASHIFTRT && (GET_CODE (x) == ASHIFT || GET_CODE (x) == ASHIFTRT
|| GET_CODE (x) == LSHIFTRT || GET_CODE (x) == LSHIFTRT
|| GET_CODE (x) == ZERO_EXTEND || GET_CODE (x) == SIGN_EXTEND)) || GET_CODE (x) == ZERO_EXTEND || GET_CODE (x) == SIGN_EXTEND))
...@@ -3551,7 +3551,7 @@ aarch64_select_cc_mode (RTX_CODE code, rtx x, rtx y) ...@@ -3551,7 +3551,7 @@ aarch64_select_cc_mode (RTX_CODE code, rtx x, rtx y)
/* Similarly for a negated operand, but we can only do this for /* Similarly for a negated operand, but we can only do this for
equalities. */ equalities. */
if ((GET_MODE (x) == SImode || GET_MODE (x) == DImode) if ((GET_MODE (x) == SImode || GET_MODE (x) == DImode)
&& (GET_CODE (y) == REG || GET_CODE (y) == SUBREG) && (REG_P (y) || GET_CODE (y) == SUBREG)
&& (code == EQ || code == NE) && (code == EQ || code == NE)
&& GET_CODE (x) == NEG) && GET_CODE (x) == NEG)
return CC_Zmode; return CC_Zmode;
...@@ -3711,7 +3711,7 @@ aarch64_print_operand (FILE *f, rtx x, char code) ...@@ -3711,7 +3711,7 @@ aarch64_print_operand (FILE *f, rtx x, char code)
{ {
int n; int n;
if (GET_CODE (x) != CONST_INT if (!CONST_INT_P (x)
|| (n = exact_log2 (INTVAL (x) & ~7)) <= 0) || (n = exact_log2 (INTVAL (x) & ~7)) <= 0)
{ {
output_operand_lossage ("invalid operand for '%%%c'", code); output_operand_lossage ("invalid operand for '%%%c'", code);
...@@ -3741,7 +3741,7 @@ aarch64_print_operand (FILE *f, rtx x, char code) ...@@ -3741,7 +3741,7 @@ aarch64_print_operand (FILE *f, rtx x, char code)
int n; int n;
/* Print N such that 2^N == X. */ /* Print N such that 2^N == X. */
if (GET_CODE (x) != CONST_INT || (n = exact_log2 (INTVAL (x))) < 0) if (!CONST_INT_P (x) || (n = exact_log2 (INTVAL (x))) < 0)
{ {
output_operand_lossage ("invalid operand for '%%%c'", code); output_operand_lossage ("invalid operand for '%%%c'", code);
return; return;
...@@ -3753,7 +3753,7 @@ aarch64_print_operand (FILE *f, rtx x, char code) ...@@ -3753,7 +3753,7 @@ aarch64_print_operand (FILE *f, rtx x, char code)
case 'P': case 'P':
/* Print the number of non-zero bits in X (a const_int). */ /* Print the number of non-zero bits in X (a const_int). */
if (GET_CODE (x) != CONST_INT) if (!CONST_INT_P (x))
{ {
output_operand_lossage ("invalid operand for '%%%c'", code); output_operand_lossage ("invalid operand for '%%%c'", code);
return; return;
...@@ -3764,7 +3764,7 @@ aarch64_print_operand (FILE *f, rtx x, char code) ...@@ -3764,7 +3764,7 @@ aarch64_print_operand (FILE *f, rtx x, char code)
case 'H': case 'H':
/* Print the higher numbered register of a pair (TImode) of regs. */ /* Print the higher numbered register of a pair (TImode) of regs. */
if (GET_CODE (x) != REG || !GP_REGNUM_P (REGNO (x) + 1)) if (!REG_P (x) || !GP_REGNUM_P (REGNO (x) + 1))
{ {
output_operand_lossage ("invalid operand for '%%%c'", code); output_operand_lossage ("invalid operand for '%%%c'", code);
return; return;
...@@ -3838,7 +3838,7 @@ aarch64_print_operand (FILE *f, rtx x, char code) ...@@ -3838,7 +3838,7 @@ aarch64_print_operand (FILE *f, rtx x, char code)
case 'X': case 'X':
/* Print bottom 16 bits of integer constant in hex. */ /* Print bottom 16 bits of integer constant in hex. */
if (GET_CODE (x) != CONST_INT) if (!CONST_INT_P (x))
{ {
output_operand_lossage ("invalid operand for '%%%c'", code); output_operand_lossage ("invalid operand for '%%%c'", code);
return; return;
...@@ -5108,7 +5108,7 @@ aarch64_rtx_costs (rtx x, int code, int outer ATTRIBUTE_UNUSED, ...@@ -5108,7 +5108,7 @@ aarch64_rtx_costs (rtx x, int code, int outer ATTRIBUTE_UNUSED,
op1 = SUBREG_REG (op1); op1 = SUBREG_REG (op1);
if ((GET_CODE (op1) == ZERO_EXTEND if ((GET_CODE (op1) == ZERO_EXTEND
|| GET_CODE (op1) == SIGN_EXTEND) || GET_CODE (op1) == SIGN_EXTEND)
&& GET_CODE (XEXP (op0, 1)) == CONST_INT && CONST_INT_P (XEXP (op0, 1))
&& (GET_MODE_BITSIZE (GET_MODE (XEXP (op1, 0))) && (GET_MODE_BITSIZE (GET_MODE (XEXP (op1, 0)))
>= INTVAL (XEXP (op0, 1)))) >= INTVAL (XEXP (op0, 1))))
op1 = XEXP (op1, 0); op1 = XEXP (op1, 0);
...@@ -7677,7 +7677,7 @@ aarch64_simd_valid_immediate (rtx op, enum machine_mode mode, bool inverse, ...@@ -7677,7 +7677,7 @@ aarch64_simd_valid_immediate (rtx op, enum machine_mode mode, bool inverse,
unsigned HOST_WIDE_INT elpart; unsigned HOST_WIDE_INT elpart;
unsigned int part, parts; unsigned int part, parts;
if (GET_CODE (el) == CONST_INT) if (CONST_INT_P (el))
{ {
elpart = INTVAL (el); elpart = INTVAL (el);
parts = 1; parts = 1;
...@@ -7983,7 +7983,7 @@ aarch64_simd_check_vect_par_cnst_half (rtx op, enum machine_mode mode, ...@@ -7983,7 +7983,7 @@ aarch64_simd_check_vect_par_cnst_half (rtx op, enum machine_mode mode,
rtx elt_op = XVECEXP (op, 0, i); rtx elt_op = XVECEXP (op, 0, i);
rtx elt_ideal = XVECEXP (ideal, 0, i); rtx elt_ideal = XVECEXP (ideal, 0, i);
if (GET_CODE (elt_op) != CONST_INT if (!CONST_INT_P (elt_op)
|| INTVAL (elt_ideal) != INTVAL (elt_op)) || INTVAL (elt_ideal) != INTVAL (elt_op))
return false; return false;
} }
...@@ -7996,7 +7996,7 @@ void ...@@ -7996,7 +7996,7 @@ void
aarch64_simd_lane_bounds (rtx operand, HOST_WIDE_INT low, HOST_WIDE_INT high) aarch64_simd_lane_bounds (rtx operand, HOST_WIDE_INT low, HOST_WIDE_INT high)
{ {
HOST_WIDE_INT lane; HOST_WIDE_INT lane;
gcc_assert (GET_CODE (operand) == CONST_INT); gcc_assert (CONST_INT_P (operand));
lane = INTVAL (operand); lane = INTVAL (operand);
if (lane < low || lane >= high) if (lane < low || lane >= high)
...@@ -8006,7 +8006,7 @@ aarch64_simd_lane_bounds (rtx operand, HOST_WIDE_INT low, HOST_WIDE_INT high) ...@@ -8006,7 +8006,7 @@ aarch64_simd_lane_bounds (rtx operand, HOST_WIDE_INT low, HOST_WIDE_INT high)
void void
aarch64_simd_const_bounds (rtx operand, HOST_WIDE_INT low, HOST_WIDE_INT high) aarch64_simd_const_bounds (rtx operand, HOST_WIDE_INT low, HOST_WIDE_INT high)
{ {
gcc_assert (GET_CODE (operand) == CONST_INT); gcc_assert (CONST_INT_P (operand));
HOST_WIDE_INT lane = INTVAL (operand); HOST_WIDE_INT lane = INTVAL (operand);
if (lane < low || lane >= high) if (lane < low || lane >= high)
...@@ -8044,7 +8044,7 @@ bool ...@@ -8044,7 +8044,7 @@ bool
aarch64_simd_mem_operand_p (rtx op) aarch64_simd_mem_operand_p (rtx op)
{ {
return MEM_P (op) && (GET_CODE (XEXP (op, 0)) == POST_INC return MEM_P (op) && (GET_CODE (XEXP (op, 0)) == POST_INC
|| GET_CODE (XEXP (op, 0)) == REG); || REG_P (XEXP (op, 0)));
} }
/* Set up OPERANDS for a register copy from SRC to DEST, taking care /* Set up OPERANDS for a register copy from SRC to DEST, taking care
......
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