diff mbox

[AArch64,PR65375] Fix RTX cost for vector SET

Message ID 55066BCC.4010900@linaro.org
State New
Headers show

Commit Message

Kugan Vivekanandarajah March 16, 2015, 5:36 a.m. UTC
AArch64 RTX cost for vector SET is causing PR65375. Lower subreg is
using this rtx_cost to compute the cost of moves, and splitting anything
larger than word size, 64-bits in this case. The aarch64 rtx_costs is
returning 2 * COST_N_INSNS(1) for vector moves, so they get split.
Attach patch fixes this.

With the patch the testcase in the PR:

#include <arm_neon.h>
void hello_vst2(float* fout, float *fin)
{
  float32x4x2_t a;
  a = vld2q_f32 (fin);
  vst2q_f32 (fout, a);
}

Changes to:

 hello_vst2:
-	ld2	{v0.4s - v1.4s}, [x1]
-	sub	sp, sp, #32
-	umov	x1, v0.d[0]
-	umov	x2, v0.d[1]
-	str	q1, [sp, 16]
-	mov	x5, x1
-	stp	x5, x2, [sp]
-	ld1	{v0.16b - v1.16b}, [sp]
+	ld2	{v2.4s - v3.4s}, [x1]
+	orr	v0.16b, v2.16b, v2.16b
+	orr	v1.16b, v3.16b, v3.16b
 	st2	{v0.4s - v1.4s}, [x0]
-	add	sp, sp, 32
 	ret


lower-subreg.c:compute_costs() only cares about the cost of a (set (reg)
(const_int )) move but I think the intention, at least for now, is to
return extra_cost->vect.alu for all the vector operations.

Regression tested on aarch64-linux-gnu with no new regression. Is this
OK for trunk?

Thanks,
Kugan


gcc/ChangeLog:

2015-03-16  Kugan Vivekanandarajah  <kuganv@linaro.org>
            Jim Wilson  <jim.wilson@linaro.org>

	PR target/65375
	* config/aarch64/aarch64.c (aarch64_rtx_costs): Return
	extra_cost->vect.alu for SET.
diff mbox

Patch

diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index cba3c1a..db69979 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -5517,6 +5517,13 @@  aarch64_rtx_costs (rtx x, int code, int outer ATTRIBUTE_UNUSED,
       op0 = SET_DEST (x);
       op1 = SET_SRC (x);
 
+      /* Sets don't have a mode, so we must recompute this here.  */
+      if (VECTOR_MODE_P (GET_MODE (op0)))
+	{
+	  *cost += extra_cost->vect.alu;
+	  return true;
+	}
+
       switch (GET_CODE (op0))
 	{
 	case MEM: