+2020-01-22 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/93335
+ * config/aarch64/aarch64.c (aarch64_expand_subvti): Only use
+ gen_subdi3_compare1_imm if low_in2 satisfies aarch64_plus_immediate
+ predicate, not whenever it is CONST_INT. Otherwise, force_reg it.
+ Call force_reg on high_in2 unconditionally.
+
2020-01-22 Martin Liska <mliska@suse.cz>
PR tree-optimization/92924
}
else
{
- if (CONST_INT_P (low_in2))
+ if (aarch64_plus_immediate (low_in2, DImode))
+ emit_insn (gen_subdi3_compare1_imm (low_dest, low_in1, low_in2,
+ GEN_INT (-INTVAL (low_in2))));
+ else
{
- high_in2 = force_reg (DImode, high_in2);
- emit_insn (gen_subdi3_compare1_imm (low_dest, low_in1, low_in2,
- GEN_INT (-INTVAL (low_in2))));
+ low_in2 = force_reg (DImode, low_in2);
+ emit_insn (gen_subdi3_compare1 (low_dest, low_in1, low_in2));
}
- else
- emit_insn (gen_subdi3_compare1 (low_dest, low_in1, low_in2));
+ high_in2 = force_reg (DImode, high_in2);
if (unsigned_p)
emit_insn (gen_usubdi3_carryinC (high_dest, high_in1, high_in2));
--- /dev/null
+/* PR target/93335 */
+/* { dg-do compile { target int128 } } */
+
+int
+f1 (unsigned int x)
+{
+ return __builtin_sub_overflow_p (x, 4096, (unsigned __int128) 0);
+}
+
+int
+f2 (unsigned int x)
+{
+ return __builtin_sub_overflow_p (x, 4097, (unsigned __int128) 0);
+}
+
+int
+f3 (int x)
+{
+ return __builtin_sub_overflow_p (x, 4096, (__int128) 0);
+}
+
+int
+f4 (int x)
+{
+ return __builtin_sub_overflow_p (x, 4097, (__int128) 0);
+}
+
+int
+f5 (unsigned int x)
+{
+ return __builtin_sub_overflow_p (x, -4096, (unsigned __int128) 0);
+}
+
+int
+f6 (unsigned int x)
+{
+ return __builtin_sub_overflow_p (x, -4097, (unsigned __int128) 0);
+}
+
+int
+f7 (int x)
+{
+ return __builtin_sub_overflow_p (x, -4096, (__int128) 0);
+}
+
+int
+f8 (int x)
+{
+ return __builtin_sub_overflow_p (x, -4097, (__int128) 0);
+}
+
+int
+f9 (unsigned int x)
+{
+ return __builtin_add_overflow_p (x, 4096, (unsigned __int128) 0);
+}
+
+int
+f10 (unsigned int x)
+{
+ return __builtin_add_overflow_p (x, 4097, (unsigned __int128) 0);
+}
+
+int
+f11 (int x)
+{
+ return __builtin_add_overflow_p (x, 4096, (__int128) 0);
+}
+
+int
+f12 (int x)
+{
+ return __builtin_add_overflow_p (x, 4097, (__int128) 0);
+}
+
+int
+f13 (unsigned int x)
+{
+ return __builtin_add_overflow_p (x, -4096, (unsigned __int128) 0);
+}
+
+int
+f14 (unsigned int x)
+{
+ return __builtin_add_overflow_p (x, -4097, (unsigned __int128) 0);
+}
+
+int
+f15 (int x)
+{
+ return __builtin_add_overflow_p (x, -4096, (__int128) 0);
+}
+
+int
+f16 (int x)
+{
+ return __builtin_add_overflow_p (x, -4097, (__int128) 0);
+}