public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Uros Bizjak <ubizjak@gmail.com>
To: Eric Botcazou <ebotcazou@adacore.com>
Cc: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH, i386]: Extend TARGET_READ_MODIFY{,_WRITE} peepholes to all integer modes
Date: Fri, 29 Apr 2016 10:51:00 -0000	[thread overview]
Message-ID: <CAFULd4Zwd7=zzi2Tfd2Bvy6B7Sfx2HFU3atF50rrAfRr-23F+A@mail.gmail.com> (raw)
In-Reply-To: <3799415.uPfXC5v7Nr@polaris>

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

On Fri, Apr 29, 2016 at 12:17 PM, Eric Botcazou <ebotcazou@adacore.com> wrote:
>> I'm testing the attached patch. Does it fix your ada failures?
>
> No, it totally breaks stack checking. :-(

Eh, I was trying to be too clever.

Attached patch was actually tested on a couple of cases. It generates
the same assembly as before.

Uros.

[-- Attachment #2: r.diff.txt --]
[-- Type: text/plain, Size: 1099 bytes --]

Index: i386.md
===================================================================
--- i386.md	(revision 235620)
+++ i386.md	(working copy)
@@ -88,6 +88,7 @@
   UNSPEC_SET_GOT_OFFSET
   UNSPEC_MEMORY_BLOCKAGE
   UNSPEC_STACK_CHECK
+  UNSPEC_PROBE_STACK
 
   ;; TLS support
   UNSPEC_TP
@@ -17552,6 +17553,29 @@
   DONE;
 })
 
+(define_expand "probe_stack"
+  [(match_operand 0 "memory_operand")]
+  ""
+{
+  rtx (*insn) (rtx)
+    = (GET_MODE (operands[0]) == DImode
+       ? gen_probe_stack_di : gen_probe_stack_si);
+
+  emit_insn (insn (operands[0]));
+  DONE;
+})
+
+;; Use OR for stack probes, this is shorter.
+(define_insn "probe_stack_<mode>"
+  [(set (match_operand:W 0 "memory_operand" "=m")
+	(unspec:W [(const_int 0)] UNSPEC_PROBE_STACK))
+   (clobber (reg:CC FLAGS_REG))]
+  ""
+  "or{<imodesuffix>}\t{$0, %0|%0, 0}"
+  [(set_attr "type" "alu1")
+   (set_attr "mode" "<MODE>")
+   (set_attr "length_immediate" "1")])
+  
 (define_insn "adjust_stack_and_probe<mode>"
   [(set (match_operand:P 0 "register_operand" "=r")
 	(unspec_volatile:P [(match_operand:P 1 "register_operand" "0")]

  reply	other threads:[~2016-04-29 10:51 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-28 19:16 Uros Bizjak
2016-04-29  7:47 ` Eric Botcazou
2016-04-29  7:50   ` Uros Bizjak
2016-04-29  7:58     ` Eric Botcazou
2016-04-29  9:30       ` Uros Bizjak
2016-04-29 10:17         ` Eric Botcazou
2016-04-29 10:51           ` Uros Bizjak [this message]
2016-04-29 11:23             ` Eric Botcazou
2016-04-29 11:52               ` Uros Bizjak
2016-04-29 14:30                 ` Eric Botcazou
2016-04-29 14:44                   ` Uros Bizjak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFULd4Zwd7=zzi2Tfd2Bvy6B7Sfx2HFU3atF50rrAfRr-23F+A@mail.gmail.com' \
    --to=ubizjak@gmail.com \
    --cc=ebotcazou@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).