Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clang++: abs of float vector comes out zero #31

Open
kfjahnke opened this issue Jun 21, 2021 · 0 comments
Open

clang++: abs of float vector comes out zero #31

kfjahnke opened this issue Jun 21, 2021 · 0 comments

Comments

@kfjahnke
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant