aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hipe/ppc
diff options
context:
space:
mode:
authorMikael Pettersson <mikpelinux@gmail.com>2015-01-08 19:26:38 +0100
committerMikael Pettersson <mikpelinux@gmail.com>2015-01-11 13:07:43 +0100
commiteb255403b28bc1330d34d1d64ad8b8b42788c7ae (patch)
tree0aec9325d5407459f93ec9994d0f4509624e65c1 /lib/hipe/ppc
parentaee18f309d41691019fc323bd41c5f78be49953b (diff)
downloadotp-eb255403b28bc1330d34d1d64ad8b8b42788c7ae.tar.gz
otp-eb255403b28bc1330d34d1d64ad8b8b42788c7ae.tar.bz2
otp-eb255403b28bc1330d34d1d64ad8b8b42788c7ae.zip
hipe: backends: correct #fconv{} translation
RTL can produce an #fconv{} instruction with an immediate operand, but the backends unconditionally access the operand as a temporary. This results in broken representation in the backends and eventually they crash.
Diffstat (limited to 'lib/hipe/ppc')
-rw-r--r--lib/hipe/ppc/hipe_rtl_to_ppc.erl14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/hipe/ppc/hipe_rtl_to_ppc.erl b/lib/hipe/ppc/hipe_rtl_to_ppc.erl
index 7dfa56df29..a55fc137c3 100644
--- a/lib/hipe/ppc/hipe_rtl_to_ppc.erl
+++ b/lib/hipe/ppc/hipe_rtl_to_ppc.erl
@@ -102,10 +102,18 @@ conv_insn(I, Map, Data) ->
end.
conv_fconv(I, Map, Data) ->
- %% Dst := (double)Src, where Dst is FP reg and Src is int reg
+ %% Dst := (double)Src, where Dst is FP reg and Src is GP reg or imm
{Dst, Map0} = conv_fpreg(hipe_rtl:fconv_dst(I), Map),
- {Src, Map1} = conv_src(hipe_rtl:fconv_src(I), Map0), % exclude imm src
- I2 = mk_fconv(Dst, Src),
+ {Src, Map1} = conv_src(hipe_rtl:fconv_src(I), Map0),
+ I2 =
+ case hipe_ppc:is_temp(Src) of
+ true ->
+ mk_fconv(Dst, Src);
+ false ->
+ Tmp = new_untagged_temp(),
+ mk_li(Tmp, Src,
+ mk_fconv(Dst, Tmp))
+ end,
{I2, Map1, Data}.
mk_fconv(Dst, Src) ->