Commit deed3da9 by Jakub Jelinek Committed by Jakub Jelinek

re PR tree-optimization/79390 (10% performance drop in SciMark2 LU after r242550)

	PR tree-optimization/79390
	* optabs.c (emit_conditional_move): If the preferred op2/op3 operand
	order does not result in usable sequence, retry with reversed operand
	order.

	* gcc.target/i386/pr70465-2.c: Xfail the scan-assembler-not test.

From-SVN: r246882
parent b96a3e11
2017-04-12 Jakub Jelinek <jakub@redhat.com> 2017-04-12 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/79390
* optabs.c (emit_conditional_move): If the preferred op2/op3 operand
order does not result in usable sequence, retry with reversed operand
order.
PR sanitizer/80403 PR sanitizer/80403
PR sanitizer/80404 PR sanitizer/80404
PR sanitizer/80405 PR sanitizer/80405
......
...@@ -4258,12 +4258,15 @@ emit_conditional_move (rtx target, enum rtx_code code, rtx op0, rtx op1, ...@@ -4258,12 +4258,15 @@ emit_conditional_move (rtx target, enum rtx_code code, rtx op0, rtx op1,
if (cmode == VOIDmode) if (cmode == VOIDmode)
cmode = GET_MODE (op0); cmode = GET_MODE (op0);
enum rtx_code orig_code = code;
bool swapped = false;
if (swap_commutative_operands_p (op2, op3) if (swap_commutative_operands_p (op2, op3)
&& ((reversed = reversed_comparison_code_parts (code, op0, op1, NULL)) && ((reversed = reversed_comparison_code_parts (code, op0, op1, NULL))
!= UNKNOWN)) != UNKNOWN))
{ {
std::swap (op2, op3); std::swap (op2, op3);
code = reversed; code = reversed;
swapped = true;
} }
if (mode == VOIDmode) if (mode == VOIDmode)
...@@ -4272,27 +4275,28 @@ emit_conditional_move (rtx target, enum rtx_code code, rtx op0, rtx op1, ...@@ -4272,27 +4275,28 @@ emit_conditional_move (rtx target, enum rtx_code code, rtx op0, rtx op1,
icode = direct_optab_handler (movcc_optab, mode); icode = direct_optab_handler (movcc_optab, mode);
if (icode == CODE_FOR_nothing) if (icode == CODE_FOR_nothing)
return 0; return NULL_RTX;
if (!target) if (!target)
target = gen_reg_rtx (mode); target = gen_reg_rtx (mode);
for (int pass = 0; ; pass++)
{
code = unsignedp ? unsigned_condition (code) : code; code = unsignedp ? unsigned_condition (code) : code;
comparison = simplify_gen_relational (code, VOIDmode, cmode, op0, op1); comparison = simplify_gen_relational (code, VOIDmode, cmode, op0, op1);
/* We can get const0_rtx or const_true_rtx in some circumstances. Just /* We can get const0_rtx or const_true_rtx in some circumstances. Just
return NULL and let the caller figure out how best to deal with this punt and let the caller figure out how best to deal with this
situation. */ situation. */
if (!COMPARISON_P (comparison)) if (COMPARISON_P (comparison))
return NULL_RTX; {
saved_pending_stack_adjust save; saved_pending_stack_adjust save;
save_pending_stack_adjust (&save); save_pending_stack_adjust (&save);
last = get_last_insn (); last = get_last_insn ();
do_pending_stack_adjust (); do_pending_stack_adjust ();
prepare_cmp_insn (XEXP (comparison, 0), XEXP (comparison, 1), prepare_cmp_insn (XEXP (comparison, 0), XEXP (comparison, 1),
GET_CODE (comparison), NULL_RTX, unsignedp, OPTAB_WIDEN, GET_CODE (comparison), NULL_RTX, unsignedp,
&comparison, &cmode); OPTAB_WIDEN, &comparison, &cmode);
if (comparison) if (comparison)
{ {
struct expand_operand ops[4]; struct expand_operand ops[4];
...@@ -4310,7 +4314,23 @@ emit_conditional_move (rtx target, enum rtx_code code, rtx op0, rtx op1, ...@@ -4310,7 +4314,23 @@ emit_conditional_move (rtx target, enum rtx_code code, rtx op0, rtx op1,
} }
delete_insns_since (last); delete_insns_since (last);
restore_pending_stack_adjust (&save); restore_pending_stack_adjust (&save);
}
if (pass == 1)
return NULL_RTX;
/* If the preferred op2/op3 order is not usable, retry with other
operand order, perhaps it will expand successfully. */
if (swapped)
code = orig_code;
else if ((reversed = reversed_comparison_code_parts (orig_code, op0, op1,
NULL))
!= UNKNOWN)
code = reversed;
else
return NULL_RTX; return NULL_RTX;
std::swap (op2, op3);
}
} }
......
2017-04-12 Jakub Jelinek <jakub@redhat.com> 2017-04-12 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/79390
* gcc.target/i386/pr70465-2.c: Xfail the scan-assembler-not test.
PR sanitizer/80403 PR sanitizer/80403
PR sanitizer/80404 PR sanitizer/80404
PR sanitizer/80405 PR sanitizer/80405
......
/* PR target/70465 */ /* PR target/70465 */
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-Ofast -mfpmath=387 -fomit-frame-pointer" } */ /* { dg-options "-Ofast -mfpmath=387 -fomit-frame-pointer" } */
/* { dg-final { scan-assembler-not "fxch\t%st.1" } } */ /* { dg-final { scan-assembler-not "fxch\t%st.1" { xfail *-*-* } } } */
extern float d[1024]; extern float d[1024];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment