@@ -1,3 +1,14 @@
+2015-05-20 Jeff Law <law@redhat.com>
+
+ * config/pa/pa.c (pa_print_operand): New 'o' output modifier.
+ (pa_mem_shadd_constant_p): Renamed from pa_shadd_constant_p.
+ (pa_shadd_constant_p): Allow constants for shadd insns rather
+ than valid scaling constants for memory addresses.
+ * config/pa/pa-protos.h (pa_mem_shadd_constant_p): Add prototype.
+ * config/pa/predicates.md (mem_shadd_operand): New predicate.
+ * config/pa/pa.md (shift-add insns using MULT): Use mem_shadd_operand.
+ (shift-add insns using ASHIFT): New patterns.
+
2015-05-20 Mikhail Maltsev <maltsevm@gmail.com>
* bb-reorder.c (set_edge_can_fallthru_flag): Use rtx_jump_insn where
@@ -85,6 +85,7 @@ extern int pa_and_mask_p (unsigned HOST_WIDE_INT);
extern int pa_cint_ok_for_move (HOST_WIDE_INT);
extern int pa_ior_mask_p (unsigned HOST_WIDE_INT);
extern int pa_ldil_cint_p (HOST_WIDE_INT);
+extern int pa_mem_shadd_constant_p (int);
extern int pa_shadd_constant_p (int);
extern int pa_zdepi_cint_p (unsigned HOST_WIDE_INT);
@@ -5242,6 +5242,11 @@ pa_print_operand (FILE *file, rtx x, int code)
gcc_assert (GET_CODE (x) == CONST_INT);
fprintf (file, HOST_WIDE_INT_PRINT_DEC, 32 - (INTVAL (x) & 31));
return;
+ case 'o':
+ gcc_assert (GET_CODE (x) == CONST_INT
+ && (INTVAL (x) == 1 || INTVAL (x) == 2 || INTVAL (x) == 3));
+ fprintf (file, "%d", INTVAL (x));
+ return;
case 'O':
gcc_assert (GET_CODE (x) == CONST_INT && exact_log2 (INTVAL (x)) >= 0);
fprintf (file, "%d", exact_log2 (INTVAL (x)));
@@ -8729,11 +8734,22 @@ pa_fmpysuboperands (rtx *operands)
}
/* Return 1 if the given constant is 2, 4, or 8. These are the valid
+ constants for a MULT embedded inside a memory address. */
+int
+pa_mem_shadd_constant_p (int val)
+{
+ if (val == 2 || val == 4 || val == 8)
+ return 1;
+ else
+ return 0;
+}
+
+/* Return 1 if the given constant is 1, 2, or 3. These are the valid
constants for shadd instructions. */
int
pa_shadd_constant_p (int val)
{
- if (val == 2 || val == 4 || val == 8)
+ if (val == 1 || val == 2 || val == 3)
return 1;
else
return 0;
@@ -6337,7 +6337,7 @@
(define_insn ""
[(set (match_operand:SI 0 "register_operand" "=r")
(plus:SI (mult:SI (match_operand:SI 2 "register_operand" "r")
- (match_operand:SI 3 "shadd_operand" ""))
+ (match_operand:SI 3 "mem_shadd_operand" ""))
(match_operand:SI 1 "register_operand" "r")))]
""
"{sh%O3addl %2,%1,%0|shladd,l %2,%O3,%1,%0} "
@@ -6347,13 +6347,33 @@
(define_insn ""
[(set (match_operand:DI 0 "register_operand" "=r")
(plus:DI (mult:DI (match_operand:DI 2 "register_operand" "r")
- (match_operand:DI 3 "shadd_operand" ""))
+ (match_operand:DI 3 "mem_shadd_operand" ""))
(match_operand:DI 1 "register_operand" "r")))]
"TARGET_64BIT"
"shladd,l %2,%O3,%1,%0"
[(set_attr "type" "binary")
(set_attr "length" "4")])
+(define_insn ""
+ [(set (match_operand:SI 0 "register_operand" "=r")
+ (plus:SI (ashift:SI (match_operand:SI 2 "register_operand" "r")
+ (match_operand:SI 3 "shadd_operand" ""))
+ (match_operand:SI 1 "register_operand" "r")))]
+ ""
+ "{sh%o3addl %2,%1,%0|shladd,l %2,%o3,%1,%0} "
+ [(set_attr "type" "binary")
+ (set_attr "length" "4")])
+
+(define_insn ""
+ [(set (match_operand:DI 0 "register_operand" "=r")
+ (plus:DI (ashift:DI (match_operand:DI 2 "register_operand" "r")
+ (match_operand:DI 3 "shadd_operand" ""))
+ (match_operand:DI 1 "register_operand" "r")))]
+ "TARGET_64BIT"
+ "shladd,l %2,%o3,%1,%0"
+ [(set_attr "type" "binary")
+ (set_attr "length" "4")])
+
(define_expand "ashlsi3"
[(set (match_operand:SI 0 "register_operand" "")
(ashift:SI (match_operand:SI 1 "lhs_lshift_operand" "")
@@ -581,6 +581,10 @@
;; Return 1 if OP is a CONST_INT with the value 2, 4, or 8. These are
;; the valid constants for shadd instructions.
+(define_predicate "mem_shadd_operand"
+ (and (match_code "const_int")
+ (match_test "pa_mem_shadd_constant_p (INTVAL (op))")))
+
(define_predicate "shadd_operand"
(and (match_code "const_int")
(match_test "pa_shadd_constant_p (INTVAL (op))")))
@@ -1,3 +1,8 @@
+2015-05-20 Jeff Law <law@redhat.com>
+
+ * gcc.target/hppa/hppa.exp: New target test driver.
+ * gcc.target/hppa/shadd-1.c: New test.
+
2015-05-20 Alex Velenko <Alex.Velenko@arm.com>
* gcc.target/arm/thumb1-far-jump-2.c (r4): Added int in definition.
new file mode 100644
@@ -0,0 +1,41 @@
+# Copyright (C) 1997-2015 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# GCC testsuite that uses the `dg.exp' driver.
+
+# Exit immediately if this isn't an m68k target.
+if { ![istarget hppa*-*-*] } then {
+ return
+}
+
+# Load support procs.
+load_lib gcc-dg.exp
+
+# If a testcase doesn't have special options, use these.
+global DEFAULT_CFLAGS
+if ![info exists DEFAULT_CFLAGS] then {
+ set DEFAULT_CFLAGS " -ansi -pedantic-errors"
+}
+
+# Initialize `dg'.
+dg-init
+
+# Main loop.
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cCS\]]] \
+ "" $DEFAULT_CFLAGS
+
+# All done.
+dg-finish
new file mode 100644
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-times "sh.add" 1 } } */
+
+typedef struct
+{
+ unsigned long int __val[(1024 / (8 * sizeof (unsigned long int)))];
+}
+__sigset_t;
+int
+__sigaddset (__sigset_t * __set, int __sig, int __stuff)
+{
+ unsigned long int __word =
+ (((__sig) - 1) / (8 * sizeof (unsigned long int)));
+ return __set->__val[__word] |= __stuff;
+}