public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Patch ARM] Fix probe_stack constraint.
@ 2017-12-05 16:40 Ramana Radhakrishnan
  0 siblings, 0 replies; only message in thread
From: Ramana Radhakrishnan @ 2017-12-05 16:40 UTC (permalink / raw)
  To: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 665 bytes --]

The probe_stack pattern uses r0 as a fixed register. This can cause 
issues if we have auto-increment instructions coming out that have r0 as 
the base register.

Tested with a bootstrap and regression run. richi reports that the 
original issue was fixed in the run. I did consider whether 
probe_stack_range was affected but it all comes back to probe_stack 
pattern so I think we are ok.

I don't have a testcase that seems to provoke this but it seems to be 
default on most distributions so I'm expecting the testcoverage to come 
from there.

Applied to trunk.

Ramana

PR target/82248

* config/arm/arm.md (probe_stack) : Change to using the 'o' constraint.

[-- Attachment #2: probe-stack.txt --]
[-- Type: text/plain, Size: 644 bytes --]

diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md
index 545ee257699..d60c5af551c 100644
--- a/gcc/config/arm/arm.md
+++ b/gcc/config/arm/arm.md
@@ -8612,8 +8612,11 @@
    (set_attr "type" "block")]
 )
 
+;; Since we hard code r0 here use the 'o' constraint to prevent
+;; provoking undefined behaviour in the hardware with putting out
+;; auto-increment operations with potentially r0 as the base register.
 (define_insn "probe_stack"
-  [(set (match_operand:SI 0 "memory_operand" "=m")
+  [(set (match_operand:SI 0 "memory_operand" "=o")
         (unspec:SI [(const_int 0)] UNSPEC_PROBE_STACK))]
   "TARGET_32BIT"
   "str%?\\tr0, %0"

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-12-05 16:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-05 16:40 [Patch ARM] Fix probe_stack constraint Ramana Radhakrishnan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).