This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[ARM] Fix new constraints and attributes of SI/HI data movement patterns


The patch at https://gcc.gnu.org/ml/gcc-patches/2016-09/msg01975.html
added constraints and "arch" attributes to some data movement patterns,
to fix wrongly generating MOVW instructions when not supported by the
targets. This was needed to fix a broken build but also resulted in MOVW
instructions not being generated when they should be.

This patch fixes the code-gen problems by removing the new attributes
from *arm_movsi_vfp and *thumb2_movsi_vfp since they are unnecessary.
It changes the rest of the added arch attributes from "t2", which
specifies a Thumb-2 target, to the weaker "v6t2" which specifies a
target that supports Thumb-2.

Tested for arm-none-linux-gnueabihf with native bootstrap and make check
on ARMv8-A and for arm-none-eabi with cross-compiled check-gcc on an
ARMv8.2-A emulator.

There is one unrelated failure in gcc.target/arm/fp16-aapcs-3.c, which
is a recently added test for the FP16 ARM alternative format. This has
    dg-require-effective-target arm_fp16_ok
which is true for +fp16 because that implies mfp16-format=ieee. The test
should instead be requiring
    dg-require-effective-target arm_fp16_alternative_ok
I'll send a patch to fix this.

Ok for trunk?
Matthew

gcc/
2016-09-29  Matthew Wahab  <matthew.wahab@arm.com>

	* config/arm/arm.md (*arm_movsi_insn): Replace "t2" arch attribute
	with "v6t2".  Move "arch" attribute above "pool_range".
	* config/arm/vfp.md (*arm_movhi_vfp): Likewise.
	(*thumb2_movhi_vfp): Likewise.
	(*arm_movhi_fp16): Likewise.
	(*thumb2_movhi_fp16): Likewise.
	(*arm_movsi_vfp): Remove "arch" attribute.
	(*thumb2_movsi_vfp): Likewise.
>From 7ef04c9cc749f1705ea657874c9db43e8a7d5320 Mon Sep 17 00:00:00 2001
From: Matthew Wahab <matthew.wahab@arm.com>
Date: Wed, 28 Sep 2016 12:08:22 +0100
Subject: [PATCH] [ARM] Fix new constraints and attributes of SI/HI data
 movement patterns

The patch at https://gcc.gnu.org/ml/gcc-patches/2016-09/msg01975.html
added constraints and "arch" attributes to some data movement patterns,
to fix wrongly generating MOVW instructions when not supported by the
targets. This was needed to fix a broken build but also resulted in MOVW
instructions not being generated when they should be.

This patch fixes the code-gen problems by removing the new attributes
from *arm_movsi_insn, *arm_movsi_vfp and *thumb2_movsi_vfp since they
are unnecessary. It changes the rest of the added arch attributes from
"t2", which specifies a Thumb-2 target, to the weaker "v6t2" which
specifies a target that supports Thumb-2.

Tested for arm-none-linux-gnueabihf with native bootstrap and make check
on ARMv8-A and for arm-none-eabi with cross-compiled check-gcc on an
ARMv8.2-A emulator.

There is one unrelated failure in gcc.target/arm/fp16-aapcs-3.c, which
is a recently added test for the FP16 ARM alternative format. This has
    dg-require-effective-target arm_fp16_ok
which is true for +fp16 because that implies mfp16-format=ieee. The test
should instead be requiring
    dg-require-effective-target arm_fp16_alternative_ok

gcc/
2016-09-29  Matthew Wahab  <matthew.wahab@arm.com>

	* config/arm/arm.md (*arm_movsi_insn): Replace "t2" arch attribute
	with "v6t2".  Move "arch" attribute above "pool_range".
	* config/arm/vfp.md (*arm_movhi_vfp): Likewise.
	(*thumb2_movhi_vfp): Likewise.
	(*arm_movhi_fp16): Likewise.
	(*thumb2_movhi_fp16): Likewise.
	(*arm_movsi_vfp): Remove "arch" attribute.
	(*thumb2_movsi_vfp): Likewise.
---
 gcc/config/arm/arm.md |  2 +-
 gcc/config/arm/vfp.md | 10 ++++------
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md
index 999292b..396aab7 100644
--- a/gcc/config/arm/arm.md
+++ b/gcc/config/arm/arm.md
@@ -6064,8 +6064,8 @@
    str%?\\t%1, %0"
   [(set_attr "type" "mov_reg,mov_imm,mvn_imm,mov_imm,load1,store1")
    (set_attr "predicable" "yes")
+   (set_attr "arch" "*,*,*,v6t2,*,*")
    (set_attr "pool_range" "*,*,*,*,4096,*")
-   (set_attr "arch" "*,*,*,t2,*,*")
    (set_attr "neg_pool_range" "*,*,*,*,4084,*")]
 )
 
diff --git a/gcc/config/arm/vfp.md b/gcc/config/arm/vfp.md
index 21eaf48..f39e590 100644
--- a/gcc/config/arm/vfp.md
+++ b/gcc/config/arm/vfp.md
@@ -65,7 +65,7 @@
     (const_string "f_mcr")
     (const_string "f_mrc")
     (const_string "fmov")])
-  (set_attr "arch" "*, *, t2, *, *, *, *, *")
+  (set_attr "arch" "*, *, v6t2, *, *, *, *, *")
   (set_attr "pool_range" "*, *, *, *, 256, *, *, *")
   (set_attr "neg_pool_range" "*, *, *, *, 244, *, *, *")
   (set_attr "length" "4")]
@@ -109,7 +109,7 @@
   (set_attr "type"
    "mov_reg, mov_imm, mov_imm, mov_imm, store1, load1,\
     f_mcr, f_mrc, fmov")
-  (set_attr "arch" "*, *, *, t2, *, *, *, *, *")
+  (set_attr "arch" "*, *, *, v6t2, *, *, *, *, *")
   (set_attr "pool_range" "*, *, *, *, *, 4094, *, *, *")
   (set_attr "neg_pool_range" "*, *, *, *, *, 250, *, *, *")
   (set_attr "length" "2, 4, 2, 4, 4, 4, 4, 4, 4")]
@@ -161,7 +161,7 @@
     (const_string "f_mcr")
     (const_string "f_mrc")
     (const_string "fmov")])
-  (set_attr "arch" "*, *, t2, *, *, *, *, *")
+  (set_attr "arch" "*, *, v6t2, *, *, *, *, *")
   (set_attr "pool_range" "*, *, *, *, 256, *, *, *")
   (set_attr "neg_pool_range" "*, *, *, *, 244, *, *, *")
   (set_attr "length" "4")]
@@ -205,7 +205,7 @@
   (set_attr "type"
    "mov_reg, mov_imm, mov_imm, mov_imm, store1, load1,\
     f_mcr, f_mrc, fmov")
-  (set_attr "arch" "*, *, *, t2, *, *, *, *, *")
+  (set_attr "arch" "*, *, *, v6t2, *, *, *, *, *")
   (set_attr "pool_range" "*, *, *, *, *, 4094, *, *, *")
   (set_attr "neg_pool_range" "*, *, *, *, *, 250, *, *, *")
   (set_attr "length" "2, 4, 2, 4, 4, 4, 4, 4, 4")]
@@ -248,7 +248,6 @@
   [(set_attr "predicable" "yes")
    (set_attr "type" "mov_reg,mov_reg,mvn_imm,mov_imm,load1,store1,
 		     f_mcr,f_mrc,fmov,f_loads,f_stores")
-   (set_attr "arch" "*,*,*,t2,*,*,*,*,*,*,*")
    (set_attr "pool_range"     "*,*,*,*,4096,*,*,*,*,1020,*")
    (set_attr "neg_pool_range" "*,*,*,*,4084,*,*,*,*,1008,*")]
 )
@@ -297,7 +296,6 @@
    (set_attr "predicable_short_it" "yes,no,yes,no,no,no,no,no,no,no,no,no,no,no")
    (set_attr "type" "mov_reg,mov_reg,mov_reg,mvn_reg,mov_imm,load1,load1,store1,store1,f_mcr,f_mrc,fmov,f_loads,f_stores")
    (set_attr "length" "2,4,2,4,4,4,4,4,4,4,4,4,4,4")
-   (set_attr "arch" "*,*,*,*,t2,*,*,*,*,*,*,*,*,*")
    (set_attr "pool_range"     "*,*,*,*,*,1018,4094,*,*,*,*,*,1018,*")
    (set_attr "neg_pool_range" "*,*,*,*,*,   0,   0,*,*,*,*,*,1008,*")]
 )
-- 
2.1.4


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]