https://github.com/zayeralam updated 
https://github.com/llvm/llvm-project/pull/217326

>From f400a5caed99b7e1b3342cf3b72894d9f1db59c1 Mon Sep 17 00:00:00 2001
From: Mohammed Zayer Alam <[email protected]>
Date: Wed, 19 Aug 2026 17:49:44 +0530
Subject: [PATCH 1/4] [CIR] [X86] Add support for vfmadd and vfmaddsub
 builtins.

---
 clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp 
b/clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp
index 27dc8b1c7d889..a3c86b9c5da40 100644
--- a/clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp
@@ -52,6 +52,10 @@ static bool shouldEmitBuiltinAsIR(unsigned builtinID,
     case Builtin::BI__builtin_scalbnf:
     case Builtin::BIscalbn:
     case Builtin::BI__builtin_scalbn:
+    case Builtin::BI__builtin_ia32_vfmaddpd:
+    case Builtin::BI__builtin_ia32_vfmaddps:
+    case Builtin::BI__builtin_ia32_vfmaddsubpd:
+    case Builtin::BI__builtin_ia32_vfmaddsubps:
       return true;
     }
   }

>From 8b8e3011da4979aa287d9a92709d50fbd705c3f2 Mon Sep 17 00:00:00 2001
From: Mohammed Zayer Alam <[email protected]>
Date: Wed, 19 Aug 2026 21:11:40 +0530
Subject: [PATCH 2/4] [CIR] [X86] Add test cases for vfmadd and vfmaddsub
 builtins.

---
 clang/test/CIR/CodeGen/builtins-x86.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/clang/test/CIR/CodeGen/builtins-x86.c 
b/clang/test/CIR/CodeGen/builtins-x86.c
index 4f72a3000fc44..105328bb2d918 100644
--- a/clang/test/CIR/CodeGen/builtins-x86.c
+++ b/clang/test/CIR/CodeGen/builtins-x86.c
@@ -313,4 +313,11 @@ double test_fma_f64(double a, double b, double c) {
   // OGCG: %[[R:.*]] = call double @llvm.fma.f64(double %[[A:.*]], double 
%[[B:.*]], double %[[C:.*]])
   return __builtin_fma(a, b, c);
 }
+void test_vfmadd(double a, double b, double c){
+  //CIR-LABEL:test_vfmadd
+  __builtin_ia32_vfmaddpd(a,b,c);
+  __builtin_ia32_vfmaddps(a,b,C);
+  __builtin_ia32_vfmaddsubpd(a,b,C);
+  __builtin_ia32_vfmaddsubps(a,b,c);
+}
 

>From 07a4657e3b5e10a463eeb062331c693f1527da94 Mon Sep 17 00:00:00 2001
From: Mohammed Zayer Alam <[email protected]>
Date: Wed, 19 Aug 2026 21:43:53 +0530
Subject: [PATCH 3/4] [CIR] [X86] Add FileCheck assertions to vf madd tests..

---
 clang/test/CIR/CodeGen/builtins-x86.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/clang/test/CIR/CodeGen/builtins-x86.c 
b/clang/test/CIR/CodeGen/builtins-x86.c
index 105328bb2d918..0d87528e42ff0 100644
--- a/clang/test/CIR/CodeGen/builtins-x86.c
+++ b/clang/test/CIR/CodeGen/builtins-x86.c
@@ -313,11 +313,15 @@ double test_fma_f64(double a, double b, double c) {
   // OGCG: %[[R:.*]] = call double @llvm.fma.f64(double %[[A:.*]], double 
%[[B:.*]], double %[[C:.*]])
   return __builtin_fma(a, b, c);
 }
-void test_vfmadd(double a, double b, double c){
-  //CIR-LABEL:test_vfmadd
-  __builtin_ia32_vfmaddpd(a,b,c);
-  __builtin_ia32_vfmaddps(a,b,C);
-  __builtin_ia32_vfmaddsubpd(a,b,C);
-  __builtin_ia32_vfmaddsubps(a,b,c);
-}
+// CHECK-LABEL: cir.func @test_vfmadd
+// CHECK: cir.call @__builtin_ia32_vfmaddpd
+// CHECK: cir.call @__builtin_ia32_vfmaddps
+// CHECK: cir.call @__builtin_ia32_vfmaddsubpd
+// CHECK: cir.call @__builtin_ia32_vfmaddsubps
+void test_vfmadd(double a, double b, double c) {
+  __builtin_ia32_vfmaddpd(a, b, c);
+    __builtin_ia32_vfmaddps(a, b, c);
+      __builtin_ia32_vfmaddsubpd(a, b, c);
+        __builtin_ia32_vfmaddsubps(a, b, c);
+        }
 

>From d3ce6a7b9c6908695e9a1f46979638cec0c75a2b Mon Sep 17 00:00:00 2001
From: Mohammed Zayer Alam <[email protected]>
Date: Thu, 20 Aug 2026 19:55:46 +0530
Subject: [PATCH 4/4] Fix CIR gen for x86 vfmadd builtins and add test case.

---
 clang/lib/CIR/CodeGen/CIRGenBuiltinX86.cpp |  4 ++++
 clang/test/CIR/CodeGen/builtins-x86.c      | 23 +++++++++++-----------
 2 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/clang/lib/CIR/CodeGen/CIRGenBuiltinX86.cpp 
b/clang/lib/CIR/CodeGen/CIRGenBuiltinX86.cpp
index 09c60b4d21f7a..fd8378290e916 100644
--- a/clang/lib/CIR/CodeGen/CIRGenBuiltinX86.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenBuiltinX86.cpp
@@ -1391,6 +1391,10 @@ CIRGenFunction::emitX86BuiltinExpr(unsigned builtinID, 
const CallExpr *expr) {
   case X86::BI__builtin_ia32_vcvtuw2ph512_mask:
   case X86::BI__builtin_ia32_vcvtudq2ph512_mask:
   case X86::BI__builtin_ia32_vcvtuqq2ph512_mask:
+  case X86::BI__builtin_ia32_vfmaddpd:
+  case X86::BI__builtin_ia32_vfmaddps:
+  case X86::BI__builtin_ia32_vfmaddsubpd:
+  case X86::BI__builtin_ia32_vfmaddsubps:
   case X86::BI__builtin_ia32_vfmaddsh3_mask:
   case X86::BI__builtin_ia32_vfmaddss3_mask:
   case X86::BI__builtin_ia32_vfmaddsd3_mask:
diff --git a/clang/test/CIR/CodeGen/builtins-x86.c 
b/clang/test/CIR/CodeGen/builtins-x86.c
index 0d87528e42ff0..3538c457582f6 100644
--- a/clang/test/CIR/CodeGen/builtins-x86.c
+++ b/clang/test/CIR/CodeGen/builtins-x86.c
@@ -313,15 +313,16 @@ double test_fma_f64(double a, double b, double c) {
   // OGCG: %[[R:.*]] = call double @llvm.fma.f64(double %[[A:.*]], double 
%[[B:.*]], double %[[C:.*]])
   return __builtin_fma(a, b, c);
 }
-// CHECK-LABEL: cir.func @test_vfmadd
-// CHECK: cir.call @__builtin_ia32_vfmaddpd
-// CHECK: cir.call @__builtin_ia32_vfmaddps
-// CHECK: cir.call @__builtin_ia32_vfmaddsubpd
-// CHECK: cir.call @__builtin_ia32_vfmaddsubps
-void test_vfmadd(double a, double b, double c) {
-  __builtin_ia32_vfmaddpd(a, b, c);
-    __builtin_ia32_vfmaddps(a, b, c);
-      __builtin_ia32_vfmaddsubpd(a, b, c);
-        __builtin_ia32_vfmaddsubps(a, b, c);
-        }
+void test_vfmadd(__m128d a, __m128d b, __m128d c) {
+    // CIR-LABEL: cl.func @test_vfmadd
+      // CIR: cir.call @_builtin_ia32_vfmaddpd
+        // LLVM-LABEL: @test_vfmadd
+          // LLVM: call <2 x double> @llvm.x86.fma.vfmadd.pd
+            // OGCG-LABEL: @test_vfmadd
+              // OGCG: call <2 x double> @llvm.x86.fma.vfmadd.pd
+                __builtin_ia32_vfmaddpd(a, b, c);
+                }
+              
+
+
 

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to