PR tree-ssa/54295
authorrearnsha <rearnsha@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 7 Sep 2012 10:37:08 +0000 (10:37 +0000)
committerrearnsha <rearnsha@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 7 Sep 2012 10:37:08 +0000 (10:37 +0000)
* tree-ssa-math-opts.c (widening_mult_conversion_strippable_p):
Sign-extension of a zero-extended value can be simplified to
just zero-extension.

testsuite:
* gcc.target/arm/pr50318-1.c: Scan for smlal.
* gcc.target/arm/smlaltb-1.c: XFAIL test.
* gcc.target/arm/smlaltt-1.c: Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@191066 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/arm/pr50318-1.c
gcc/testsuite/gcc.target/arm/smlaltb-1.c
gcc/testsuite/gcc.target/arm/smlaltt-1.c
gcc/tree-ssa-math-opts.c

index cdf6a20..360fd56 100644 (file)
@@ -1,3 +1,10 @@
+2012-09-07  Richard Earnshaw  <rearnsha@arm.com>
+
+       PR tree-ssa/54295
+       * tree-ssa-math-opts.c (widening_mult_conversion_strippable_p):
+       Sign-extension of a zero-extended value can be simplified to
+       just zero-extension.
+
 2012-09-07  Richard Guenther  <rguenther@suse.de>
 
        PR middle-end/53667
index 8a987e1..ff3583f 100644 (file)
@@ -1,3 +1,9 @@
+2012-09-07  Richard Earnshaw  <rearnsha@arm.com>
+
+       * gcc.target/arm/pr50318-1.c: Scan for smlal.
+       * gcc.target/arm/smlaltb-1.c: XFAIL test.
+       * gcc.target/arm/smlaltt-1.c: Likewise.
+
 2012-09-07  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gcc.dg/pr44194-1.c: Skip on Alpha and adjust regexp for SPARC64.
index 05885e1..be270ee 100644 (file)
@@ -8,4 +8,4 @@ long long test (unsigned int sec, unsigned long long nsecs)
    long)nsecs;
 }
 
-/* { dg-final { scan-assembler "umlal" } } */
+/* { dg-final { scan-assembler "smlal" } } */
index 1472c9b..a27009d 100644 (file)
@@ -11,4 +11,4 @@ foo (long long x, int in)
   return x + b * a;
 }
 
-/* { dg-final { scan-assembler "smlaltb\\t" } } */
+/* { dg-final { scan-assembler "smlaltb\\t" { xfail *-*-* } } } */
index 6bcbce0..380e3d0 100644 (file)
@@ -11,4 +11,4 @@ foo (long long x, int in1, int in2)
   return x + b * a;
 }
 
-/* { dg-final { scan-assembler "smlaltt\\t" } } */
+/* { dg-final { scan-assembler "smlaltt\\t" { xfail *-*-* } } } */
index c3392fb..94d19af 100644 (file)
@@ -1985,7 +1985,11 @@ widening_mult_conversion_strippable_p (tree result_type, gimple stmt)
         the operation and doesn't narrow the range.  */
       inner_op_type = TREE_TYPE (gimple_assign_rhs1 (stmt));
 
-      if (TYPE_UNSIGNED (op_type) == TYPE_UNSIGNED (inner_op_type)
+      /* If the inner-most type is unsigned, then we can strip any
+        intermediate widening operation.  If it's signed, then the
+        intermediate widening operation must also be signed.  */
+      if ((TYPE_UNSIGNED (inner_op_type)
+          || TYPE_UNSIGNED (op_type) == TYPE_UNSIGNED (inner_op_type))
          && TYPE_PRECISION (op_type) > TYPE_PRECISION (inner_op_type))
        return true;