[clang] [X86][Clang] VectorExprEvaluator::VisitCallExpr / InterpretBuiltin - Allow AVX/AVX512 IFMA madd52 intrinsics to be used in constexpr (PR #161056)
    NagaChaitanya Vellanki via cfe-commits 
    cfe-commits at lists.llvm.org
       
    Thu Oct  9 13:13:22 PDT 2025
    
    
  
================
@@ -8,53 +8,221 @@
 // RUN: %clang_cc1 -x c++ -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +avxifma -emit-llvm -o - -Wall -Werror -fexperimental-new-constant-interpreter | FileCheck %s
 // RUN: %clang_cc1 -x c++ -ffreestanding %s -triple=i386-apple-darwin -target-feature +avxifma -emit-llvm -o - -Wall -Werror -fexperimental-new-constant-interpreter | FileCheck %s
 
-
 #include <immintrin.h>
+#include "builtin_test_helpers.h"
+
 
+__attribute__((target("avx512ifma,avx512vl")))
----------------
chaitanyav wrote:
i think i understand why, previously it was a macro, now it's a static function. That is why we need the `__attribute__`
```c++
#define _mm_madd52hi_epu64(X, Y, Z)                                            \
  ((__m128i)__builtin_ia32_vpmadd52huq128((__v2di)(X), (__v2di)(Y),            \
                                          (__v2di)(Z)))
```
```c++
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_madd52hi_epu64(__m128i __X, __m128i __Y, __m128i __Z) {
  return (__m128i)__builtin_ia32_vpmadd52huq128((__v2di)__X, (__v2di)__Y,
                                                (__v2di)__Z);
}
```
https://github.com/llvm/llvm-project/pull/161056
    
    
More information about the cfe-commits
mailing list