S/390: PR69247: Fix bswap hi splitter.
authorAndreas Krebbel <krebbel@gcc.gnu.org>
Wed, 13 Jan 2016 11:59:29 +0000 (11:59 +0000)
committerAndreas Krebbel <krebbel@gcc.gnu.org>
Wed, 13 Jan 2016 11:59:29 +0000 (11:59 +0000)
gcc/ChangeLog:

2016-01-13  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

PR target/69247
* config/s390/s390.md (bswaphi splitter): Use simplify_gen_subreg.

gcc/testsuite/ChangeLog:

2016-01-13  Jakub Jelinek  <jakub@redhat.com>

PR target/69247
* gcc.dg/pr69247.c: New test.

From-SVN: r232318

gcc/ChangeLog
gcc/config/s390/s390.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr69247.c [new file with mode: 0644]

index e7e3601058dd8623a63ef21f37a10b49033350c8..ab61dff4b099275040ccdd034cd957adf6d70963 100644 (file)
@@ -1,3 +1,8 @@
+2016-01-13  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
+
+       PR target/69247
+       * config/s390/s390.md (bswaphi splitter): Use simplify_gen_subreg.
+
 2016-01-13  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/69242
index d6097c152f2c2eedcb5983116cead47b916375da..3e340c350305e0437cea8ecc461525a3b28455dc 100644 (file)
        (bswap:HI (match_operand:HI 1 "register_operand" "")))]
   "TARGET_CPU_ZARCH"
   [(set (match_dup 2) (bswap:SI (match_dup 3)))
-   (set (match_dup 2) (lshiftrt:SI (match_dup 2)
-                                  (const_int 16)))
-   (set (match_dup 0) (subreg:HI (match_dup 2) 2))]
+   (set (match_dup 2) (lshiftrt:SI (match_dup 2) (const_int 16)))]
 {
-  operands[2] = gen_reg_rtx (SImode);
+  operands[2] = simplify_gen_subreg (SImode, operands[0], HImode, 0);
   operands[3] = simplify_gen_subreg (SImode, operands[1], HImode, 0);
 })
 
index 4568a636b6268d77b1416e8da71fe5b40e1e044e..59596d0955c0b7469a338f0d92d6d4a5b219cb46 100644 (file)
@@ -1,3 +1,8 @@
+2016-01-13  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/69247
+       * gcc.dg/pr69247.c: New test.
+
 2016-01-13  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/69242
diff --git a/gcc/testsuite/gcc.dg/pr69247.c b/gcc/testsuite/gcc.dg/pr69247.c
new file mode 100644 (file)
index 0000000..b7406e6
--- /dev/null
@@ -0,0 +1,14 @@
+/* PR target/69247 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-additional-options "-march=zEC12" { target s390*-*-* } } */
+
+void foo (short *);
+
+void
+bar (short x, int y)
+{
+  if (y)
+    x = x << 8 | (unsigned short) x >> 8;
+  foo (&x);
+}