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

NEON/AdvSIMD comparison intrinsics #754

Closed
valpackett opened this issue May 6, 2019 · 4 comments
Closed

NEON/AdvSIMD comparison intrinsics #754

valpackett opened this issue May 6, 2019 · 4 comments

Comments

@valpackett
Copy link
Contributor

… are not LLVM intrinsics, they're represented in IR as icmp and literally written as just < in C:

// arm_neon.h
#ifdef __LITTLE_ENDIAN__
__ai uint32x4_t vcltq_u32(uint32x4_t __p0, uint32x4_t __p1) {
  uint32x4_t __ret;
  __ret = (uint32x4_t)(__p0 < __p1);
  return __ret;
// ...
  uint32x4_t a, b, c = vcltq_u32(a, b);
  %cmp.i = icmp ult <4 x i32> %2, %3
  %sext.i = sext <4 x i1> %cmp.i to <4 x i32>
  cmhi   v0.4s, v1.4s, v0.4s

Is it possible to emit this w/o inline assembly right now? I don't see a comparison implementation for these types…

cc #148

@valpackett
Copy link
Contributor Author

ah, simd_lt works. I guess I should implement these missing intrinsics using these simd_llvm things to make it public API.

@gnzlbg
Copy link
Contributor

gnzlbg commented May 6, 2019

Yeah, check out the llvm module for the current "generic" simd_ intrinsics that are available. There might be a couple more that are not used in stdsimd yet, so if you need anything that's not there, let us know here.

@sunnygleason
Copy link

FWIW, if you like the 1:1 correspondence with intrinsic names, I think a bunch of these intrinsics (and more) are implemented in #792 ... See https://github.com/rust-lang/stdarch/pull/792/files#diff-66d90852ae58a548e0a34d1cb5e481ecR881

Maybe your 👍 could help it get merged... :)

@valpackett
Copy link
Contributor Author

@sunnygleason amazing work, I'll look into it later

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

3 participants