]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
arm: Fix general issues with patterns for VLLDM and VLSTM
authorRichard Earnshaw <rearnsha@arm.com>
Fri, 11 Jun 2021 16:18:12 +0000 (17:18 +0100)
committerRichard Earnshaw <rearnsha@arm.com>
Tue, 24 Aug 2021 13:25:50 +0000 (14:25 +0100)
Both lazy_store_multiple_insn and lazy_load_multiple_insn contain
invalid RTL (eg they contain a post_inc statement outside of a mem).
What's more, the instructions concerned do not modify their input
address register.  We probably got away with this because they are
generated so late in the compilation that no subsequent pass needed to
understand them.  Nevertheless, this could cause problems someday, so
fixed to use a simple legal unspec.

gcc:
* config/arm/vfp.md (lazy_store_multiple_insn): Rewrite as valid RTL.
(lazy_load_multiple_insn): Likewise.
(cherry picked from commit 4702d3cf044924970a9a00142542da1edacfd76c)

gcc/config/arm/vfp.md

index f97af92716ba7ff1c054d1148301b7d8ece72592..6cf5a5d8b69d5632439c4eec84879948192911f1 100644 (file)
    (set_attr "type" "mov_reg")]
 )
 
+;; Both this and the next instruction are treated by GCC in the same
+;; way as a blockage pattern.  That's perhaps stronger than it needs
+;; to be, but we do not want accesses to the VFP register bank to be
+;; moved across either instruction.
+
 (define_insn "lazy_store_multiple_insn"
-  [(set (match_operand:SI 0 "s_register_operand" "+&rk")
-       (post_dec:SI (match_dup 0)))
-   (unspec_volatile [(const_int 0)
-                    (mem:SI (post_dec:SI (match_dup 0)))]
-                   VUNSPEC_VLSTM)]
+  [(unspec_volatile
+    [(mem:BLK (match_operand:SI 0 "s_register_operand" "rk"))]
+    VUNSPEC_VLSTM)]
   "use_cmse && reload_completed"
   "vlstm%?\\t%0"
   [(set_attr "predicable" "yes")
 )
 
 (define_insn "lazy_load_multiple_insn"
-  [(set (match_operand:SI 0 "s_register_operand" "+&rk")
-       (post_inc:SI (match_dup 0)))
-   (unspec_volatile:SI [(const_int 0)
-                       (mem:SI (match_dup 0))]
-                      VUNSPEC_VLLDM)]
+  [(unspec_volatile
+    [(mem:BLK (match_operand:SI 0 "s_register_operand" "rk"))]
+    VUNSPEC_VLLDM)]
   "use_cmse && reload_completed"
   "vlldm%?\\t%0"
   [(set_attr "predicable" "yes")