1987-10-30 18:32:14 +00:00
|
|
|
#include <m2_traps.h>
|
1988-02-19 15:54:01 +00:00
|
|
|
;
|
|
|
|
; (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
|
|
|
; See the copyright notice in the ACK home directory, in the file "Copyright".
|
|
|
|
;
|
|
|
|
;
|
|
|
|
; Module: CARDINAL operations with overflow checking
|
|
|
|
; Author: Ceriel J.H. Jacobs
|
|
|
|
; Version: $Header$
|
|
|
|
;
|
1987-10-30 18:32:14 +00:00
|
|
|
|
|
|
|
mes 2,EM_WSIZE,EM_PSIZE
|
|
|
|
|
1987-11-26 14:15:24 +00:00
|
|
|
exp $addu
|
|
|
|
exp $subu
|
|
|
|
exp $mulu
|
|
|
|
#if EM_WSIZE < EM_LSIZE
|
|
|
|
exp $addul
|
|
|
|
exp $subul
|
|
|
|
exp $mulul
|
|
|
|
#endif
|
|
|
|
|
1987-10-30 18:32:14 +00:00
|
|
|
pro $addu,0
|
|
|
|
loc -1
|
|
|
|
lol 0
|
|
|
|
sbu EM_WSIZE
|
|
|
|
lol EM_WSIZE
|
|
|
|
cmu EM_WSIZE
|
1987-11-26 14:15:24 +00:00
|
|
|
zge *1
|
1987-10-30 18:32:14 +00:00
|
|
|
loc M2_UOVFL
|
|
|
|
trp
|
|
|
|
1
|
|
|
|
lol 0
|
|
|
|
lol EM_WSIZE
|
|
|
|
adu EM_WSIZE
|
|
|
|
stl EM_WSIZE
|
|
|
|
ret 0
|
|
|
|
end 0
|
|
|
|
|
1987-11-26 14:15:24 +00:00
|
|
|
#if EM_WSIZE < EM_LSIZE
|
|
|
|
pro $addul,0
|
|
|
|
ldc -1
|
|
|
|
ldl 0
|
|
|
|
sbu EM_LSIZE
|
|
|
|
ldl EM_LSIZE
|
|
|
|
cmu EM_LSIZE
|
|
|
|
zge *1
|
|
|
|
loc M2_UOVFL
|
|
|
|
trp
|
|
|
|
1
|
|
|
|
ldl 0
|
|
|
|
ldl EM_LSIZE
|
|
|
|
adu EM_LSIZE
|
|
|
|
sdl EM_LSIZE
|
|
|
|
ret 0
|
|
|
|
end 0
|
|
|
|
#endif
|
|
|
|
|
1987-10-30 18:32:14 +00:00
|
|
|
pro $mulu,0
|
|
|
|
lol 0
|
|
|
|
zeq *1
|
|
|
|
loc -1
|
|
|
|
lol 0
|
|
|
|
dvu EM_WSIZE
|
|
|
|
lol EM_WSIZE
|
|
|
|
cmu EM_WSIZE
|
1987-11-27 14:13:11 +00:00
|
|
|
zge *1
|
1987-10-30 18:32:14 +00:00
|
|
|
loc M2_UOVFL
|
|
|
|
trp
|
|
|
|
1
|
|
|
|
lol 0
|
|
|
|
lol EM_WSIZE
|
|
|
|
mlu EM_WSIZE
|
|
|
|
stl EM_WSIZE
|
|
|
|
ret 0
|
|
|
|
end 0
|
1987-11-26 14:15:24 +00:00
|
|
|
|
|
|
|
#if EM_WSIZE < EM_LSIZE
|
|
|
|
pro $mulul,0
|
|
|
|
ldl 0
|
|
|
|
ldc 0
|
|
|
|
cmu EM_LSIZE
|
|
|
|
zeq *1
|
|
|
|
ldc -1
|
|
|
|
ldl 0
|
|
|
|
dvu EM_LSIZE
|
|
|
|
ldl EM_LSIZE
|
|
|
|
cmu EM_LSIZE
|
1987-11-27 14:13:11 +00:00
|
|
|
zge *1
|
1987-11-26 14:15:24 +00:00
|
|
|
loc M2_UOVFL
|
|
|
|
trp
|
|
|
|
1
|
|
|
|
ldl 0
|
|
|
|
ldl EM_LSIZE
|
|
|
|
mlu EM_LSIZE
|
|
|
|
sdl EM_LSIZE
|
|
|
|
ret 0
|
|
|
|
end 0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
pro $subu,0
|
|
|
|
lol EM_WSIZE
|
|
|
|
lol 0
|
|
|
|
cmu EM_WSIZE
|
|
|
|
zge *1
|
|
|
|
loc M2_UOVFL
|
|
|
|
trp
|
|
|
|
1
|
|
|
|
lol EM_WSIZE
|
|
|
|
lol 0
|
|
|
|
sbu EM_WSIZE
|
|
|
|
stl EM_WSIZE
|
|
|
|
ret 0
|
|
|
|
end 0
|
|
|
|
|
|
|
|
#if EM_WSIZE < EM_LSIZE
|
|
|
|
pro $subul,0
|
|
|
|
ldl EM_LSIZE
|
|
|
|
ldl 0
|
|
|
|
cmu EM_LSIZE
|
|
|
|
zge *1
|
|
|
|
loc M2_UOVFL
|
|
|
|
trp
|
|
|
|
1
|
|
|
|
ldl EM_LSIZE
|
|
|
|
ldl 0
|
|
|
|
sbu EM_LSIZE
|
|
|
|
sdl EM_LSIZE
|
|
|
|
ret 0
|
|
|
|
end 0
|
|
|
|
#endif
|