diff mbox

[i386] : Extend TARGET_READ_MODIFY{,_WRITE} peepholes to all integer modes

Message ID CAFULd4bTG7k32mP2R-Fp4jPAzatUUexq8LFLrz4UhkSigr41Vw@mail.gmail.com
State New
Headers show

Commit Message

Uros Bizjak April 29, 2016, 9:29 a.m. UTC
On Fri, Apr 29, 2016 at 9:58 AM, Eric Botcazou <ebotcazou@adacore.com> wrote:
>> We can put it back, but prehaps implemented as unspec, so it won't
>> interfere with peepholes?
>
> No strong opinion, as long as the final assembly is the same as before.

I'm testing the attached patch. Does it fix your ada failures?

Uros.

Comments

Eric Botcazou April 29, 2016, 10:17 a.m. UTC | #1
> I'm testing the attached patch. Does it fix your ada failures?

No, it totally breaks stack checking. :-(

                === acats tests ===
 FAIL:  c52103x
 FAIL:  c52104x
+FAIL:  c52104y
+FAIL:  cb1010a
+FAIL:  cb1010c
+FAIL:  cb1010d
 
                === acats Summary ===
-# of expected passes           2318
-# of unexpected failures       2
+# of expected passes           2314
+# of unexpected failures       6
 Native configuration is x86_64-suse-linux-gnu
 
                === gcc tests ===
@@ -133,11 +137,24 @@
 
 
 Running target unix
+FAIL: gnat.dg/opt49.adb 3 blank line(s) in output
+FAIL: gnat.dg/opt49.adb (test for excess errors)
+UNRESOLVED: gnat.dg/opt49.adb compilation failed to produce executable
+FAIL: gnat.dg/stack_check1.adb 3 blank line(s) in output
+FAIL: gnat.dg/stack_check1.adb (test for excess errors)
+UNRESOLVED: gnat.dg/stack_check1.adb compilation failed to produce executable
+FAIL: gnat.dg/stack_check2.adb 3 blank line(s) in output
+FAIL: gnat.dg/stack_check2.adb (test for excess errors)
+UNRESOLVED: gnat.dg/stack_check2.adb compilation failed to produce executable
+FAIL: gnat.dg/stack_check3.adb 3 blank line(s) in output
+FAIL: gnat.dg/stack_check3.adb (test for excess errors)


/home/eric/svn/gcc/gcc/testsuite/gnat.dg/opt49.adb:31:4: error: unrecognizable 
insn:
(insn 33 32 34 8 (parallel [
            (set (mem/v:DI (reg/f:DI 7 sp) [0  S8 A8])
                (unspec [
                        (const_int 0 [0])
                    ] UNSPEC_PROBE_STACK))
            (clobber (reg:CC 17 flags))
        ]) /home/eric/svn/gcc/gcc/testsuite/gnat.dg/opt49.adb:17 -1
     (nil))
+===========================GNAT BUG DETECTED==============================+
| 7.0.0 20160429 (experimental) [trunk revision 235619] (x86_64-suse-linux) 
GCC error:|
| in extract_insn, at recog.c:2287                                         |
| Error detected around 
/home/eric/svn/gcc/gcc/testsuite/gnat.dg/opt49.adb:31:4|
diff mbox

Patch

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,23 @@ 
   DONE;
 })
 
+(define_expand "probe_stack"
+  [(parallel
+     [(set (match_operand 0 "memory_operand")
+	   (unspec [(const_int 0)] UNSPEC_PROBE_STACK))
+      (clobber (reg:CC FLAGS_REG))])])
+
+;; 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")]