diff mbox

[committed,SH] Add atomic patterns

Message ID 1324152819.18753.322.camel@yam-132-YW-E178-FTW
State New
Headers show

Commit Message

Oleg Endo Dec. 17, 2011, 8:13 p.m. UTC
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".

I'm not sure whether it requires re-testing.
Just in case now running:

make -k -check RUNTESTFLAGS="--target_board=sh-sim
\{-m2/-ml/-msoft-atomic,
-m2/-mb/-msoft-atomic,
-m2a-single/-mb/-msoft-atomic,
-m4-single/-ml/-msoft-atomic,
-m4-single/-mb/-msoft-atomic,
-m4a-single/-ml,
-m4a-single/-mb/-msoft-atomic}"


Cheers,
Oleg


ChangeLog:

2011-12-17  Oleg Endo  <oleg.endo@t-online.de>

	* config/sh/sync.md (fetchop_name): Change "ior" to "or".
	(atomic_compare_and_swap<mode>_soft,
	atomic_fetch_<fetchop_name><mode>_soft,
	atomic_fetch_nand<mode>_soft,
	atomic_<fetchop_name>_fetch<mode>_soft,
	atomic_nand_fetch<mode>_soft): Move align 2 above atomic
	sequence entrance.

Comments

Richard Henderson Dec. 17, 2011, 9:32 p.m. UTC | #1
On 12/17/2011 12:13 PM, Oleg Endo wrote:
> @@ -90,13 +90,13 @@
>    return \"\\
>  mova\\t1f, r0\\n\\
>  \\t<i124extend_insn>\\t%2, %4\\n\\
> +\\t.align\\t2\\n\\

The other thing that should be remembered is that inside a { }
block you don't need to double-quote all the \'s.


r~
Oleg Endo Dec. 19, 2011, 7:14 p.m. UTC | #2
On Sat, 2011-12-17 at 13:32 -0800, Richard Henderson wrote:

> The other thing that should be remembered is that inside a { }
> block you don't need to double-quote all the \'s.
> 

Before:

  "*
{
  return \"\\
mova\\t1f, r0\\n\\
\\t.align\\t2\\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\\
1:\\tmov\tr1, r15\";
}"

After:

{
  return
	"mova	1f,r0"			"\n"
  "	.align 2"			"\n"
  "	mov	r15,r1"			"\n"
  "	mov	#(0f-1f),r15"		"\n"
  "	mov.<i124suffix>	@%1,%0"	"\n"
  "	and	%2,%0"			"\n"
  "	not	%0,%0"			"\n"
  "	mov.<i124suffix>	%0,@%1"	"\n"
  "1:	mov	r1,r15";
}

Is this style OK?
diff mbox

Patch

Index: gcc/config/sh/sync.md
===================================================================
--- gcc/config/sh/sync.md	(revision 182438)
+++ gcc/config/sh/sync.md	(working copy)
@@ -35,7 +35,7 @@ 
 
 (define_code_iterator FETCHOP [plus minus ior xor and])
 (define_code_attr fetchop_name
-  [(plus "add") (minus "sub") (ior "ior") (xor "xor") (and "and")])
+  [(plus "add") (minus "sub") (ior "or") (xor "xor") (and "and")])
 (define_code_attr fetchop_insn
   [(plus "add") (minus "sub") (ior "or") (xor "xor") (and "and")])
 
@@ -90,13 +90,13 @@ 
   return \"\\
 mova\\t1f, r0\\n\\
 \\t<i124extend_insn>\\t%2, %4\\n\\
+\\t.align\\t2\\n\\
 \\tmov\\tr15, r1\\n\\
 \\tmov\\t#(0f-1f), r15\\n\\
 0:\\tmov.<i124suffix>\\t@%1, %0\\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")])
@@ -142,13 +142,13 @@ 
 {
   return \"\\
 mova\\t1f, r0\\n\\
+\\t.align\\t2\\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")])
@@ -195,13 +195,13 @@ 
   return \"\\
 mova\\t1f, r0\\n\\
 \\tmov\\tr15, r1\\n\\
+\\t.align\\t2\\n\\
 \\tmov\\t#(0f-1f), r15\\n\\
 0:\\tmov.<i124suffix>\\t@%1, %0\\n\\
 \\tmov\\t%2, %3\\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")])
@@ -249,11 +249,11 @@ 
   return \"\\
 mova\\t1f, r0\\n\\
 \\tmov\\tr15, r1\\n\\
+\\t.align\\t2\\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")])
@@ -300,13 +300,13 @@ 
 {
   return \"\\
 mova\\t1f, r0\\n\\
+\\t.align\\t2\\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")])