aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hipe/ppc/hipe_ppc.erl
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2016-08-26 12:27:17 +0200
committerSverker Eriksson <[email protected]>2016-08-26 12:27:17 +0200
commitf3e018dc3bb3c74b88c7454f6a1888938215f912 (patch)
tree7f217508515647e557cf3c30c79badba9ab0f1dd /lib/hipe/ppc/hipe_ppc.erl
parent2a6750d0804d1e30a5463c8aaf5b7342fda967fe (diff)
parenta504c30efbc14381385a6ef911ba7296840f8cb7 (diff)
downloadotp-f3e018dc3bb3c74b88c7454f6a1888938215f912.tar.gz
otp-f3e018dc3bb3c74b88c7454f6a1888938215f912.tar.bz2
otp-f3e018dc3bb3c74b88c7454f6a1888938215f912.zip
Merge branch 'sverker/hipe-backend-bugs/PR-1146' into maint
Diffstat (limited to 'lib/hipe/ppc/hipe_ppc.erl')
-rw-r--r--lib/hipe/ppc/hipe_ppc.erl12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/hipe/ppc/hipe_ppc.erl b/lib/hipe/ppc/hipe_ppc.erl
index 0fa96162f6..380e791bc1 100644
--- a/lib/hipe/ppc/hipe_ppc.erl
+++ b/lib/hipe/ppc/hipe_ppc.erl
@@ -167,8 +167,10 @@ temp_is_precoloured(#ppc_temp{reg=Reg,type=Type}) ->
_ -> hipe_ppc_registers:is_precoloured_gpr(Reg)
end.
-mk_simm16(Value) -> #ppc_simm16{value=Value}.
-mk_uimm16(Value) -> #ppc_uimm16{value=Value}.
+mk_simm16(Value) when Value >= -(1 bsl 15), Value < (1 bsl 15) ->
+ #ppc_simm16{value=Value}.
+mk_uimm16(Value) when Value >= 0, Value < (1 bsl 16) ->
+ #ppc_uimm16{value=Value}.
mk_mfa(M, F, A) -> #ppc_mfa{m=M, f=F, a=A}.
@@ -240,7 +242,11 @@ mk_li(Dst, Value, Tail) -> % Dst can be R0
Value =< 16#7FFFFFFF ->
mk_li32(Dst, R0, Value, Tail);
true ->
- Highest = (Value bsr 48), % Value@highest
+ Highest = case (Value bsr 48) of % Value@highest
+ TopBitSet when TopBitSet >= (1 bsl 15) ->
+ TopBitSet - (1 bsl 16); % encoder needs it to be negative
+ FitsSimm16 -> FitsSimm16
+ end,
Higher = (Value bsr 32) band 16#FFFF, % Value@higher
High = (Value bsr 16) band 16#FFFF, % Value@h
Low = Value band 16#FFFF, % Value@l