[cfe-dev] Fwd: [cfe-users] floor is vectorized, but not sin, cos or exp
Jonas Toth via cfe-dev
cfe-dev at lists.llvm.org
Tue Dec 11 08:28:38 PST 2018
I am forwarding this to cfe-dev as it might this sounds like a bug and
cfe-users is not read that much.
-------- Weitergeleitete Nachricht --------
Betreff: [cfe-users] floor is vectorized, but not sin, cos or exp
Datum: Tue, 11 Dec 2018 16:47:16 +0100
Von: Klaus Leppkes via cfe-users <cfe-users at lists.llvm.org>
Antwort an: Klaus Leppkes <klaus.leppkes at rwth-aachen.de>
An: cfe-users at lists.llvm.org
Hi,
according to the doc
(https://releases.llvm.org/7.0.0/docs/Vectorizers.html) floor, sin, cos
should be vectorized.
I can confirm (using the great https://gcc.godbolt.org/ tool) that using
the flags "-Ofast -mavx2 -fopenmp -ffast-math" the right avx2 opcode
(vroundps) is emited for floor (in foo), but unfortunately not for sin,
cos or exp (e.g. see sin in bar below).
GCC 8.1+ and the Intel Compiler icc 13+ insert call to vectorized
implementations (_ZGVbN4v_sinf or __svml_sinf4 ), but clang seems to
have nothing like this.
Here is my small testcode:
#include<cmath>
voidfoo(float* __restrict__attribute((aligned(32))) x
, float* __restrict__attribute((aligned(32))) y) {
for(inti = 0; i < 4; ++i)
y[i] = floor(x[i]);
}
voidbar(float* __restrict__attribute((aligned(32))) x
, float* __restrict__attribute((aligned(32))) y) {
for(inti = 0; i < 4; ++i)
y[i] = sin(x[i]);
}
I have reproduced this behavior on different machines. Maybe I am doing
s.th. wrong here, but it seems like there is no vectorized
implementation for sin, cos etc. I am using h2lib for now
(http://h2lib.org/doc/d1/d89/simd__avx_8h_source.html) as a workaround,
but I expect clang to do this job.
Can anybody comment on this please?
Cheers
Klaus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20181211/a1ebdfb6/attachment.html>
-------------- next part --------------
_______________________________________________
cfe-users mailing list
cfe-users at lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users
More information about the cfe-dev
mailing list