diff mbox

[AArch64,PATHC] Only allow 0s unconditionally for floating point values.

Message ID 20170801073502.GA19631@arm.com
State New
Headers show

Commit Message

Tamar Christina Aug. 1, 2017, 7:35 a.m. UTC
Hi All,

Previously I allowed 0s unconditionally through aarch64_can_const_movi_rtx_p
because we should always be able to use movi with 0 regardless of the mode.

However this was causing issues when a vector contained a 0 element and
another value which was too complex for a movi. In theory this should have
worked but it's failing an integrity check because of the type of the 0 element
being a none floating type.

Moving the exception to only allow floating point 0s restores the previous
behavior of the compiler.

Ok for trunk?

Bootstrapped and regtested on aach64-none-linux-gnu and no issues.

Thanks,
Tamar


gcc/
2017-08-01  Tamar Christina  <tamar.christina@arm.com>

	* config/aarch64/aarch64.c
	(aarch64_can_const_movi_rtx_p): Move 0 check.

--

Comments

James Greenhalgh Aug. 1, 2017, 9:47 a.m. UTC | #1
On Tue, Aug 01, 2017 at 08:35:06AM +0100, Tamar Christina wrote:
> Hi All,
> 
> Previously I allowed 0s unconditionally through aarch64_can_const_movi_rtx_p
> because we should always be able to use movi with 0 regardless of the mode.
> 
> However this was causing issues when a vector contained a 0 element and
> another value which was too complex for a movi. In theory this should have
> worked but it's failing an integrity check because of the type of the 0 element
> being a none floating type.
> 
> Moving the exception to only allow floating point 0s restores the previous
> behavior of the compiler.
> 
> Ok for trunk?

OK.

Thanks,
James

> 
> Bootstrapped and regtested on aach64-none-linux-gnu and no issues.
> 
> Thanks,
> Tamar
> 
> 
> gcc/
> 2017-08-01  Tamar Christina  <tamar.christina@arm.com>
> 
> 	* config/aarch64/aarch64.c
> 	(aarch64_can_const_movi_rtx_p): Move 0 check.
> 
> --
diff mbox

Patch

diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 055ebafb8305412e192c77e4177d08c914d5ccee..5a2ad7e9156a6f0389c09470cf1414bff45d8099 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -4787,10 +4787,6 @@  aarch64_can_const_movi_rtx_p (rtx x, machine_mode mode)
   if (!TARGET_SIMD)
      return false;
 
-  /* We make a general exception for 0.  */
-  if (aarch64_float_const_zero_rtx_p (x))
-      return true;
-
   machine_mode vmode, imode;
   unsigned HOST_WIDE_INT ival;
 
@@ -4800,6 +4796,10 @@  aarch64_can_const_movi_rtx_p (rtx x, machine_mode mode)
       if (!aarch64_reinterpret_float_as_int (x, &ival))
 	return false;
 
+      /* We make a general exception for 0.  */
+      if (aarch64_float_const_zero_rtx_p (x))
+	return true;
+
       imode = int_mode_for_mode (mode);
     }
   else if (GET_CODE (x) == CONST_INT