i386.md (unspec): Add UNSPEC_PROBE_STACK.
authorUros Bizjak <ubizjak@gmail.com>
Fri, 29 Apr 2016 14:43:29 +0000 (16:43 +0200)
committerUros Bizjak <uros@gcc.gnu.org>
Fri, 29 Apr 2016 14:43:29 +0000 (16:43 +0200)
* config/i386/i386.md (unspec): Add UNSPEC_PROBE_STACK.
(probe_stack): New expander.
(probe_stack_<mode>): New insn pattern.

From-SVN: r235642

gcc/ChangeLog
gcc/config/i386/i386.md

index 86523e00fea249d759ce40635a15c6ab29967d10..01f2580cc77c5b35e1505fc4af91b8fe70d2a814 100644 (file)
@@ -1,3 +1,9 @@
+2016-04-29  Uros Bizjak  <ubizjak@gmail.com>
+
+       * config/i386/i386.md (unspec): Add UNSPEC_PROBE_STACK.
+       (probe_stack): New expander.
+       (probe_stack_<mode>): New insn pattern.
+
 2016-04-29  Uros Bizjak  <ubizjak@gmail.com>
 
        * config/i386/i386.md
index 217551b1dc984c25ce499b8a8b42555d6ec1e643..a0343d9d7534b4f9d133615ab3b60e78165e49e3 100644 (file)
@@ -88,6 +88,7 @@
   UNSPEC_SET_GOT_OFFSET
   UNSPEC_MEMORY_BLOCKAGE
   UNSPEC_STACK_CHECK
+  UNSPEC_PROBE_STACK
 
   ;; TLS support
   UNSPEC_TP
   DONE;
 })
 
+(define_expand "probe_stack"
+  [(match_operand 0 "memory_operand")]
+  ""
+{
+  rtx (*insn) (rtx, rtx)
+    = (GET_MODE (operands[0]) == DImode
+       ? gen_probe_stack_di : gen_probe_stack_si);
+
+  emit_insn (insn (operands[0], const0_rtx));
+  DONE;
+})
+
+;; Use OR for stack probes, this is shorter.
+(define_insn "probe_stack_<mode>"
+  [(set (match_operand:W 0 "memory_operand" "=m")
+       (unspec:W [(match_operand:W 1 "const0_operand")]
+                 UNSPEC_PROBE_STACK))
+   (clobber (reg:CC FLAGS_REG))]
+  ""
+  "or{<imodesuffix>}\t{%1, %0|%0, %1}"
+  [(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")]