[llvm-bugs] [Bug 28112] New: [x86] _mm_cmp_ps (and related FP compare intrinsics) should not be available without AVX

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jun 13 10:35:34 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=28112

            Bug ID: 28112
           Summary: [x86] _mm_cmp_ps (and related FP compare intrinsics)
                    should not be available without AVX
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: spatel+llvm at rotateright.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Taking the example from bug 28110:

$ cat avx_oeq.c 
#include <immintrin.h>
#include <stdio.h>

int main() {
  // Init to NAN vals.
  __m128i a = _mm_set1_epi32(0x7f800001);
  __m128i b = _mm_set1_epi32(0x7f800001);
  __m128 cmp = _mm_cmp_ps((__m128)a, (__m128)b, 0);
  printf("cmpeq  nan: %d\n", _mm_movemask_ps(cmp));

  cmp = _mm_cmp_ps((__m128)a, (__m128)b, 8);
  printf("cmpeq8 nan: %d\n", _mm_movemask_ps(cmp));

  return 0;
}

The general FP compare intrinsics probably should not be accepted without AVX.
Currently, we can get subtly strange/wrong behavior:

$ ./clang -v
clang version 3.9.0 (trunk 272510)
Target: x86_64-apple-darwin15.5.0
Thread model: posix
InstalledDir: /Users/spatel/myllvm/build/bin/.

$ ./clang avx_oeq.c ; ./a.out
cmpeq  nan: 0
cmpeq8 nan: 0

$ ./clang avx_oeq.c -mavx ; ./a.out
cmpeq  nan: 0
cmpeq8 nan: 15

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160613/4251d2cb/attachment-0001.html>


More information about the llvm-bugs mailing list