pa.md (add-with-constant splitter): Use ASHIFT rather than MULT for shadd sequences.
authorJeff Law <law@redhat.com>
Thu, 21 May 2015 17:18:16 +0000 (11:18 -0600)
committerJeff Law <law@gcc.gnu.org>
Thu, 21 May 2015 17:18:16 +0000 (11:18 -0600)
* config/pa/pa.md (add-with-constant splitter): Use ASHIFT rather
than MULT for shadd sequences.

* gcc.target/hppa/shadd-4.c: New test.

From-SVN: r223495

gcc/ChangeLog
gcc/config/pa/pa.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/hppa/shadd-4.c [new file with mode: 0644]

index 3ec725535a36baa6a11596230c31d63c09bf86a5..48472bc92b04b3fb410ee78f5188f0535d1e8b3e 100644 (file)
@@ -1,3 +1,8 @@
+2015-05-21  Jeff Law  <law@redhat.com>
+
+       * config/pa/pa.md (add-with-constant splitter): Use ASHIFT rather
+       than MULT for shadd sequences.
+
 2015-05-08  Jan Hubicka  <hubicka@ucw.cz>
 
        * alias.c (alias_stats): New static var.        
index 73c8f6bce13ae3f3001266129a7b4a7c0a958b67..aaec27d985e773497dcba6ab4e55956fd552e477 100644 (file)
    (clobber (match_operand:SI 4 "register_operand" ""))]
   "! pa_cint_ok_for_move (INTVAL (operands[2]))"
   [(set (match_dup 4) (match_dup 2))
-   (set (match_dup 0) (plus:SI (mult:SI (match_dup 4) (match_dup 3))
+   (set (match_dup 0) (plus:SI (ashift:SI (match_dup 4) (match_dup 3))
                               (match_dup 1)))]
   "
 {
   if (intval % 2 == 0 && pa_cint_ok_for_move (intval / 2))
     {
       operands[2] = GEN_INT (intval / 2);
-      operands[3] = const2_rtx;
+      operands[3] = const1_rtx;
     }
   else if (intval % 4 == 0 && pa_cint_ok_for_move (intval / 4))
     {
       operands[2] = GEN_INT (intval / 4);
-      operands[3] = GEN_INT (4);
+      operands[3] = const2_rtx;
     }
   else if (intval % 8 == 0 && pa_cint_ok_for_move (intval / 8))
     {
       operands[2] = GEN_INT (intval / 8);
-      operands[3] = GEN_INT (8);
+      operands[3] = GEN_INT (3);
     }
   else if (pa_cint_ok_for_move (-intval))
     {
index 46a6bb7ad675f2173217180564bdf9f5a430b49f..20a437918a3b1a26d2f39668333884777e2898d3 100644 (file)
@@ -1,3 +1,7 @@
+2015-05-21  Jeff Law  <law@redhat.com>
+
+       * gcc.target/hppa/shadd-4.c: New test.
+
 2015-05-08  Michael Matz  <matz@suse.de>
 
        * gcc.dg/vect/vect-strided-store.c: New test.
diff --git a/gcc/testsuite/gcc.target/hppa/shadd-4.c b/gcc/testsuite/gcc.target/hppa/shadd-4.c
new file mode 100644 (file)
index 0000000..e25d148
--- /dev/null
@@ -0,0 +1,8 @@
+/* { dg-do compile }  */
+/* { dg-options "-O2" }  */
+/* { dg-final { scan-assembler-times "sh.add" 1 } }  */
+unsigned int
+oof (int uid)
+{
+  return (174 << 7) + uid;
+}