Commit 61263118 by Kyrylo Tkachov Committed by Kyrylo Tkachov

[AArch64] Handle fcvta[su] and frint in RTX cost function.

	* config/aarch64/aarch64.c (aarch64_frint_unspec_p): New function.
	(aarch64_rtx_costs): Handle FIX, UNSIGNED_FIX, UNSPEC.

From-SVN: r212753
parent ec454483
2014-07-17 Kyrylo Tkachov <kyrylo.tkachov@arm.com> 2014-07-17 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* config/aarch64/aarch64.c (aarch64_frint_unspec_p): New function.
(aarch64_rtx_costs): Handle FIX, UNSIGNED_FIX, UNSPEC.
2014-07-17 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* config/aarch64/arm_neon.h (vmlal_high_lane_s16): Fix type. * config/aarch64/arm_neon.h (vmlal_high_lane_s16): Fix type.
(vmlal_high_lane_s32): Likewise. (vmlal_high_lane_s32): Likewise.
(vmlal_high_lane_u16): Likewise. (vmlal_high_lane_u16): Likewise.
......
...@@ -4838,6 +4838,25 @@ aarch64_rtx_arith_op_extract_p (rtx x, enum machine_mode mode) ...@@ -4838,6 +4838,25 @@ aarch64_rtx_arith_op_extract_p (rtx x, enum machine_mode mode)
return false; return false;
} }
static bool
aarch64_frint_unspec_p (unsigned int u)
{
switch (u)
{
case UNSPEC_FRINTZ:
case UNSPEC_FRINTP:
case UNSPEC_FRINTM:
case UNSPEC_FRINTA:
case UNSPEC_FRINTN:
case UNSPEC_FRINTX:
case UNSPEC_FRINTI:
return true;
default:
return false;
}
}
/* Calculate the cost of calculating (if_then_else (OP0) (OP1) (OP2)), /* Calculate the cost of calculating (if_then_else (OP0) (OP1) (OP2)),
storing it in *COST. Result is true if the total cost of the operation storing it in *COST. Result is true if the total cost of the operation
has now been calculated. */ has now been calculated. */
...@@ -5018,7 +5037,7 @@ aarch64_rtx_costs (rtx x, int code, int outer ATTRIBUTE_UNUSED, ...@@ -5018,7 +5037,7 @@ aarch64_rtx_costs (rtx x, int code, int outer ATTRIBUTE_UNUSED,
default: default:
/* We can't make sense of this, assume default cost. */ /* We can't make sense of this, assume default cost. */
*cost = COSTS_N_INSNS (1); *cost = COSTS_N_INSNS (1);
break; return false;
} }
return false; return false;
...@@ -5716,6 +5735,29 @@ cost_plus: ...@@ -5716,6 +5735,29 @@ cost_plus:
*cost += extra_cost->fp[mode == DFmode].narrow; *cost += extra_cost->fp[mode == DFmode].narrow;
return false; return false;
case FIX:
case UNSIGNED_FIX:
x = XEXP (x, 0);
/* Strip the rounding part. They will all be implemented
by the fcvt* family of instructions anyway. */
if (GET_CODE (x) == UNSPEC)
{
unsigned int uns_code = XINT (x, 1);
if (uns_code == UNSPEC_FRINTA
|| uns_code == UNSPEC_FRINTM
|| uns_code == UNSPEC_FRINTN
|| uns_code == UNSPEC_FRINTP
|| uns_code == UNSPEC_FRINTZ)
x = XVECEXP (x, 0, 0);
}
if (speed)
*cost += extra_cost->fp[GET_MODE (x) == DFmode].toint;
*cost += rtx_cost (x, (enum rtx_code) code, 0, speed);
return true;
case ABS: case ABS:
if (GET_MODE_CLASS (mode) == MODE_FLOAT) if (GET_MODE_CLASS (mode) == MODE_FLOAT)
{ {
...@@ -5745,6 +5787,17 @@ cost_plus: ...@@ -5745,6 +5787,17 @@ cost_plus:
} }
return false; return false;
case UNSPEC:
/* The floating point round to integer frint* instructions. */
if (aarch64_frint_unspec_p (XINT (x, 1)))
{
if (speed)
*cost += extra_cost->fp[mode == DFmode].roundint;
return false;
}
break;
case TRUNCATE: case TRUNCATE:
/* Decompose <su>muldi3_highpart. */ /* Decompose <su>muldi3_highpart. */
...@@ -5779,13 +5832,14 @@ cost_plus: ...@@ -5779,13 +5832,14 @@ cost_plus:
/* Fall through. */ /* Fall through. */
default: default:
if (dump_file && (dump_flags & TDF_DETAILS)) break;
fprintf (dump_file,
"\nFailed to cost RTX. Assuming default cost.\n");
return true;
} }
return false;
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file,
"\nFailed to cost RTX. Assuming default cost.\n");
return true;
} }
/* Wrapper around aarch64_rtx_costs, dumps the partial, or total cost /* Wrapper around aarch64_rtx_costs, dumps the partial, or total cost
......
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