clang++: abs of float vector comes out zero
kfjahnke opened this issue · comments
kfjahnke commented
clang++ (clang version 10.0.0-4ubuntu1) yields zero when abs() is called with a float vector. Here's code to reproduce the error:
#include <iostream>
#include <experimental/simd>
int main ( int argc , char * argv[] )
{
std::experimental::simd
< float ,
std::experimental::simd_abi::fixed_size < 2 >
> x ;
x[0] = -1.0f ;
x[1] = 1.0f ;
auto y = abs ( x ) ;
for ( int i = 0 ; i < 2 ; i++ )
{
std::cout << "x[" << i << "] : " << x[i] << " -> " ;
std::cout << "y[" << i << "] : " << y[i] << std::endl ;
}
}
Actual Results
compiling with clang I get the error:
$ clang++ -std=c++17 stdsimd_abs.cc
$ ./a.out
x[0] : -1 -> y[0] : 0
x[1] : 1 -> y[1] : 0
Expected Results
g++ yields the correct result.
$ g++ -std=c++17 stdsimd_abs.cc
$ ./a.out
x[0] : -1 -> y[0] : 1
x[1] : 1 -> y[1] : 1
Kay