fix for incorrect double-cell shift by 32 or more bits

This commit is contained in:
Jesse D. McDonald 2020-11-06 20:29:48 -06:00
parent ffb555c42f
commit c076939fe2
1 changed files with 37 additions and 0 deletions

View File

@ -630,30 +630,67 @@ defcode DUTWODIV,"DU2/"
/* ( x1 u -- x2 ) Shift left by u bits */
defcode LSHIFT
pop %ecx
cmp $32,%ecx
jae 1f
shll %cl,(%esp)
NEXT
1: movl $0,(%esp)
NEXT
/* ( u1 u -- u2 ) Logical (unsigned) shift right by u bits */
defcode RSHIFT
pop %ecx
cmp $32,%ecx
jae 1f
shrl %cl,(%esp)
NEXT
1: movl $0,(%esp)
NEXT
/* ( xd1 u -- xd2 ) Shift left by u bits */
defcode DLSHIFT
pop %ecx
cmp $32,%ecx
jae 1f
movl 4(%esp),%eax
shldl %cl,%eax,(%esp)
shll %cl,4(%esp)
NEXT
1: pop %ebx
pop %eax
xor %ebx,%ebx
cmp $64,%ecx
jae 2f
shl %cl,%eax
push %ebx
push %eax
NEXT
2: push %ebx
push %ebx
NEXT
/* ( ud1 u -- ud2 ) Logical (unsigned) shift right by u bits */
defcode DRSHIFT
pop %ecx
cmp $32,%ecx
jae 1f
movl (%esp),%eax
shrdl %cl,%eax,4(%esp)
shrl %cl,(%esp)
NEXT
1: pop %ebx
pop %eax
xor %eax,%eax
cmp $64,%ecx
jae 2f
shr %cl,%ebx
push %ebx
push %eax
NEXT
2: push %eax
push %eax
NEXT
.macro defzcmp label,ncc,name="\label",flags=0
defcode \label,"\name",0,\flags