aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hipe/ppc
diff options
context:
space:
mode:
authorMagnus Lång <[email protected]>2016-08-22 15:22:41 +0200
committerMagnus Lång <[email protected]>2016-08-22 15:22:41 +0200
commit3dc5ab6005e0a391dabb225f5dade0c0f8929b55 (patch)
tree525f5d43d4e66d10cfdb4274515cebc70ccccb57 /lib/hipe/ppc
parente2cc919a4072db5f9b8f2c279075c34996f999e0 (diff)
downloadotp-3dc5ab6005e0a391dabb225f5dade0c0f8929b55.tar.gz
otp-3dc5ab6005e0a391dabb225f5dade0c0f8929b55.tar.bz2
otp-3dc5ab6005e0a391dabb225f5dade0c0f8929b55.zip
hipe_ppc: Fix incorrect encoding of shift by 0
Diffstat (limited to 'lib/hipe/ppc')
-rw-r--r--lib/hipe/ppc/hipe_ppc_assemble.erl6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/hipe/ppc/hipe_ppc_assemble.erl b/lib/hipe/ppc/hipe_ppc_assemble.erl
index ff9da01b11..2cbcee4802 100644
--- a/lib/hipe/ppc/hipe_ppc_assemble.erl
+++ b/lib/hipe/ppc/hipe_ppc_assemble.erl
@@ -175,7 +175,8 @@ do_slwi_opnds(Dst, Src1, {uimm,N}) when is_integer(N), 0 =< N, N < 32 ->
{Dst, Src1, {sh,N}, {mb,0}, {me,31-N}}.
do_srwi_opnds(Dst, Src1, {uimm,N}) when is_integer(N), 0 =< N, N < 32 ->
- {Dst, Src1, {sh,32-N}, {mb,N}, {me,31}}.
+ %% SH should be 0 (not 32) when N is 0
+ {Dst, Src1, {sh,(32-N) band 31}, {mb,N}, {me,31}}.
do_srawi_src2({uimm,N}) when is_integer(N), 0 =< N, N < 32 -> {sh,N}.
@@ -184,7 +185,8 @@ do_sldi_opnds(Dst, Src1, {uimm,N}) when is_integer(N), 0 =< N, N < 64 ->
{Dst, Src1, {sh6,N}, {me6,63-N}}.
do_srdi_opnds(Dst, Src1, {uimm,N}) when is_integer(N), 0 =< N, N < 64 ->
- {Dst, Src1, {sh6,64-N}, {mb6,N}}.
+ %% SH should be 0 (not 64) when N is 0
+ {Dst, Src1, {sh6,(64-N) band 63}, {mb6,N}}.
do_sradi_src2({uimm,N}) when is_integer(N), 0 =< N, N < 64 -> {sh6,N}.