My previous change to the Thumb-2 movsi patterns [1] caused a codesize 
regression
with -Os in large functions.  Fix this by using the literal pool offset of the
16-bit literal load so that the literal pool is dumped earlier, reducing the
number of 32-bit literal loads.

Bootstrap & regress OK on arm-none-linux-gnueabihf --with-cpu=cortex-a57,
committed as obvious.

[1] https://gcc.gnu.org/ml/gcc-patches/2019-07/msg01579.html

ChangeLog:
2019-07-30  Wilco Dijkstra  <wdijk...@arm.com>

        * config/arm/thumb2.md (thumb2_movsi_insn): Adjust literal offset.
        * config/arm/vfp.md (thumb2_movsi_vfp): Likewise.

---
diff --git a/gcc/config/arm/thumb2.md b/gcc/config/arm/thumb2.md
index 
c124838c3a536244909223bd18735427cef7d969..6ccc875e2b4e7b8ce256e52da966dfe220c6f5d6
 100644
--- a/gcc/config/arm/thumb2.md
+++ b/gcc/config/arm/thumb2.md
@@ -274,7 +274,7 @@ (define_insn "*thumb2_movsi_insn"
    (set_attr "length" "2,4,2,4,4,4,4")
    (set_attr "predicable" "yes")
    (set_attr "predicable_short_it" "yes,no,yes,no,no,no,no")
-   (set_attr "pool_range" "*,*,*,*,*,4094,*")
+   (set_attr "pool_range" "*,*,*,*,*,1018,*")
    (set_attr "neg_pool_range" "*,*,*,*,*,0,*")]
 )
 
diff --git a/gcc/config/arm/vfp.md b/gcc/config/arm/vfp.md
index 
9cc5946c79e027c0132d2b5e4fd6b97f13bca72e..661919e2357d352d12ff1020dc061f0c8d052841
 100644
--- a/gcc/config/arm/vfp.md
+++ b/gcc/config/arm/vfp.md
@@ -297,7 +297,7 @@ (define_insn "*thumb2_movsi_vfp"
    (set_attr "predicable_short_it" "yes,no,yes,no,no,no,no,no,no,no,no,no")
    (set_attr "type" 
"mov_reg,mov_reg,mov_reg,mvn_reg,mov_imm,load_4,store_4,f_mcr,f_mrc,fmov,f_loads,f_stores")
    (set_attr "length" "2,4,2,4,4,4,4,4,4,4,4,4")
-   (set_attr "pool_range"     "*,*,*,*,*,4094,*,*,*,*,1018,*")
+   (set_attr "pool_range"     "*,*,*,*,*,1018,*,*,*,*,1018,*")
    (set_attr "neg_pool_range" "*,*,*,*,*,   0,*,*,*,*,1008,*")]
 )
 

Reply via email to