From 38de688c5ad0c9ea7c1de2224c3f33d93bdbb588 Mon Sep 17 00:00:00 2001 From: David Given Date: Sun, 9 Oct 2016 15:08:03 +0200 Subject: [PATCH] Floating point promotion was broken since the IR float change. Fix. --- mach/proto/mcg/pass_promotefloatops.c | 12 +++++------- mach/proto/mcg/table | 14 +++++++++----- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/mach/proto/mcg/pass_promotefloatops.c b/mach/proto/mcg/pass_promotefloatops.c index 7b1d769f1..1fdff6f4a 100644 --- a/mach/proto/mcg/pass_promotefloatops.c +++ b/mach/proto/mcg/pass_promotefloatops.c @@ -41,14 +41,12 @@ static void promote(struct ir* ir) break; case IR_PHI: - if (!array_appendu(&promotable, ir)) - { - if (ir->left) - promote(ir->left); - if (ir->right) - promote(ir->right); - } + { + int i; + for (i=0; iu.phivalue.count; i++) + array_appendu(&promotable, ir->u.phivalue.item[i].right); break; + } } } diff --git a/mach/proto/mcg/table b/mach/proto/mcg/table index 953b4e704..4a853a642 100644 --- a/mach/proto/mcg/table +++ b/mach/proto/mcg/table @@ -328,17 +328,21 @@ PATTERNS emit "la %out, $value" cost 8; - out:(int)reg = value:CONSTF4 - emit "lfs %out, address-containing-$value" - cost 8; - - /* FPU operations */ + out:(float)reg = value:CONSTF4 + emit "lfs %out, address-containing-$value" + cost 8; + out:(float)reg = ADDF4(left:(float)reg, right:(float)reg) emit "fadds %out, %left, %right" cost 4; + out:(float)reg = SUBF4(left:(float)reg, right:(float)reg) + emit "fsubs %out, %left, %right" + cost 4; + + /* vim: set sw=4 ts=4 expandtab : */ -- 2.34.1