1

Specifically, we're looking to know what would be a good ARMv7+NEON implementation for unsigned 64-bit comparison for possible inclusion into the WebAssembly SIMD standard. Unlike ARM64 which has CMHS, this doesn't have a native instruction on ARMv7. However, we received a remarkable result for the sister question to this:

What is the most efficient way to support CMGT with 64bit signed comparisons on ARMv7a with Neon?

Dan Weber
  • 401
  • 2
  • 9
  • 1
    How do you want to get the result of the comparison - a boolean (0/1, or 0/-1?) in a SIMD register, or in an integer register, or setting the NZCV flags, or a conditional branch, or ??? – Nate Eldredge Dec 24 '20 at 19:06
  • @NateEldredge: Based on previous questions from the OP, they're considering a SIMD primitive operation as part of WebAssembly, so I assume they're thinking about a SIMD result. That would normally be 0 / -1 like comparison primitives that do have hardware support. Although on x86 it's only available in HW from AVX512 which produces a mask register result (bitmap, not vector). Designs for new SIMD abstraction layers might want to consider ways to work efficiently with mask-reg or vector compare results if they care about exposing AVX-512 stuff (like unsigned integer compare). – Peter Cordes Dec 24 '20 at 20:47
  • At worst, unsigned greater-than-or-equal-to is `vqsubq_u64(b, a) == 0` and unsigned greater-than is `(vqsubq_s64(b, a) ^ (a ^ b)) < 0`. – aqrit Dec 25 '20 at 00:14
  • Remember that we don't have cmgt on ARMv7+neon. We're proposing your variant. – Dan Weber Dec 25 '20 at 00:44
  • Remember `x < 0` is `vshrq_n_s64(x, 63)` – aqrit Dec 25 '20 at 00:49
  • Okay, can you post that unsigned greater than solution as an answer? – Dan Weber Dec 25 '20 at 00:59

0 Answers0