[clang] [X86] Finely handle target of __builtin_ia32_cmp[p|s][s|d] from avx into sse/sse2/avx (PR #84136)
Freddy Ye via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 6 03:49:53 PST 2024
================
@@ -2613,6 +2614,24 @@ void CGBuilderInserter::InsertHelper(
// called function.
void CodeGenFunction::checkTargetFeatures(const CallExpr *E,
const FunctionDecl *TargetDecl) {
+ // SemaCheking cannot handle below x86 builtins because they have different
+ // parameter ranges with different TargetAttribute of caller.
----------------
FreddyLeaf wrote:
Semachecking doesn't have the information of the caller of the intrinsic. While here we require to know if caller has "avx" or not when the condition code is [8, 31].
Considering such case:
```
#include <immintrin.h>
__attribute__((target("sse2")))
__m128 test1(__m128 a, __m128 b) {
return _mm_cmp_ps(a, b, 14); // shouldn't report error.
}
__attribute__((target("avx")))
__m128 test2(__m128 a, __m128 b) {
return _mm_cmp_ps(a, b, 14); // should report error.
}
https://github.com/llvm/llvm-project/pull/84136
More information about the cfe-commits
mailing list