aarch64: add single instruction math functions
authorSzabolcs Nagy <nsz@port70.net>
Sun, 19 Mar 2017 04:26:45 +0000 (05:26 +0100)
committerRich Felker <dalias@aerifal.cx>
Tue, 21 Mar 2017 16:39:18 +0000 (12:39 -0400)
commit54807d47acecab778498ced88ce8f62bfa16e379
tree2203cc44d6061f092dd104ef6f89d4f2ca9fa1d7
parentb6e1fe0d5e78dac647e85d49c2d537bb071ba49e
aarch64: add single instruction math functions

this should increase performance and reduce code size on aarch64.

the compiled code was checked against using __builtin_* instead
of inline asm with gcc-6.2.0.

lrint is two instructions.

c with inline asm is used because it is safer than a pure asm
implementation, this prevents ll{rint,round} to be an alias
of l{rint,round} (because the types don't match) and depends
on gcc style inline asm support.

ceil, floor, round, trunc can either raise inexact on finite
non-integer inputs or not raise any exceptions. the new
implementation does not raise exceptions while the generic
c code does.

on aarch64, the underflow exception is signaled before rounding
(ieee 754 allows both before and after rounding, but it must be
consistent), the generic fma c code signals it after rounding
so using single instruction fixes a slight conformance issue too.
34 files changed:
src/math/aarch64/ceil.c [new file with mode: 0644]
src/math/aarch64/ceilf.c [new file with mode: 0644]
src/math/aarch64/fabs.c [new file with mode: 0644]
src/math/aarch64/fabs.s [deleted file]
src/math/aarch64/fabsf.c [new file with mode: 0644]
src/math/aarch64/fabsf.s [deleted file]
src/math/aarch64/floor.c [new file with mode: 0644]
src/math/aarch64/floorf.c [new file with mode: 0644]
src/math/aarch64/fma.c [new file with mode: 0644]
src/math/aarch64/fmaf.c [new file with mode: 0644]
src/math/aarch64/fmax.c [new file with mode: 0644]
src/math/aarch64/fmaxf.c [new file with mode: 0644]
src/math/aarch64/fmin.c [new file with mode: 0644]
src/math/aarch64/fminf.c [new file with mode: 0644]
src/math/aarch64/llrint.c [new file with mode: 0644]
src/math/aarch64/llrintf.c [new file with mode: 0644]
src/math/aarch64/llround.c [new file with mode: 0644]
src/math/aarch64/llroundf.c [new file with mode: 0644]
src/math/aarch64/lrint.c [new file with mode: 0644]
src/math/aarch64/lrintf.c [new file with mode: 0644]
src/math/aarch64/lround.c [new file with mode: 0644]
src/math/aarch64/lroundf.c [new file with mode: 0644]
src/math/aarch64/nearbyint.c [new file with mode: 0644]
src/math/aarch64/nearbyintf.c [new file with mode: 0644]
src/math/aarch64/rint.c [new file with mode: 0644]
src/math/aarch64/rintf.c [new file with mode: 0644]
src/math/aarch64/round.c [new file with mode: 0644]
src/math/aarch64/roundf.c [new file with mode: 0644]
src/math/aarch64/sqrt.c [new file with mode: 0644]
src/math/aarch64/sqrt.s [deleted file]
src/math/aarch64/sqrtf.c [new file with mode: 0644]
src/math/aarch64/sqrtf.s [deleted file]
src/math/aarch64/trunc.c [new file with mode: 0644]
src/math/aarch64/truncf.c [new file with mode: 0644]