1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-02-03 07:10:39 +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:
Bruce Mitchener
2021-01-21 15:27:31 +07:00
committed by GitHub
parent 36b8695bf6
commit 95b482d5d5
9 changed files with 63 additions and 407 deletions

View File

@@ -142,54 +142,6 @@
jmp *optable(,%eax,4)
.end
/////////////////////////////
//
// Arithmetic code speedups
//
// Assume edi & esi are arguments
//
// ebx is result.
//
////////////////////////////////
.inline Xiplus32,0
addl %edi,%esi
jo iplus_err
movl %esi,%eax
.end
.inline Xiplus32n,0
leal (%edi),%eax
addl %esi,%eax
jo iplusn_err
.end
.inline Xplus32,0
leal (%edi),%eax
addl %esi,%eax
jo plus_err
.end
.inline Xsub32,0
leal (%edi),%eax
subl %esi,%eax
jo diff_err
.end
.inline Xisub32,0
leal (%edi),%eax
subl %esi,%eax
jo idiff_err
.end
.inline Xisub32n,0
leal (%edi),%eax
subl %esi,%eax
jo idiffn_err
.end
.inline plus_err_label,0
plus_err:
.end