]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
arm: fix vlldm erratum for Armv8.1-m [PR102035]
authorRichard Earnshaw <rearnsha@arm.com>
Fri, 18 Jun 2021 16:18:37 +0000 (17:18 +0100)
committerRichard Earnshaw <rearnsha@arm.com>
Tue, 24 Aug 2021 13:25:51 +0000 (14:25 +0100)
For Armv8.1-m we generate code that emits VLLDM directly and do not
rely on support code in the library, so emit the mitigation directly
as well, when required.  In this case, we can use the compiler options
to determine when to apply the fix and when it is safe to omit it.

gcc:
PR target/102035
* config/arm/arm.md (attribute arch): Add fix_vlldm.
(arch_enabled): Use it.
* config/arm/vfp.md (lazy_store_multiple_insn): Add alternative to
use when erratum mitigation is needed.
(cherry picked from commit 30461cf8dba3d3adb15a125e4da48800eb2b9b8f)

gcc/config/arm/arm.md
gcc/config/arm/vfp.md

index 064604808cccb2a9d747e1f3055d757217a08db2..5d3f21b91c4e931270b9a7c532abef15a1e82260 100644 (file)
 ; TARGET_32BIT, "t1" or "t2" to specify a specific Thumb mode.  "v6"
 ; for ARM or Thumb-2 with arm_arch6, and nov6 for ARM without
 ; arm_arch6.  "v6t2" for Thumb-2 with arm_arch6 and "v8mb" for ARMv8-M
-; Baseline.  This attribute is used to compute attribute "enabled",
+; Baseline.  "fix_vlldm" is for fixing the v8-m/v8.1-m VLLDM erratum.
+; This attribute is used to compute attribute "enabled",
 ; use type "any" to enable an alternative in all cases.
-(define_attr "arch" "any,a,t,32,t1,t2,v6,nov6,v6t2,v8mb,iwmmxt,iwmmxt2,armv6_or_vfpv3,neon,mve"
+(define_attr "arch" "any, a, t, 32, t1, t2, v6,nov6, v6t2, \
+                    v8mb, fix_vlldm, iwmmxt, iwmmxt2, armv6_or_vfpv3, \
+                    neon, mve"
   (const_string "any"))
 
 (define_attr "arch_enabled" "no,yes"
              (match_test "TARGET_THUMB1 && arm_arch8"))
         (const_string "yes")
 
+        (and (eq_attr "arch" "fix_vlldm")
+             (match_test "fix_vlldm"))
+        (const_string "yes")
+
         (and (eq_attr "arch" "iwmmxt2")
              (match_test "TARGET_REALLY_IWMMXT2"))
         (const_string "yes")
index 6cf5a5d8b69d5632439c4eec84879948192911f1..c9f2f12b51e1ca0d2dff3619e0c4a1350065fd7c 100644 (file)
 
 (define_insn "lazy_load_multiple_insn"
   [(unspec_volatile
-    [(mem:BLK (match_operand:SI 0 "s_register_operand" "rk"))]
+    [(mem:BLK (match_operand:SI 0 "s_register_operand" "rk,rk"))]
     VUNSPEC_VLLDM)]
   "use_cmse && reload_completed"
-  "vlldm%?\\t%0"
-  [(set_attr "predicable" "yes")
+  "@
+   vscclrm\\t{vpr}\;vlldm\\t%0
+   vlldm\\t%0"
+  [(set_attr "arch" "fix_vlldm,*")
+   (set_attr "predicable" "no")
+   (set_attr "length" "8,4")
    (set_attr "type" "load_4")]
 )