aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorThomas Preud'homme <thomas.preudhomme@arm.com>2014-10-21 12:38:36 +0000
committerThomas Preud'homme <thopre01@gcc.gnu.org>2014-10-21 12:38:36 +0000
commite4d2f1db862e08562182369ee989f521070e456e (patch)
tree0345b4b0f0f59e5f5483b3a56bd092376285a9df /gcc
parent1a6230a84d35f4497feffa01b0e9926ce776f4e9 (diff)
downloadgcc-e4d2f1db862e08562182369ee989f521070e456e.zip
gcc-e4d2f1db862e08562182369ee989f521070e456e.tar.gz
gcc-e4d2f1db862e08562182369ee989f521070e456e.tar.bz2
tree-ssa-math-opts.c (find_bswap_or_nop_1): Fix creation of MARKER_BYTE_UNKNOWN markers when handling casts.
2014-10-21 Thomas Preud'homme <thomas.preudhomme@arm.com> gcc/ * tree-ssa-math-opts.c (find_bswap_or_nop_1): Fix creation of MARKER_BYTE_UNKNOWN markers when handling casts. gcc/testsuite/ * gcc.dg/optimize-bswaphi-1.c: New bswap pass test. From-SVN: r216511
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.dg/optimize-bswaphi-1.c16
-rw-r--r--gcc/tree-ssa-math-opts.c3
4 files changed, 26 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 978d7dc..6b1e1bb 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2014-10-21 Thomas Preud'homme <thomas.preudhomme@arm.com>
+
+ * tree-ssa-math-opts.c (find_bswap_or_nop_1): Fix creation of
+ MARKER_BYTE_UNKNOWN markers when handling casts.
+
2014-10-21 Richard Biener <rguenther@suse.de>
* tree-ssa-phiopt.c (value_replacement): Properly verify we
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 920fd48..57735a1 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2014-10-21 Thomas Preud'homme <thomas.preudhomme@arm.com>
+
+ * gcc.dg/optimize-bswaphi-1.c: New bswap pass test.
+
2014-10-21 Richard Biener <rguenther@suse.de>
* g++.dg/ipa/devirt-42.C: Fix dump scanning routines.
diff --git a/gcc/testsuite/gcc.dg/optimize-bswaphi-1.c b/gcc/testsuite/gcc.dg/optimize-bswaphi-1.c
index 3e51f04..18aba28 100644
--- a/gcc/testsuite/gcc.dg/optimize-bswaphi-1.c
+++ b/gcc/testsuite/gcc.dg/optimize-bswaphi-1.c
@@ -42,6 +42,20 @@ uint32_t read_be16_3 (unsigned char *data)
return *(data + 1) | (*data << 8);
}
+typedef int SItype __attribute__ ((mode (SI)));
+typedef int HItype __attribute__ ((mode (HI)));
+
+/* Test that detection of significant sign extension works correctly. This
+ checks that unknown byte marker are set correctly in cast of cast. */
+
+HItype
+swap16 (HItype in)
+{
+ return (HItype) (((in >> 0) & 0xFF) << 8)
+ | (((in >> 8) & 0xFF) << 0);
+}
+
/* { dg-final { scan-tree-dump-times "16 bit load in target endianness found at" 3 "bswap" } } */
-/* { dg-final { scan-tree-dump-times "16 bit bswap implementation found at" 3 "bswap" { xfail alpha*-*-* arm*-*-* } } } */
+/* { dg-final { scan-tree-dump-times "16 bit bswap implementation found at" 1 "bswap" { target alpha*-*-* arm*-*-* } } } */
+/* { dg-final { scan-tree-dump-times "16 bit bswap implementation found at" 4 "bswap" { xfail alpha*-*-* arm*-*-* } } } */
/* { dg-final { cleanup-tree-dump "bswap" } } */
diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c
index 3c6e935..2ef2333 100644
--- a/gcc/tree-ssa-math-opts.c
+++ b/gcc/tree-ssa-math-opts.c
@@ -1916,7 +1916,8 @@ find_bswap_or_nop_1 (gimple stmt, struct symbolic_number *n, int limit)
if (!TYPE_UNSIGNED (n->type) && type_size > old_type_size
&& HEAD_MARKER (n->n, old_type_size))
for (i = 0; i < type_size - old_type_size; i++)
- n->n |= MARKER_BYTE_UNKNOWN << (type_size - 1 - i);
+ n->n |= MARKER_BYTE_UNKNOWN
+ << ((type_size - 1 - i) * BITS_PER_MARKER);
if (type_size < 64 / BITS_PER_MARKER)
{