This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: sqrt via SSE2 registers


> Isn't this library issue? Some glibc redefine the sqrt as asm statement.

Ah, that sounds right. When I remove the "#include <math.h>" from the start
of my test case, or compile with -D__NO_MATH_INLINES, I get the expected
output using sqrtsd.

Of course, -D__NO_MATH_INLINES is rather a blunt implement, particularly if
the code also uses (say) trigonometric functions; is there any way short of
editing /usr/include/bits/mathinline.h to get sqrt() alone generated with
SSE2 instructions?

There's then the issue, though it's probably more one for the next glibc
release after gcc-3.1 appears, of whether a sin() implementation using SSE2
code and a suitable rational-function approximation could get adequate
results in less than the 190-or-so cycles that fsin takes: I'm pretty sure
it's possible, even given that the necessary two divides can't take less
than 70 ticks and that one might want a table-lookup for argument reduction.

Annoyingly, I suspect Intel have done this already though not under a
GPL-compatible license: see "The Computation of Transcendental Functions on
the IA-64 Architecture", Intel Technology Journal 1999Q4, and their Vector
Math Library.

Tom



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]