From 344f3687dd31c7ed28a977f62939236818dfada3 Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Mon, 8 Aug 2011 17:03:04 +0200 Subject: [PATCH] sparc: floatingpoint flags producing nodes have 1 cycle delay, add an ad-hoc fix for that --- ir/be/sparc/sparc_emitter.c | 13 +++++++++++++ ir/be/sparc/sparc_spec.pl | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/ir/be/sparc/sparc_emitter.c b/ir/be/sparc/sparc_emitter.c index 520e763f4..d0a850701 100644 --- a/ir/be/sparc/sparc_emitter.c +++ b/ir/be/sparc/sparc_emitter.c @@ -782,6 +782,19 @@ static void emit_sparc_Bicc(const ir_node *node) static void emit_sparc_fbfcc(const ir_node *node) { + /* if the flags producing node was immediately in front of us, emit + * a nop */ + ir_node *flags = get_irn_n(node, n_sparc_fbfcc_flags); + ir_node *prev = sched_prev(node); + if (is_Block(prev)) { + /* TODO: when the flags come from another block, then we have to do + * more complicated tests to see wether the flag producing node is + * potentially in front of us (could happen for fallthroughs) */ + panic("TODO: fbfcc flags come from other block"); + } + if (skip_Proj(flags) == prev) { + be_emit_cstring("\tnop\n"); + } emit_sparc_branch(node, get_fcc); } diff --git a/ir/be/sparc/sparc_spec.pl b/ir/be/sparc/sparc_spec.pl index 1067e52dd..502067ae8 100644 --- a/ir/be/sparc/sparc_spec.pl +++ b/ir/be/sparc/sparc_spec.pl @@ -460,6 +460,8 @@ Bicc => { attr => "ir_relation relation, bool is_unsigned", init_attr => "\tinit_sparc_jmp_cond_attr(res, relation, is_unsigned);", reg_req => { in => [ "flags" ], out => [ "none", "none" ] }, + ins => [ "flags" ], + outs => [ "false", "true" ], }, fbfcc => { @@ -470,6 +472,8 @@ fbfcc => { attr => "ir_relation relation", init_attr => "\tinit_sparc_jmp_cond_attr(res, relation, false);", reg_req => { in => [ "fpflags" ], out => [ "none", "none" ] }, + ins => [ "flags" ], + outs => [ "false", "true" ], }, Ba => { -- 2.20.1