Fix can_change_mode_class for big-endian on Arm
authorTamar Christina <tamar.christina@arm.com>
Thu, 5 Jul 2018 10:37:36 +0000 (10:37 +0000)
committerTamar Christina <tnfchris@gcc.gnu.org>
Thu, 5 Jul 2018 10:37:36 +0000 (10:37 +0000)
gcc/

PR target/84711
* config/arm/arm.c (arm_can_change_mode_class): Use GET_MODE_UNIT_SIZE
instead of GET_MODE_SIZE when comparing Units.

gcc/testsuite/

PR target/84711
* gcc.target/arm/big-endian-subreg.c: New.

From-SVN: r262436

gcc/ChangeLog
gcc/config/arm/arm.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/arm/big-endian-subreg.c [new file with mode: 0644]

index 046ca6e4d0f7ff596cb642cfa93e5db05e28955c..3f6d410bcad5005c888d3ca3b182ad8b9b25189a 100644 (file)
@@ -1,3 +1,9 @@
+2018-07-05  Tamar Christina  <tamar.christina@arm.com>
+
+       PR target/84711
+       * config/arm/arm.c (arm_can_change_mode_class): Use GET_MODE_UNIT_SIZE
+       instead of GET_MODE_SIZE when comparing Units.
+
 2018-07-05  Tamar Christina  <tamar.christina@arm.com>
 
        PR target/84711
index 8d5897c8f0f93502fb958cba61b7c0b1570d1570..ec3abbcba9fb1ed040bc9cdcf162f5bb4f8df586 100644 (file)
@@ -31512,8 +31512,8 @@ arm_can_change_mode_class (machine_mode from, machine_mode to,
 {
   if (TARGET_BIG_END
       && !(GET_MODE_SIZE (from) == 16 && GET_MODE_SIZE (to) == 8)
-      && (GET_MODE_SIZE (from) > UNITS_PER_WORD
-         || GET_MODE_SIZE (to) > UNITS_PER_WORD)
+      && (GET_MODE_UNIT_SIZE (from) > UNITS_PER_WORD
+         || GET_MODE_UNIT_SIZE (to) > UNITS_PER_WORD)
       && reg_classes_intersect_p (VFP_REGS, rclass))
     return false;
   return true;
index cea62ecf5d245919c118f525ce36365d7cd11aec..c5acb6958882e1eddb9dcba673d5978d1dbd2f4e 100644 (file)
@@ -1,3 +1,8 @@
+2018-07-05  Tamar Christina  <tamar.christina@arm.com>
+
+       PR target/84711
+       * gcc.target/arm/big-endian-subreg.c: New.
+
 2018-07-05  Tamar Christina  <tamar.christina@arm.com>
 
        PR target/84711
diff --git a/gcc/testsuite/gcc.target/arm/big-endian-subreg.c b/gcc/testsuite/gcc.target/arm/big-endian-subreg.c
new file mode 100644 (file)
index 0000000..4b1ab12
--- /dev/null
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_neon_ok } */
+/* { dg-require-effective-target arm_hf_eabi } */
+/* { dg-add-options arm_neon } */
+/* { dg-additional-options "-mfp16-format=ieee -mfloat-abi=hard" } */
+
+typedef __fp16 v4f16
+  __attribute__ ((vector_size (8)));
+
+v4f16 fn1 (v4f16 p)
+{
+  return p;
+}