predicates.md (addsub_operator): New predicate.
authorJoern Rennecke <joern.rennecke@embecosm.com>
Thu, 29 Nov 2012 01:46:47 +0000 (01:46 +0000)
committerJoern Rennecke <amylaar@gcc.gnu.org>
Thu, 29 Nov 2012 01:46:47 +0000 (01:46 +0000)
        * config/epiphany/predicates.md (addsub_operator): New predicate.
        * config/epiphany/epiphany-sched.md (sched_use_fpu): New attribute.
        * config/epiphany/epiphany.md (isub_i+1): New peephole2.
        * config/epiphany/epiphany.h (get_attr_sched_use_fpu): Declare.

From-SVN: r193915

gcc/ChangeLog
gcc/config/epiphany/epiphany-sched.md
gcc/config/epiphany/epiphany.h
gcc/config/epiphany/epiphany.md
gcc/config/epiphany/predicates.md

index c5eb335aa5eee27b5a3053822a67786daa238491..b85c7cf1bf9e79bb3a8a17a132709c45bf2149fd 100644 (file)
@@ -1,3 +1,10 @@
+2012-11-29  Joern Rennecke  <joern.rennecke@embecosm.com>
+
+       * config/epiphany/predicates.md (addsub_operator): New predicate.
+       * config/epiphany/epiphany-sched.md (sched_use_fpu): New attribute.
+       * config/epiphany/epiphany.md (isub_i+1): New peephole2.
+       * config/epiphany/epiphany.h (get_attr_sched_use_fpu): Declare.
+
 2012-11-28  Jakub Jelinek  <jakub@redhat.com>
 
        PR debug/36728
index 4d425bb6f86facc9702f536a6c0bd95c1c97982f..5e1519f993454ab22aa0872fa3aa55d758fc204f 100644 (file)
   (and (eq_attr "pipe_model" "epiphany")
        (eq_attr "type" "v2fp"))
   "issue,issue+F0,F0")
+
+; A boolean attribute for use by peephole2 patterns that try to figure out
+; if we overcommitted the FPU.
+; This is notionally a numeric attribute to avoid dependency problems.
+(define_attr "sched_use_fpu" ""
+  (cond [(eq_attr "type" "fp,fp_int,v2fp") (const_int 1)]
+       (const_int 0)))
index 26a908a67ce295690bf3b572e8d6a1945f72c363..d411b295c91d69151b572e45b968128e0d027a97 100644 (file)
@@ -926,4 +926,8 @@ extern struct rtl_opt_pass pass_resolve_sw_modes;
 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
   epiphany_start_function ((FILE), (NAME), (DECL))
 
+/* PR other/55523: gencondmd file includes / dependencies are messed up,
+   it uses peephole2 predicates without having all the necessary headers.  */
+extern int get_attr_sched_use_fpu (rtx);
+
 #endif /* !GCC_EPIPHANY_H */
index c70df07d410fa762f584b999fee183601ef21747..21e619c2deaf7946f6ef59a962d6eefadb0bec4c 100644 (file)
   "isub %0, %1, %2"
   [(set_attr "type" "fp_int")])
 
+; Try to figure out if we over-committed the FPU, and if so, move
+; some insns back over to the integer pipe.
+
+; The peephole optimizer 'consumes' the insns that are explicitly
+; mentioned.  We do not want the preceding insn reconsidered, but
+; we do want that for the following one, so that if we have a run
+; of five fpu users, two of them get changed.  Therefore, we
+; use next_active_insn to look at the 'following' insn.  That should
+; exist, because peephole2 runs after reload, and there has to be
+; a return after an fp_int insn.
+(define_peephole2
+  [(match_parallel 5 "float_operation" [(match_operand 6 "" "")])
+   (match_parallel 3 "float_operation"
+     [(set (match_operand:SI 0 "gpr_operand" "")
+          (match_operator:SI 4 "addsub_operator"
+            [(match_operand:SI 1 "gpr_operand" "")
+             (match_operand:SI 2 "gpr_operand" "")]))
+      (clobber (reg:CC_FP CCFP_REGNUM))])]
+  "get_attr_sched_use_fpu (peep2_next_insn (0))
+   && peep2_regno_dead_p (2, CC_REGNUM)
+   && get_attr_sched_use_fpu (next_active_insn (peep2_next_insn (1)))"
+  [(match_dup 5)
+   (parallel [(set (match_dup 0) (match_dup 4))
+             (clobber (reg:CC CC_REGNUM))])]
+)
+
 (define_expand "mulsi3"
   [(parallel
      [(set (match_operand:SI 0 "gpr_operand" "")
index 52c07b61d95ce405be38f1032e8b18c11234b814..cb4b5743a41654f1882cbcf1bad3f3ca335e6fbe 100644 (file)
     }
 })
 
+(define_predicate "addsub_operator"
+  (match_code "plus, minus"))
+
 (define_predicate "cc_operand"
   (and (match_code "reg")
        (match_test "REGNO (op) == CC_REGNUM || REGNO (op) == CCFP_REGNUM")))