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.tkac...@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.tkac...@arm.com>
* gcc.target/arm/pr55642.c: New testcase.
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;
+}
+