mirror of
https://github.com/Interlisp/maiko.git
synced 2026-02-10 02:00:17 +00:00
Use gcc / clang overflow builtins. (#142)
* Use gcc / clang overflow builtins. This avoids expensive checks for overflow that employ undefined behavior. This is a step along the way towards replacing the old hand-written assembler that did the same thing in terms of using the CPU's overflow detection. * Remove unimplemented SPARC asm for multiplication, divide, and remainder. This wasn't implemented before, and for multiplication, it is now implemented for gcc and friends using overflow detection. * Remove USE_INLINE_ARITH. Now that we have the compiler built-ins for detecting overflow, we don't need custom assembly for it for each platform. For now, we keep, but still don't use, the code that do a hot path through the dispatch loop for some math. This code isn't actually running or in use, but it is separate from how the other inline arithmetic was being performed. These are the `fast_op_*` functions that are implemented in assembler.
This commit is contained in:
@@ -131,80 +131,6 @@ done: ! else done;
|
||||
nop
|
||||
.end
|
||||
|
||||
/*
|
||||
***************************************************************
|
||||
Arithmetic Opcode Helpers
|
||||
***************************************************************
|
||||
*/
|
||||
|
||||
.inline _sub32,8
|
||||
subcc %o0,%o1,%o0 ! result = arg0 - arg1
|
||||
bvs diff_err
|
||||
nop
|
||||
.end
|
||||
|
||||
.inline _isub32,8
|
||||
subcc %o0,%o1,%o0 ! result = arg0 - arg1
|
||||
bvs idiff_err
|
||||
nop
|
||||
.end
|
||||
|
||||
.inline _sub32n,8
|
||||
subcc %o0,%o1,%o0 ! result = arg0 - arg1
|
||||
bvs diff_err2
|
||||
nop
|
||||
.end
|
||||
|
||||
.inline _mpy32,8
|
||||
ba mpy_err
|
||||
nop
|
||||
.end
|
||||
|
||||
.inline _impy32,8
|
||||
ba impy_err
|
||||
nop
|
||||
.end
|
||||
|
||||
.inline _quot32,8
|
||||
ba quot_err
|
||||
nop
|
||||
.end
|
||||
|
||||
.inline _iquot32,8
|
||||
ba iquot_err
|
||||
nop
|
||||
.end
|
||||
|
||||
.inline _rem32,8
|
||||
ba rem_err
|
||||
nop
|
||||
.end
|
||||
|
||||
.inline _irem32,8
|
||||
ba irem_err
|
||||
nop
|
||||
.end
|
||||
|
||||
|
||||
.inline _plus32,8
|
||||
addcc %o0,%o1,%o0 ! result = arg0 + arg1
|
||||
bvs plus_err
|
||||
nop
|
||||
.end
|
||||
|
||||
.inline _iplus32,8
|
||||
addcc %o0,%o1,%o0 ! result = arg0 + arg1
|
||||
bvs iplus_err
|
||||
nop
|
||||
.end
|
||||
|
||||
.inline _iplus32n,8
|
||||
addcc %o0,%o1,%o0 ! result = arg0 + arg1
|
||||
bvs iplusn_err
|
||||
nop
|
||||
.end
|
||||
|
||||
|
||||
/*
|
||||
***************************************************************
|
||||
Inline Assembly help for dispatcher.
|
||||
|
||||
Reference in New Issue
Block a user