Commit 9e7adcb3 by Jan Hubicka Committed by Jan Hubicka

i386.c (ix86_fp_comparison_arithmetics_cost, [...]): New functions.


	* i386.c (ix86_fp_comparison_arithmetics_cost,
	ix86_fp_comparison_fcomi_cost, ix86_fp_comparison_sahf_cost,
	ix86_fp_comparison_cost): New functions.
	(ix86_expand_fp_compare): Use the costs to choose best bethod; add
	two new parameters SECOND_TEST and BYPASS_TEST; allow generating
	two-branch sequences; make static.
	(ix86_use_fcomi_compare): Do decision according to the costs.
	(split_fp_branch): New.
	* i386.md (compare-and-branch patterns): Use split_fp_branch.
	* i386-protos.h (ix86_expand_fp_compare): Remove
	(ix86_split_fp_branch): Declare.

	* i386.h (PREDICATE_CODES): Update codes from fcmov_comparison_operand
	and ix86_comparison_operator.

	* i386.c (ix86_prepare_fp_compare_args): Try to rearange the comparison
	to make it cheaper.

	* i386.c (put_condition_code): Output properly the unordered/ordered
	compares in fp case.
	(ix86_expand_fp_movcc): Use ix86_expand_compare infrastructure.

	* tm.texi (REVERSE_CONDITION): Document.
	* i386.c (ix86_fp_compare_mode): Simplify; return always CCFPmode
	in -ffast-math mode.
	* i386.h (REVERSE_CONDITION, REVERSIBLE_CC_MODE): New macro.

From-SVN: r38979
parent 9323f969
Sat Jan 13 09:53:32 MET 2001 Jan Hubicka <jh@suse.cz>
* i386.c (ix86_fp_comparison_arithmetics_cost,
ix86_fp_comparison_fcomi_cost, ix86_fp_comparison_sahf_cost,
ix86_fp_comparison_cost): New functions.
(ix86_expand_fp_compare): Use the costs to choose best bethod; add
two new parameters SECOND_TEST and BYPASS_TEST; allow generating
two-branch sequences; make static.
(ix86_use_fcomi_compare): Do decision according to the costs.
(split_fp_branch): New.
* i386.md (compare-and-branch patterns): Use split_fp_branch.
* i386-protos.h (ix86_expand_fp_compare): Remove
(ix86_split_fp_branch): Declare.
* i386.h (PREDICATE_CODES): Update codes from fcmov_comparison_operand
and ix86_comparison_operator.
* i386.c (ix86_prepare_fp_compare_args): Try to rearange the comparison
to make it cheaper.
* i386.c (put_condition_code): Output properly the unordered/ordered
compares in fp case.
(ix86_expand_fp_movcc): Use ix86_expand_compare infrastructure.
* tm.texi (REVERSE_CONDITION): Document.
* i386.c (ix86_fp_compare_mode): Simplify; return always CCFPmode
in -ffast-math mode.
* i386.h (REVERSE_CONDITION, REVERSIBLE_CC_MODE): New macro.
2001-01-13 Alexandre Oliva <aoliva@redhat.com>
* config/sh/sh.c (sh_expand_epilogue): Use PR explicitly.
......
......@@ -101,7 +101,6 @@ extern void ix86_expand_unary_operator PARAMS ((enum rtx_code, enum machine_mode
extern int ix86_unary_operator_ok PARAMS ((enum rtx_code, enum machine_mode,
rtx[]));
extern int ix86_match_ccmode PARAMS ((rtx, enum machine_mode));
extern rtx ix86_expand_fp_compare PARAMS ((enum rtx_code, rtx, rtx, rtx));
extern rtx ix86_expand_compare PARAMS ((enum rtx_code));
extern int ix86_use_fcomi_compare PARAMS ((enum rtx_code));
extern void ix86_expand_branch PARAMS ((enum rtx_code, rtx));
......@@ -129,6 +128,7 @@ extern enum machine_mode ix86_fp_compare_mode PARAMS ((enum rtx_code));
extern rtx ix86_force_to_memory PARAMS ((enum machine_mode, rtx));
extern void ix86_free_from_memory PARAMS ((enum machine_mode));
extern void ix86_split_fp_branch PARAMS ((rtx, rtx, rtx, rtx, rtx, rtx));
#ifdef TREE_CODE
extern void init_cumulative_args PARAMS ((CUMULATIVE_ARGS *, tree, rtx));
......
......@@ -2532,6 +2532,18 @@ while (0)
possible, to allow for more combinations. */
#define SELECT_CC_MODE(OP,X,Y) ix86_cc_mode (OP, X, Y)
/* Return non-zero if MODE implies a floating point inequality can be
reversed. */
#define REVERSIBLE_CC_MODE(MODE) 1
/* A C expression whose value is reversed condition code of the CODE for
comparison done in CC_MODE mode. */
#define REVERSE_CONDITION(CODE, MODE) \
((MODE) != CCFPmode && (MODE) != CCFPUmode ? reverse_condition (CODE) \
: reverse_condition_maybe_unordered (CODE))
/* Control the assembler format that we output, to the extent
this does not vary between assemblers. */
......@@ -2842,10 +2854,13 @@ do { long l; \
{"nonmemory_no_elim_operand", {CONST_INT, REG, SUBREG}}, \
{"q_regs_operand", {SUBREG, REG}}, \
{"non_q_regs_operand", {SUBREG, REG}}, \
{"fcmov_comparison_operator", {EQ, NE, LTU, GTU, LEU, GEU}}, \
{"fcmov_comparison_operator", {EQ, NE, LTU, GTU, LEU, GEU, UNORDERED, \
ORDERED, LT, UNLT, GT, UNGT, LE, UNLE, \
GE, UNGE, LTGT, UNEQ}}, \
{"sse_comparison_operator", {EQ, LT, LE, UNORDERED }}, \
{"ix86_comparison_operator", {EQ, NE, LE, LT, GE, GT, LEU, LTU, GEU, \
GTU, UNORDERED, ORDERED}}, \
GTU, UNORDERED, ORDERED, UNLE, UNLT, \
UNGE, UNGT, LTGT, UNEQ }}, \
{"cmp_fp_expander_operand", {CONST_DOUBLE, SUBREG, REG, MEM}}, \
{"ext_register_operand", {SUBREG, REG}}, \
{"binary_fp_operator", {PLUS, MINUS, MULT, DIV}}, \
......
......@@ -9304,14 +9304,12 @@
(clobber (reg:CCFP 18))
(clobber (reg:CCFP 17))]
"reload_completed"
[(set (pc)
(if_then_else (match_dup 5)
(match_dup 3)
(match_dup 4)))]
[(const_int 0)]
"
{
operands[5] = ix86_expand_fp_compare (GET_CODE (operands[0]), operands[1],
operands[2], NULL_RTX);
ix86_split_fp_branch (operands[0], operands[1], operands[2],
operands[3], operands[4], NULL_RTX);
DONE;
}")
(define_split
......@@ -9331,8 +9329,9 @@
(match_dup 4)))]
"
{
operands[6] = ix86_expand_fp_compare (GET_CODE (operands[0]), operands[1],
operands[2], operands[5]);
ix86_split_fp_branch (operands[0], operands[1], operands[2],
operands[3], operands[4], operands[5]);
DONE;
}")
;; Unconditional and other jump instructions
......
......@@ -4857,6 +4857,21 @@ inequality comparisons are always given @code{CCFPEmode}:
#define REVERSIBLE_CC_MODE(MODE) ((MODE) != CCFPEmode)
@end smallexample
@findex REVERSE_CONDITION (@var{code}, @var{mode})
A C expression whose value is reversed condition code of the @var{code} for
comparison done in CC_MODE @var{mode}. The macro is used only in case
@code{REVERSIBLE_CC_MODE (@var{mode})} is nonzero. Define this macro in case
machine has some non-standard way how to reverse certain conditionals. For
instance in case all floating point conditions are non-trapping, compiler may
freely convert unordered compares to ordered one. Then definition may look
like:
@smallexample
#define REVERSE_CONDITION(CODE, MODE) \
((MODE) != CCFPmode ? reverse_condtion (CODE) \
: reverse_condition_maybe_unordered (CODE))
@end smallexample
@end table
@node Costs
......
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