[ARM] ce_count attribute for thumb2 abssi2 patterns

Submitted by Kyrylo Tkachov on Dec. 11, 2012, 2:06 p.m.

Details

Message ID 006201cdd7a8$b1426b10$13c74130$@tkachov@arm.com
State New
Headers show

Commit Message

Kyrylo Tkachov Dec. 11, 2012, 2:06 p.m.
Hi all,

This patch fixes http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55642
It sets the ce_count attribute for the abssi2 patterns in thumb2.md. If we
don't set it, gcc assumes that the pattern generates only one conditional
instruction and produces
the wrong enclosing IT instruction. The two affected patterns each produce
two conditional instructions.

A new testcase is added.
No regressions on arm-none-eabi with qemu.

Ok for trunk?

Thanks,
Kyrill

gcc/ChangeLog

2012-12-11  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

	PR target/55642
	* config/arm/thumb2.md (*thumb2_abssi2):
	Set ce_count attribute to 2.
	(*thumb2_neg_abssi2): Likewise.


gcc/testsuite/ChangeLog

2012-12-11  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

	* gcc.target/arm/pr55642.c: New testcase.

Comments

Ramana Radhakrishnan Dec. 11, 2012, 2:09 p.m.
>
> gcc/testsuite/ChangeLog
>
> 2012-12-11  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

Missing reference to PR in the testsuite changelog entry.

>
> 	* gcc.target/arm/pr55642.c: New testcase.
>


Ok with that change.



Ramana

Patch hide | download patch | download mbox

diff --git a/gcc/config/arm/thumb2.md b/gcc/config/arm/thumb2.md
index de573ca..f22666c 100644
--- a/gcc/config/arm/thumb2.md
+++ b/gcc/config/arm/thumb2.md
@@ -142,6 +142,7 @@ 
   [(set_attr "conds" "clob,*")
    (set_attr "shift" "1")
    (set_attr "predicable" "no, yes")
+   (set_attr "ce_count" "2")
    (set_attr "length" "10,8")]
 )
 
@@ -156,6 +157,7 @@ 
   [(set_attr "conds" "clob,*")
    (set_attr "shift" "1")
    (set_attr "predicable" "no, yes")
+   (set_attr "ce_count" "2")
    (set_attr "length" "10,8")]
 )
 
diff --git a/gcc/testsuite/gcc.target/arm/pr55642.c b/gcc/testsuite/gcc.target/arm/pr55642.c
new file mode 100644
index 0000000..10f2daa
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/pr55642.c
@@ -0,0 +1,15 @@ 
+/* { dg-options "-mthumb -O2" }  */
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_thumb2_ok } */
+
+int
+foo (int v)
+{
+  register int i asm ("r0");
+  register int j asm ("r1");
+  if (v > 1)
+    i = abs (j);
+
+  return i;
+}
+