Oleg Endo <oleg.e...@t-online.de> wrote:
> The attached patch should fix the align 2 issues mentioned before and
> also fixes the ior fetchop_name.  It should be "or" instead of "ior".

You are right about that nop shouldn't be inserted after
write-back.  Thanks for pointing out my thinko.
Your patch doesn't work because SH soft atomic sequences have
another constraint that label 1 should have been 4-byte aligned.
And fetchop_name for the logical or operation uses ior instead
of or.  See genoptint.c, for example.  So fixed thusly, though
I'd like to commit it with fixing double-quote issues rth pointed
out.

Regards,
        kaz
--
        * config/sh/sync.md (atomic_compare_and_swap<mode>_soft):
        Don't insert nop after the write-back instruction.
        (atomic_fetch_<fetchop_name><mode>_soft): Likewise.
        (atomic_fetch_nand<mode>_soft): Likewise.
        (atomic_<fetchop_name>_fetch<mode>_soft): Likewise.
        (atomic_nand_fetch<mode>_soft): Likewise.

--- ORIG/trunk/gcc/config/sh/sync.md    2011-12-05 10:04:44.000000000 +0900
+++ trunk/gcc/config/sh/sync.md 2011-12-18 07:21:56.000000000 +0900
@@ -88,7 +88,8 @@
   "*
 {
   return \"\\
-mova\\t1f, r0\\n\\
+.align\\t2\\n\\
+\\tmova\\t1f, r0\\n\\
 \\t<i124extend_insn>\\t%2, %4\\n\\
 \\tmov\\tr15, r1\\n\\
 \\tmov\\t#(0f-1f), r15\\n\\
@@ -96,7 +97,6 @@ mova\\t1f, r0\\n\\
 \\tcmp/eq\\t%0, %4\\n\\
 \\tbf\\t1f\\n\\
 \\tmov.<i124suffix>\\t%3, @%1\\n\\
-\\t.align\\t2\\n\\
 1:\\tmov\tr1, r15\";
 }"
   [(set_attr "length" "20")])
@@ -141,17 +141,18 @@ mova\\t1f, r0\\n\\
   "*
 {
   return \"\\
-mova\\t1f, r0\\n\\
+.align\\t2\\n\\
+\\tmova\\t1f, r0\\n\\
+\\tnop\\n\\
 \\tmov\\tr15, r1\\n\\
 \\tmov\\t#(0f-1f), r15\\n\\
 0:\\tmov.<i124suffix>\\t@%1, %0\\n\\
 \\tmov\\t%0, %3\\n\\
 \\t<fetchop_insn>\\t%2, %3\\n\\
 \\tmov.<i124suffix>\\t%3, @%1\\n\\
-\\t.align\\t2\\n\\
 1:\\tmov\tr1, r15\";
 }"
-  [(set_attr "length" "18")])
+  [(set_attr "length" "20")])
 
 (define_expand "atomic_fetch_nand<mode>"
   [(set (match_operand:I124 0 "register_operand" "")
@@ -193,7 +194,8 @@ mova\\t1f, r0\\n\\
   "*
 {
   return \"\\
-mova\\t1f, r0\\n\\
+.align\\t2\\n\\
+\\tmova\\t1f, r0\\n\\
 \\tmov\\tr15, r1\\n\\
 \\tmov\\t#(0f-1f), r15\\n\\
 0:\\tmov.<i124suffix>\\t@%1, %0\\n\\
@@ -201,7 +203,6 @@ mova\\t1f, r0\\n\\
 \\tand\\t%0, %3\\n\\
 \\tnot\\t%3, %3\\n\\
 \\tmov.<i124suffix>\\t%3, @%1\\n\\
-\\t.align\\t2\\n\\
 1:\\tmov\tr1, r15\";
 }"
   [(set_attr "length" "20")])
@@ -247,13 +248,13 @@ mova\\t1f, r0\\n\\
   "*
 {
   return \"\\
-mova\\t1f, r0\\n\\
+.align\\t2\\n\\
+\\tmova\\t1f, r0\\n\\
 \\tmov\\tr15, r1\\n\\
 \\tmov\\t#(0f-1f), r15\\n\\
 0:\\tmov.<i124suffix>\\t@%1, %0\\n\\
 \\t<fetchop_insn>\\t%2, %0\\n\\
 \\tmov.<i124suffix>\\t%0, @%1\\n\\
-\\t.align\\t2\\n\\
 1:\\tmov\tr1, r15\";
 }"
   [(set_attr "length" "16")])
@@ -299,14 +300,15 @@ mova\\t1f, r0\\n\\
   "*
 {
   return \"\\
-mova\\t1f, r0\\n\\
+.align\\t2\\n\\
+\\tmova\\t1f, r0\\n\\
+\\tnop\\n\\
 \\tmov\\tr15, r1\\n\\
 \\tmov\\t#(0f-1f), r15\\n\\
 0:\\tmov.<i124suffix>\\t@%1, %0\\n\\
 \\tand\\t%2, %0\\n\\
 \\tnot\\t%0, %0\\n\\
 \\tmov.<i124suffix>\\t%0, @%1\\n\\
-\\t.align\\t2\\n\\
 1:\\tmov\tr1, r15\";
 }"
-  [(set_attr "length" "18")])
+  [(set_attr "length" "20")])

Reply via email to