summaryrefslogtreecommitdiff
path: root/gcc/config
diff options
context:
space:
mode:
authoramylaar <amylaar@138bc75d-0d04-0410-961f-82ee72b054a4>2012-11-29 01:46:47 +0000
committeramylaar <amylaar@138bc75d-0d04-0410-961f-82ee72b054a4>2012-11-29 01:46:47 +0000
commit679ad1507712e248b48a13a2f917c9990a8a3da8 (patch)
tree871ea82376a663fa1dd3614ba691ab134cfc88d9 /gcc/config
parentca369ad2bb21beea1c3c1d4455ff09baa9ce3ed9 (diff)
downloadgcc-679ad1507712e248b48a13a2f917c9990a8a3da8.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@193915 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config')
-rw-r--r--gcc/config/epiphany/epiphany-sched.md7
-rw-r--r--gcc/config/epiphany/epiphany.h4
-rw-r--r--gcc/config/epiphany/epiphany.md26
-rw-r--r--gcc/config/epiphany/predicates.md3
4 files changed, 40 insertions, 0 deletions
diff --git a/gcc/config/epiphany/epiphany-sched.md b/gcc/config/epiphany/epiphany-sched.md
index 4d425bb6f86..5e1519f9934 100644
--- a/gcc/config/epiphany/epiphany-sched.md
+++ b/gcc/config/epiphany/epiphany-sched.md
@@ -136,3 +136,10 @@
(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)))
diff --git a/gcc/config/epiphany/epiphany.h b/gcc/config/epiphany/epiphany.h
index 26a908a67ce..d411b295c91 100644
--- a/gcc/config/epiphany/epiphany.h
+++ b/gcc/config/epiphany/epiphany.h
@@ -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 */
diff --git a/gcc/config/epiphany/epiphany.md b/gcc/config/epiphany/epiphany.md
index c70df07d410..21e619c2dea 100644
--- a/gcc/config/epiphany/epiphany.md
+++ b/gcc/config/epiphany/epiphany.md
@@ -1014,6 +1014,32 @@
"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" "")
diff --git a/gcc/config/epiphany/predicates.md b/gcc/config/epiphany/predicates.md
index 52c07b61d95..cb4b5743a41 100644
--- a/gcc/config/epiphany/predicates.md
+++ b/gcc/config/epiphany/predicates.md
@@ -256,6 +256,9 @@
}
})
+(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")))