diff mbox

[RFC/ARM] Correct mov_notscc pattern

Message ID 20120111135513.GM2033@e103070-lin.cambridge.arm.com
State New
Headers show

Commit Message

Matthew Gretton-Dann Jan. 11, 2012, 1:55 p.m. UTC
All,

The attached patch corrects the mov_notscc pattern in arm.md.

This issue also exists in 4.5 and 4.6, is it okay for me to backport the
fix to those branches, as well as trunk?

OK?

Thanks,

Matt

gcc/ChangeLog:
2012-01-10  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>

	* config/arm/arm.md (mov_notscc): Use MVN for false condition.

gcc/testsuite/ChangeLog:
2012-01-10  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>

	* testsuite/gcc.c-torture/execute/20120110-1.c: New testcase.

Comments

Richard Earnshaw Jan. 11, 2012, 1:56 p.m. UTC | #1
On 11/01/12 13:55, Matthew Gretton-Dann wrote:
> All,
> 
> The attached patch corrects the mov_notscc pattern in arm.md.
> 
> This issue also exists in 4.5 and 4.6, is it okay for me to backport the
> fix to those branches, as well as trunk?
> 
> OK?
> 

OK all.

R.

> Thanks,
> 
> Matt
> 
> gcc/ChangeLog:
> 2012-01-10  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
> 
> 	* config/arm/arm.md (mov_notscc): Use MVN for false condition.
> 
> gcc/testsuite/ChangeLog:
> 2012-01-10  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
> 
> 	* testsuite/gcc.c-torture/execute/20120110-1.c: New testcase.
> 
> 
> 1-RFC-ARM-Correct-mov_notscc-pattern.txt
> 
> 
> diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md
> index 0e4bc3e..5620d7d 100644
> --- a/gcc/config/arm/arm.md
> +++ b/gcc/config/arm/arm.md
> @@ -7726,7 +7726,7 @@
>  	(not:SI (match_operator:SI 1 "arm_comparison_operator"
>  		 [(match_operand 2 "cc_register" "") (const_int 0)])))]
>    "TARGET_ARM"
> -  "mov%D1\\t%0, #0\;mvn%d1\\t%0, #1"
> +  "mvn%D1\\t%0, #0\;mvn%d1\\t%0, #1"
>    [(set_attr "conds" "use")
>     (set_attr "insn" "mov")
>     (set_attr "length" "8")]
> diff --git a/gcc/testsuite/gcc.c-torture/execute/20120111-1.c b/gcc/testsuite/gcc.c-torture/execute/20120111-1.c
> new file mode 100644
> index 0000000..eac086e
> --- /dev/null
> +++ b/gcc/testsuite/gcc.c-torture/execute/20120111-1.c
> @@ -0,0 +1,18 @@
> +#include <stdlib.h>
> +#include <stdint.h>
> +
> +uint32_t f0a (uint64_t arg2) __attribute__((noinline));
> +
> +uint32_t
> +f0a (uint64_t arg)
> +{
> +  return ~(arg > -3);
> +}
> +
> +int main() {
> +  uint32_t r1;
> +  r1 = f0a (12094370573988097329ULL);
> +  if (r1 != ~0U)
> +    abort ();
> +  return 0;
> +}
diff mbox

Patch

diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md
index 0e4bc3e..5620d7d 100644
--- a/gcc/config/arm/arm.md
+++ b/gcc/config/arm/arm.md
@@ -7726,7 +7726,7 @@ 
 	(not:SI (match_operator:SI 1 "arm_comparison_operator"
 		 [(match_operand 2 "cc_register" "") (const_int 0)])))]
   "TARGET_ARM"
-  "mov%D1\\t%0, #0\;mvn%d1\\t%0, #1"
+  "mvn%D1\\t%0, #0\;mvn%d1\\t%0, #1"
   [(set_attr "conds" "use")
    (set_attr "insn" "mov")
    (set_attr "length" "8")]
diff --git a/gcc/testsuite/gcc.c-torture/execute/20120111-1.c b/gcc/testsuite/gcc.c-torture/execute/20120111-1.c
new file mode 100644
index 0000000..eac086e
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/20120111-1.c
@@ -0,0 +1,18 @@ 
+#include <stdlib.h>
+#include <stdint.h>
+
+uint32_t f0a (uint64_t arg2) __attribute__((noinline));
+
+uint32_t
+f0a (uint64_t arg)
+{
+  return ~(arg > -3);
+}
+
+int main() {
+  uint32_t r1;
+  r1 = f0a (12094370573988097329ULL);
+  if (r1 != ~0U)
+    abort ();
+  return 0;
+}