Add an error when calling a builtin that requires features that don't
match the feature set of the function that they're being called from. This ensures that we can effectively diagnose some[1] code that would instead ICE in the backend with a failure to select message. Example: __m128d foo(__m128d a, __m128d b) { return __builtin_ia32_addsubps(b, a); } compiled for normal x86_64 via: clang -target x86_64-linux-gnu -c would fail to compile in the back end because the normal subtarget features for x86_64 only include sse2 and the builtin requires sse3. [1] We're still not erroring on: __m128i bar(__m128i const *p) { return _mm_lddqu_si128(p); } where we should fail and error on an always_inline function being inlined into a function that doesn't support the subtarget features required. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@250473 91177308-0d34-0410-b5e6-96231b3b80d8
Showing
- include/clang/Basic/DiagnosticSemaKinds.td 1 addition, 0 deletionsinclude/clang/Basic/DiagnosticSemaKinds.td
- lib/CodeGen/CGBuiltin.cpp 67 additions, 0 deletionslib/CodeGen/CGBuiltin.cpp
- lib/CodeGen/CGCall.cpp 1 addition, 0 deletionslib/CodeGen/CGCall.cpp
- lib/CodeGen/CodeGenFunction.h 2 additions, 0 deletionslib/CodeGen/CodeGenFunction.h
- test/CodeGen/target-builtin-error-2.c 13 additions, 0 deletionstest/CodeGen/target-builtin-error-2.c
- test/CodeGen/target-builtin-error.c 8 additions, 0 deletionstest/CodeGen/target-builtin-error.c
- test/CodeGen/target-builtin-noerror.c 30 additions, 0 deletionstest/CodeGen/target-builtin-noerror.c
Loading
Please register or sign in to comment