fix for incorrect double-cell shift by 32 or more bits
This commit is contained in:
parent
ffb555c42f
commit
c076939fe2
37
jumpforth.S
37
jumpforth.S
|
|
@ -630,30 +630,67 @@ defcode DUTWODIV,"DU2/"
|
||||||
/* ( x1 u -- x2 ) Shift left by u bits */
|
/* ( x1 u -- x2 ) Shift left by u bits */
|
||||||
defcode LSHIFT
|
defcode LSHIFT
|
||||||
pop %ecx
|
pop %ecx
|
||||||
|
cmp $32,%ecx
|
||||||
|
jae 1f
|
||||||
shll %cl,(%esp)
|
shll %cl,(%esp)
|
||||||
NEXT
|
NEXT
|
||||||
|
1: movl $0,(%esp)
|
||||||
|
NEXT
|
||||||
|
|
||||||
/* ( u1 u -- u2 ) Logical (unsigned) shift right by u bits */
|
/* ( u1 u -- u2 ) Logical (unsigned) shift right by u bits */
|
||||||
defcode RSHIFT
|
defcode RSHIFT
|
||||||
pop %ecx
|
pop %ecx
|
||||||
|
cmp $32,%ecx
|
||||||
|
jae 1f
|
||||||
shrl %cl,(%esp)
|
shrl %cl,(%esp)
|
||||||
NEXT
|
NEXT
|
||||||
|
1: movl $0,(%esp)
|
||||||
|
NEXT
|
||||||
|
|
||||||
/* ( xd1 u -- xd2 ) Shift left by u bits */
|
/* ( xd1 u -- xd2 ) Shift left by u bits */
|
||||||
defcode DLSHIFT
|
defcode DLSHIFT
|
||||||
pop %ecx
|
pop %ecx
|
||||||
|
cmp $32,%ecx
|
||||||
|
jae 1f
|
||||||
movl 4(%esp),%eax
|
movl 4(%esp),%eax
|
||||||
shldl %cl,%eax,(%esp)
|
shldl %cl,%eax,(%esp)
|
||||||
shll %cl,4(%esp)
|
shll %cl,4(%esp)
|
||||||
NEXT
|
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 */
|
/* ( ud1 u -- ud2 ) Logical (unsigned) shift right by u bits */
|
||||||
defcode DRSHIFT
|
defcode DRSHIFT
|
||||||
pop %ecx
|
pop %ecx
|
||||||
|
cmp $32,%ecx
|
||||||
|
jae 1f
|
||||||
movl (%esp),%eax
|
movl (%esp),%eax
|
||||||
shrdl %cl,%eax,4(%esp)
|
shrdl %cl,%eax,4(%esp)
|
||||||
shrl %cl,(%esp)
|
shrl %cl,(%esp)
|
||||||
NEXT
|
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
|
.macro defzcmp label,ncc,name="\label",flags=0
|
||||||
defcode \label,"\name",0,\flags
|
defcode \label,"\name",0,\flags
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue