i386.md (*cmp<X87MODEF:mode>_<SWI24:mode>_i387): Do not use float_operator operator predicate.

* config/i386/i386.md (*cmp<X87MODEF:mode>_<SWI24:mode>_i387):
	Do not use float_operator operator predicate.
	(*cmp<X87MODEF:mode>_<SWI24:mode>_cc_i387): Ditto.
	* config/i386/predicates.md (float_operator): Remove predicate.

	* config/i386/i386.md (*jcc<mode>_0_i387): Remove insn pattern.
	(*jccxf_i387): Ditto.
	(*jcc<mode>_i387): Ditto.
	(*jccu<mode>_i387): Ditto.
	(*jcc<X87MODEF:mode>_<SWI24:mode>_i387): Ditto.
	(*jcc_*_i387 splitters): Remove.
	* config/i386/i386-protos.h (ix86_split_fp_branch): Remove prototype.
	* config/i386/i386.c (ix86_split_fp_branch): Remove.
	* config/i386/predicates.md (ix86_swapped_fp_comparison_operator):
	Remove predicate.

testsuite/ChangeLog:

	* gcc.target/i386/387-ficom-1.c: New test.

From-SVN: r253653
This commit is contained in:
Uros Bizjak 2017-10-11 20:00:55 +02:00
parent 9588ea78db
commit 42851ff81d
7 changed files with 71 additions and 187 deletions

View File

@ -1,3 +1,23 @@
2017-10-11 Uros Bizjak <ubizjak@gmail.com>
* config/i386/i386.md (*cmp<X87MODEF:mode>_<SWI24:mode>_i387):
Do not use float_operator operator predicate.
(*cmp<X87MODEF:mode>_<SWI24:mode>_cc_i387): Ditto.
* config/i386/predicates.md (float_operator): Remove predicate.
2017-10-11 Uros Bizjak <ubizjak@gmail.com>
* config/i386/i386.md (*jcc<mode>_0_i387): Remove insn pattern.
(*jccxf_i387): Ditto.
(*jcc<mode>_i387): Ditto.
(*jccu<mode>_i387): Ditto.
(*jcc<X87MODEF:mode>_<SWI24:mode>_i387): Ditto.
(*jcc_*_i387 splitters): Remove.
* config/i386/i386-protos.h (ix86_split_fp_branch): Remove prototype.
* config/i386/i386.c (ix86_split_fp_branch): Remove.
* config/i386/predicates.md (ix86_swapped_fp_comparison_operator):
Remove predicate.
2017-10-11 Jan Hubicka <hubicka@ucw.cz>
* profile-count.h (slow_safe_scale_64bit): New function.
@ -43,7 +63,7 @@
(ix86_atom_sched_reorder): Declare.
* i386/i386.c Move all CPU cost tables to x86-tune-costs.h.
(COSTS_N_BYTES): Move to x86-tune-costs.h.
(DUMMY_STRINGOP_ALGS):x86-tune-costs.h.
(DUMMY_STRINGOP_ALGS):Move to x86-tune-costs.h.
(rip_relative_addr_p): Rename to ...
(ix86_rip_relative_addr_p): ... this one; export.
(memory_address_length): Update.

View File

@ -166,9 +166,6 @@ extern void ix86_asm_output_function_label (FILE *, const char *, tree);
extern void ix86_call_abi_override (const_tree);
extern int ix86_reg_parm_stack_space (const_tree);
extern void ix86_split_fp_branch (enum rtx_code code, rtx, rtx,
rtx, rtx, rtx);
extern bool ix86_libc_has_function (enum function_class fn_class);
extern void x86_order_regs_for_local_alloc (void);

View File

@ -22259,31 +22259,6 @@ ix86_expand_branch (enum rtx_code code, rtx op0, rtx op1, rtx label)
}
}
/* Split branch based on floating point condition. */
void
ix86_split_fp_branch (enum rtx_code code, rtx op1, rtx op2,
rtx target1, rtx target2, rtx tmp)
{
rtx condition;
rtx_insn *i;
if (target2 != pc_rtx)
{
std::swap (target1, target2);
code = reverse_condition_maybe_unordered (code);
}
condition = ix86_expand_fp_compare (code, op1, op2,
tmp);
i = emit_jump_insn (gen_rtx_SET
(pc_rtx,
gen_rtx_IF_THEN_ELSE (VOIDmode,
condition, target1, target2)));
if (split_branch_probability.initialized_p ())
add_reg_br_prob_note (i, split_branch_probability);
}
void
ix86_expand_setcc (rtx dest, enum rtx_code code, rtx op0, rtx op1)
{

View File

@ -1612,8 +1612,8 @@
(unspec:HI
[(compare:CCFP
(match_operand:X87MODEF 1 "register_operand" "f")
(match_operator:X87MODEF 3 "float_operator"
[(match_operand:SWI24 2 "memory_operand" "m")]))]
(float:X87MODEF
(match_operand:SWI24 2 "memory_operand" "m")))]
UNSPEC_FNSTSW))]
"TARGET_80387
&& (TARGET_USE_<SWI24:MODE>MODE_FIOP
@ -1628,8 +1628,8 @@
[(set (reg:CCFP FLAGS_REG)
(compare:CCFP
(match_operand:X87MODEF 1 "register_operand" "f")
(match_operator:X87MODEF 3 "float_operator"
[(match_operand:SWI24 2 "memory_operand" "m")])))
(float:X87MODEF
(match_operand:SWI24 2 "memory_operand" "m"))))
(clobber (match_operand:HI 0 "register_operand" "=a"))]
"TARGET_80387 && TARGET_SAHF && !TARGET_CMOVE
&& (TARGET_USE_<SWI24:MODE>MODE_FIOP
@ -1640,7 +1640,7 @@
(unspec:HI
[(compare:CCFP
(match_dup 1)
(match_op_dup 3 [(match_dup 2)]))]
(float:X87MODEF (match_dup 2)))]
UNSPEC_FNSTSW))
(set (reg:CC FLAGS_REG)
(unspec:CC [(match_dup 0)] UNSPEC_SAHF))]
@ -12032,142 +12032,6 @@
if (! ix86_comparison_operator (operands[0], VOIDmode))
FAIL;
})
;; Define combination compare-and-branch fp compare instructions to help
;; combine.
(define_insn "*jcc<mode>_0_i387"
[(set (pc)
(if_then_else (match_operator:CCFP 0 "ix86_fp_comparison_operator"
[(match_operand:X87MODEF 1 "register_operand" "f")
(match_operand:X87MODEF 2 "const0_operand")])
(label_ref (match_operand 3))
(pc)))
(clobber (reg:CCFP FPSR_REG))
(clobber (reg:CCFP FLAGS_REG))
(clobber (match_scratch:HI 4 "=a"))]
"TARGET_80387 && !TARGET_CMOVE"
"#")
(define_insn "*jccxf_i387"
[(set (pc)
(if_then_else (match_operator:CCFP 0 "ix86_fp_comparison_operator"
[(match_operand:XF 1 "register_operand" "f")
(match_operand:XF 2 "register_operand" "f")])
(label_ref (match_operand 3))
(pc)))
(clobber (reg:CCFP FPSR_REG))
(clobber (reg:CCFP FLAGS_REG))
(clobber (match_scratch:HI 4 "=a"))]
"TARGET_80387 && !TARGET_CMOVE"
"#")
(define_insn "*jcc<mode>_i387"
[(set (pc)
(if_then_else (match_operator:CCFP 0 "ix86_fp_comparison_operator"
[(match_operand:MODEF 1 "register_operand" "f")
(match_operand:MODEF 2 "nonimmediate_operand" "fm")])
(label_ref (match_operand 3))
(pc)))
(clobber (reg:CCFP FPSR_REG))
(clobber (reg:CCFP FLAGS_REG))
(clobber (match_scratch:HI 4 "=a"))]
"TARGET_80387 && !TARGET_CMOVE"
"#")
(define_insn "*jccu<mode>_i387"
[(set (pc)
(if_then_else (match_operator:CCFPU 0 "ix86_fp_comparison_operator"
[(match_operand:X87MODEF 1 "register_operand" "f")
(match_operand:X87MODEF 2 "register_operand" "f")])
(label_ref (match_operand 3))
(pc)))
(clobber (reg:CCFP FPSR_REG))
(clobber (reg:CCFP FLAGS_REG))
(clobber (match_scratch:HI 4 "=a"))]
"TARGET_80387 && !TARGET_CMOVE"
"#")
(define_split
[(set (pc)
(if_then_else (match_operator 0 "ix86_fp_comparison_operator"
[(match_operand:X87MODEF 1 "register_operand")
(match_operand:X87MODEF 2 "nonimmediate_operand")])
(match_operand 3)
(match_operand 4)))
(clobber (reg:CCFP FPSR_REG))
(clobber (reg:CCFP FLAGS_REG))]
"TARGET_80387 && !TARGET_CMOVE
&& reload_completed"
[(const_int 0)]
{
ix86_split_fp_branch (GET_CODE (operands[0]), operands[1], operands[2],
operands[3], operands[4], NULL_RTX);
DONE;
})
(define_split
[(set (pc)
(if_then_else (match_operator 0 "ix86_fp_comparison_operator"
[(match_operand:X87MODEF 1 "register_operand")
(match_operand:X87MODEF 2 "general_operand")])
(match_operand 3)
(match_operand 4)))
(clobber (reg:CCFP FPSR_REG))
(clobber (reg:CCFP FLAGS_REG))
(clobber (match_scratch:HI 5))]
"TARGET_80387 && !TARGET_CMOVE
&& reload_completed"
[(const_int 0)]
{
ix86_split_fp_branch (GET_CODE (operands[0]), operands[1], operands[2],
operands[3], operands[4], operands[5]);
DONE;
})
;; The order of operands in *jcc<fp>_<int>_i387 is forced by combine in
;; simplify_comparison () function. Float operator is treated as RTX_OBJ
;; with a precedence over other operators and is always put in the first
;; place. Swap condition and operands to match ficom instruction.
(define_insn "*jcc<X87MODEF:mode>_<SWI24:mode>_i387"
[(set (pc)
(if_then_else
(match_operator:CCFP 0 "ix86_swapped_fp_comparison_operator"
[(match_operator:X87MODEF 1 "float_operator"
[(match_operand:SWI24 2 "nonimmediate_operand" "m")])
(match_operand:X87MODEF 3 "register_operand" "f")])
(label_ref (match_operand 4))
(pc)))
(clobber (reg:CCFP FPSR_REG))
(clobber (reg:CCFP FLAGS_REG))
(clobber (match_scratch:HI 5 "=a"))]
"TARGET_80387 && !TARGET_CMOVE
&& (TARGET_USE_<SWI24:MODE>MODE_FIOP
|| optimize_function_for_size_p (cfun))"
"#")
(define_split
[(set (pc)
(if_then_else
(match_operator:CCFP 0 "ix86_swapped_fp_comparison_operator"
[(match_operator:X87MODEF 1 "float_operator"
[(match_operand:SWI24 2 "memory_operand")])
(match_operand:X87MODEF 3 "register_operand")])
(match_operand 4)
(match_operand 5)))
(clobber (reg:CCFP FPSR_REG))
(clobber (reg:CCFP FLAGS_REG))
(clobber (match_scratch:HI 6))]
"TARGET_80387 && !TARGET_CMOVE
&& reload_completed"
[(const_int 0)]
{
ix86_split_fp_branch (swap_condition (GET_CODE (operands[0])), operands[3],
gen_rtx_FLOAT (GET_MODE (operands[1]), operands[2]),
operands[4], operands[5], operands[6]);
DONE;
})
;; Unconditional and other jump instructions

View File

@ -1387,19 +1387,6 @@
(match_operand 0 "comparison_operator")
(match_operand 0 "ix86_trivial_fp_comparison_operator")))
;; Same as above, but for swapped comparison used in *jcc<fp>_<int>_i387.
(define_predicate "ix86_swapped_fp_comparison_operator"
(match_operand 0 "comparison_operator")
{
enum rtx_code code = GET_CODE (op);
bool ret;
PUT_CODE (op, swap_condition (code));
ret = ix86_fp_comparison_operator (op, mode);
PUT_CODE (op, code);
return ret;
})
;; Nearly general operand, but accept any const_double, since we wish
;; to be able to drop them into memory rather than have them get pulled
;; into registers.
@ -1423,10 +1410,6 @@
(define_predicate "plusminuslogic_operator"
(match_code "plus,minus,and,ior,xor"))
;; Return true if this is a float extend operation.
(define_predicate "float_operator"
(match_code "float"))
;; Return true for ARITHMETIC_P.
(define_predicate "arith_or_logical_operator"
(match_code "plus,mult,and,ior,xor,smin,smax,umin,umax,compare,minus,div,

View File

@ -1,3 +1,7 @@
2017-10-11 Uros Bizjak <ubizjak@gmail.com>
* gcc.target/i386/387-ficom-1.c: New test.
2017-10-11 Jeff Law <law@redhat.com>
* gcc.dg/struct-layout-1_generate.c (generate_fields): Fix typo in

View File

@ -0,0 +1,41 @@
/* { dg-do compile } */
/* { dg-require-effective-target ia32 } */
/* { dg-skip-if "" { *-*-* } { "-march=*" } { "-march=i386" } } */
/* { dg-options "-O2 -march=i386 -ffast-math -masm=att" } */
extern short s;
int test_f_s (short x)
{
return (float)x > s;
}
int test_d_s (short x)
{
return (double)x < s;
}
int test_ld_s (short x)
{
return (long double)x == s;
}
extern int i;
int test_f_i (int x)
{
return (float)i >= x;
}
int test_d_i (int x)
{
return (double)i <= x;
}
int test_ld_i (int x)
{
return (long double)i != x;
}
/* { dg-final { scan-assembler-times "ficomps" 3 } } */
/* { dg-final { scan-assembler-times "ficompl" 3 } } */