aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMagnus Lång <[email protected]>2016-08-22 15:24:07 +0200
committerMagnus Lång <[email protected]>2016-08-22 15:24:07 +0200
commit230d8cec7465d2b75d0b78c2bcaa76ccbd7f6a29 (patch)
treefa0a8e12a0b1cf7b8e1e780cd58f19a13e06efda /lib
parentd4bde96be298b77069ce2324618dedc2946e9675 (diff)
downloadotp-230d8cec7465d2b75d0b78c2bcaa76ccbd7f6a29.tar.gz
otp-230d8cec7465d2b75d0b78c2bcaa76ccbd7f6a29.tar.bz2
otp-230d8cec7465d2b75d0b78c2bcaa76ccbd7f6a29.zip
hipe_arm: Fix translation of shift by 0
The problem was caused by shift-by-immediate-zero, which wraps to immediate-32 with some shiftops. TODO: Someplace should be modified to crash when these are generated so debugging further instances of this gets easier in the future.
Diffstat (limited to 'lib')
-rw-r--r--lib/hipe/arm/hipe_rtl_to_arm.erl9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/hipe/arm/hipe_rtl_to_arm.erl b/lib/hipe/arm/hipe_rtl_to_arm.erl
index ad5a559995..93342aba33 100644
--- a/lib/hipe/arm/hipe_rtl_to_arm.erl
+++ b/lib/hipe/arm/hipe_rtl_to_arm.erl
@@ -148,10 +148,11 @@ mk_shift_ir(S, Dst, Src1, ShiftOp, Src2) ->
mk_li(Tmp, Src1,
mk_shift_rr(S, Dst, Tmp, ShiftOp, Src2)).
-mk_shift_ri(S, Dst, Src1, ShiftOp, Src2) when is_integer(Src2) ->
- if Src2 >= 0, Src2 < 32 -> ok;
- true -> io:format("~w: excessive immediate shift ~w\n", [?MODULE,Src2])
- end,
+mk_shift_ri(S, Dst, Src1, ShiftOp, 0)
+ when ShiftOp =:= lsl; ShiftOp =:= lsr; ShiftOp =:= asr ->
+ [hipe_arm:mk_move(S, Dst, Src1)];
+mk_shift_ri(S, Dst, Src1, ShiftOp, Src2)
+ when is_integer(Src2), Src2 > 0, Src2 < 32 ->
Am1 = {Src1,ShiftOp,Src2},
[hipe_arm:mk_move(S, Dst, Am1)].