Hello! Remove dead code, obsoleted by cbranch rewrite years ago.
2017-10-11 Uros Bizjak <ubiz...@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 <ubiz...@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. testsuite/ChangeLog: 2017-10-11 Uros Bizjak <ubiz...@gmail.com> * gcc.target/i386/387-ficom-1.c: New test. Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}. Committed to mainline SVN. Uros.
Index: config/i386/i386-protos.h =================================================================== --- config/i386/i386-protos.h (revision 253645) +++ config/i386/i386-protos.h (working copy) @@ -165,9 +165,6 @@ extern void ix86_asm_output_function_label (FILE * 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); Index: config/i386/i386.c =================================================================== --- config/i386/i386.c (revision 253645) +++ config/i386/i386.c (working copy) @@ -24339,32 +24339,7 @@ ix86_expand_branch (enum rtx_code code, rtx op0, r } } -/* 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) { rtx ret; Index: config/i386/i386.md =================================================================== --- config/i386/i386.md (revision 253645) +++ config/i386/i386.md (working copy) @@ -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 Index: config/i386/predicates.md =================================================================== --- config/i386/predicates.md (revision 253645) +++ config/i386/predicates.md (working copy) @@ -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, Index: testsuite/gcc.target/i386/387-ficom-1.c =================================================================== --- testsuite/gcc.target/i386/387-ficom-1.c (nonexistent) +++ testsuite/gcc.target/i386/387-ficom-1.c (working copy) @@ -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 } } */