i386.md (*cmp<X87MODEF:mode>_<SWI24:mode>_i387): Do not use float_operator operator...
authorUros Bizjak <uros@gcc.gnu.org>
Wed, 11 Oct 2017 18:00:55 +0000 (20:00 +0200)
committerUros Bizjak <uros@gcc.gnu.org>
Wed, 11 Oct 2017 18:00:55 +0000 (20:00 +0200)
* 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

gcc/ChangeLog
gcc/config/i386/i386-protos.h
gcc/config/i386/i386.c
gcc/config/i386/i386.md
gcc/config/i386/predicates.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/387-ficom-1.c [new file with mode: 0644]

index c596313bb11b634c57c8754a444fed76ad451305..6f148dc051c111dba680d7c940b72a28356facc2 100644 (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.
index ab3d8f95c5d0c5bdbf6b5ae8f200e9c5dc5a7dd0..6a7cdd3ed737f3b32dcc6a3c4ed85c85789b84c7 100644 (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);
index 63058a8d19ca2402515860869897f3dbe3f1a15c..ca060b529d2c74dc54d5862557bbdc63960fa4d8 100644 (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)
 {
index 1a794c0ae06a7dd2216149ecbe198d0ccf848f15..9e1f85f2993b93ef101295c4ad8773bbe77b8256 100644 (file)
        (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
   [(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
        (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))]
   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;
-})
 \f
 ;; Unconditional and other jump instructions
 
index 4e023afb1107ca2f9a7d391d879b0fce4d24eff3..0917fad15d41ae55205965df691c6883b9ab3082 100644 (file)
                (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.
 (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 adf2425a67e09ab5dbec7df3cea7700c7728e447..b85e93cafd0bde12bffca8d7d5ef423a34c397c6 100644 (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
diff --git a/gcc/testsuite/gcc.target/i386/387-ficom-1.c b/gcc/testsuite/gcc.target/i386/387-ficom-1.c
new file mode 100644 (file)
index 0000000..8c73ddc
--- /dev/null
@@ -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 } } */