@@ -1,3 +1,8 @@
+2012-09-26 Christophe Lyon <christophe.lyon@linaro.org>
+
+ * tree-ssa-math-opts.c (bswap_stats): Add found_16bit field.
+ (execute_optimize_bswap): Add support for builtin_bswap16.
+
2012-09-26 Richard Guenther <rguenther@suse.de>
* tree.h (DECL_IS_BUILTIN): Compare LOCATION_LOCUS.
@@ -1,3 +1,7 @@
+2012-09-26 Christophe Lyon <christophe.lyon@linaro.org>
+
+ * gcc.target/arm/builtin-bswap16-1.c: New testcase.
+
2012-09-25 Segher Boessenkool <segher@kernel.crashing.org>
PR target/51274
b/gcc/testsuite/gcc.target/arm/builtin-bswap16-1.c
new file mode 100644
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-require-effective-target arm_arch_v6_ok } */
+/* { dg-add-options arm_arch_v6 } */
+/* { dg-final { scan-assembler-not "orr\[ \t\]" } } */
+
+unsigned short swapu16_1 (unsigned short x)
+{
+ return (x << 8) | (x >> 8);
+}
+
+unsigned short swapu16_2 (unsigned short x)
+{
+ return (x >> 8) | (x << 8);
+}
@@ -154,6 +154,9 @@ static struct
static struct
{
+ /* Number of hand-written 16-bit bswaps found. */
+ int found_16bit;
+
/* Number of hand-written 32-bit bswaps found. */
int found_32bit;
@@ -1803,9 +1806,9 @@ static unsigned int
execute_optimize_bswap (void)
{
basic_block bb;
- bool bswap32_p, bswap64_p;
+ bool bswap16_p, bswap32_p, bswap64_p;
bool changed = false;
- tree bswap32_type = NULL_TREE, bswap64_type = NULL_TREE;
+ tree bswap16_type = NULL_TREE, bswap32_type = NULL_TREE, bswap64_type =
NULL_TREE;
if (BITS_PER_UNIT != 8)