@@ -9885,13 +9885,35 @@ (define_expand "usadd<mode>3"
""
{
rtx res = gen_reg_rtx (<MODE>mode);
- rtx msk = gen_reg_rtx (<MODE>mode);
rtx dst;
emit_insn (gen_add<mode>3_cc_overflow_1 (res, operands[1], operands[2]));
- emit_insn (gen_x86_mov<mode>cc_0_m1_neg (msk));
- dst = expand_simple_binop (<MODE>mode, IOR, res, msk,
- operands[0], 1, OPTAB_WIDEN);
+
+ if (TARGET_CMOVE)
+ {
+ rtx cmp = gen_rtx_GEU (VOIDmode, gen_rtx_REG (CCCmode, FLAGS_REG),
+ const0_rtx);
+
+ if (<MODE_SIZE> < GET_MODE_SIZE (SImode))
+ {
+ dst = force_reg (<MODE>mode, operands[0]);
+ emit_insn (gen_movsicc (gen_lowpart (SImode, dst), cmp,
+ gen_lowpart (SImode, res), constm1_rtx));
+ }
+ else
+ {
+ dst = operands[0];
+ emit_insn (gen_mov<mode>cc (dst, cmp, res, constm1_rtx));
+ }
+ }
+ else
+ {
+ rtx msk = gen_reg_rtx (<MODE>mode);
+
+ emit_insn (gen_x86_mov<mode>cc_0_m1_neg (msk));
+ dst = expand_simple_binop (<MODE>mode, IOR, res, msk,
+ operands[0], 1, OPTAB_WIDEN);
+ }
if (!rtx_equal_p (dst, operands[0]))
emit_move_insn (operands[0], dst);
@@ -9905,14 +9927,36 @@ (define_expand "ussub<mode>3"
""
{
rtx res = gen_reg_rtx (<MODE>mode);
- rtx msk = gen_reg_rtx (<MODE>mode);
rtx dst;
emit_insn (gen_sub<mode>_3 (res, operands[1], operands[2]));
- emit_insn (gen_x86_mov<mode>cc_0_m1_neg (msk));
- msk = expand_simple_unop (<MODE>mode, NOT, msk, NULL, 1);
- dst = expand_simple_binop (<MODE>mode, AND, res, msk,
- operands[0], 1, OPTAB_WIDEN);
+
+ if (TARGET_CMOVE)
+ {
+ rtx cmp = gen_rtx_GEU (VOIDmode, gen_rtx_REG (CCCmode, FLAGS_REG),
+ const0_rtx);
+
+ if (<MODE_SIZE> < GET_MODE_SIZE (SImode))
+ {
+ dst = force_reg (<MODE>mode, operands[0]);
+ emit_insn (gen_movsicc (gen_lowpart (SImode, dst), cmp,
+ gen_lowpart (SImode, res), const0_rtx));
+ }
+ else
+ {
+ dst = operands[0];
+ emit_insn (gen_mov<mode>cc (dst, cmp, res, const0_rtx));
+ }
+ }
+ else
+ {
+ rtx msk = gen_reg_rtx (<MODE>mode);
+
+ emit_insn (gen_x86_mov<mode>cc_0_m1_neg (msk));
+ msk = expand_simple_unop (<MODE>mode, NOT, msk, NULL, 1);
+ dst = expand_simple_binop (<MODE>mode, AND, res, msk,
+ operands[0], 1, OPTAB_WIDEN);
+ }
if (!rtx_equal_p (dst, operands[0]))
emit_move_insn (operands[0], dst);
@@ -1,7 +1,7 @@
/* PR target/112600 */
/* { dg-do compile } */
/* { dg-options "-O2" } */
-/* { dg-final { scan-assembler-times "sbb" 4 } } */
+/* { dg-final { scan-assembler-times "sbb|cmov" 4 } } */
unsigned char
add_sat_char (unsigned char x, unsigned char y)
@@ -1,7 +1,7 @@
/* PR target/112600 */
/* { dg-do compile } */
/* { dg-options "-O2" } */
-/* { dg-final { scan-assembler-times "sbb" 4 } } */
+/* { dg-final { scan-assembler-times "sbb|cmov" 4 } } */
unsigned char
sub_sat_char (unsigned char x, unsigned char y)