+2016-10-15 Eric Botcazou <ebotcazou@adacore.com>
+
+ * optabs.c (expand_parity): Fix mode mismatch, add final conversion
+ and keep looping on failure.
+
2016-10-14 David Malcolm <dmalcolm@redhat.com>
* print-rtl-function.c (print_edge): Omit "(flags)" when none are
last = get_last_insn ();
- if (target == 0)
- target = gen_reg_rtx (mode);
+ if (target == 0 || GET_MODE (target) != wider_mode)
+ target = gen_reg_rtx (wider_mode);
+
xop0 = widen_operand (op0, wider_mode, mode, true, false);
temp = expand_unop (wider_mode, popcount_optab, xop0, NULL_RTX,
true);
if (temp != 0)
temp = expand_binop (wider_mode, and_optab, temp, const1_rtx,
target, true, OPTAB_DIRECT);
- if (temp == 0)
- delete_insns_since (last);
- return temp;
+ if (temp)
+ {
+ if (mclass != MODE_INT
+ || !TRULY_NOOP_TRUNCATION_MODES_P (mode, wider_mode))
+ return convert_to_mode (mode, temp, 0);
+ else
+ return gen_lowpart (mode, temp);
+ }
+ else
+ delete_insns_since (last);
}
}
}
+2016-10-15 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc.target/sparc/popc.c: Rename to...
+ * gcc.target/sparc/popc-1.c: ...this.
+ * gcc.target/sparc/popc-2.c: New test.
+
2016-10-15 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/77972
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-mcpu=niagara2" } */
+int test_popcount(int a)
+{
+ return __builtin_popcount(a);
+}
+
+long test_popcountl(long a)
+{
+ return __builtin_popcountl(a);
+}
+
+long long test_popcountll(long long a)
+{
+ return __builtin_popcountll(a);
+}
+
+/* { dg-final { scan-assembler-times "popc\t%" 3 } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-mcpu=niagara2 -Os" } */
+
+int foo (unsigned long long l)
+{
+ return __builtin_parityll (l);
+}
+++ /dev/null
-/* { dg-do compile } */
-/* { dg-options "-mcpu=niagara2" } */
-int test_popcount(int a)
-{
- return __builtin_popcount(a);
-}
-
-long test_popcountl(long a)
-{
- return __builtin_popcountl(a);
-}
-
-long long test_popcountll(long long a)
-{
- return __builtin_popcountll(a);
-}
-
-/* { dg-final { scan-assembler-times "popc\t%" 3 } } */