[PATCH] D37562: [X86] Lower _mm[256|512]_[mask[z]]_avg_epu[8|16] intrinsics to native llvm IR

Matthias Braun via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 20 17:36:12 PDT 2017


MatzeB added a comment.

With this commit some (old) code stops to compile as it seems to remove some builtins, was that intentional?

Reproducer:

  typedef long long __m128i __attribute__((__vector_size__(16)));
  typedef short __v8hi __attribute__((__vector_size__(16)));
  typedef char __v16qi __attribute__((__vector_size__(16)));
  
  __m128i __attribute__((__always_inline__, __nodebug__))
  _mm_avg_epu8(__m128i a, __m128i b)
  {
    return (__m128i)__builtin_ia32_pavgb128((__v16qi)a, (__v16qi)b);
  }
  
  __m128i __attribute__((__always_inline__, __nodebug__))
  _mm_avg_epu16(__m128i a, __m128i b)
  {
    return (__m128i)__builtin_ia32_pavgw128((__v8hi)a, (__v8hi)b);
  }



  $ clang t.c
  /Users/mbraun/t.c:8:19: error: use of unknown builtin '__builtin_ia32_pavgb128'
        [-Wimplicit-function-declaration]
    return (__m128i)__builtin_ia32_pavgb128((__v16qi)a, (__v16qi)b);
                    ^
  /Users/mbraun/t.c:8:10: error: invalid conversion between vector type '__m128i'
        (vector of 2 'long long' values) and integer type 'int' of different size
    return (__m128i)__builtin_ia32_pavgb128((__v16qi)a, (__v16qi)b);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /Users/mbraun/t.c:14:19: error: use of unknown builtin '__builtin_ia32_pavgw128'
        [-Wimplicit-function-declaration]
    return (__m128i)__builtin_ia32_pavgw128((__v8hi)a, (__v8hi)b);
                    ^
  /Users/mbraun/t.c:14:10: error: invalid conversion between vector type '__m128i'
        (vector of 2 'long long' values) and integer type 'int' of different size
    return (__m128i)__builtin_ia32_pavgw128((__v8hi)a, (__v8hi)b);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  4 errors generated.


Repository:
  rL LLVM

https://reviews.llvm.org/D37562





More information about the cfe-commits mailing list