Skip to content

Conversation

@cs25mtech12008
Copy link

@cs25mtech12008 cs25mtech12008 commented Nov 26, 2025

Added builtin support for the multishift operation with test file.

changes has been done in CIRGenBuiltinX86 file
please review the changes and suggest if anything is missing

Added builtin support for the multishift operation with test file.

changes has been done in CIRGenBuiltinX86 file
@github-actions
Copy link

Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this page.

If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using @ followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers.

If you have further questions, they may be answered by the LLVM GitHub User Guide.

You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums.

@llvmbot llvmbot added clang Clang issues not falling into any other category ClangIR Anything related to the ClangIR project labels Nov 26, 2025
@llvmbot
Copy link
Member

llvmbot commented Nov 26, 2025

@llvm/pr-subscribers-clangir

@llvm/pr-subscribers-clang

Author: Omkar Rasal (cs25mtech12008)

Changes

Added builtin support for the multishift operation with test file.

changes has been done in CIRGenBuiltinX86 file


Full diff: https://github.com/llvm/llvm-project/pull/169618.diff

2 Files Affected:

  • (modified) clang/lib/CIR/CodeGen/CIRGenBuiltinX86.cpp (+7)
  • (added) clang/test/CIR/CodeGen/X86/builtin_multishift.c (+11)
diff --git a/clang/lib/CIR/CodeGen/CIRGenBuiltinX86.cpp b/clang/lib/CIR/CodeGen/CIRGenBuiltinX86.cpp
index e7aa8a234efd9..4cbeecf0d8ea3 100644
--- a/clang/lib/CIR/CodeGen/CIRGenBuiltinX86.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenBuiltinX86.cpp
@@ -877,9 +877,16 @@ mlir::Value CIRGenFunction::emitX86BuiltinExpr(unsigned builtinID,
   case X86::BI__builtin_ia32_vp2intersect_d_512:
   case X86::BI__builtin_ia32_vp2intersect_d_256:
   case X86::BI__builtin_ia32_vp2intersect_d_128:
+    cgm.errorNYI(expr->getSourceRange(),
+                 std::string("unimplemented X86 builtin call: ") +
+                     getContext().BuiltinInfo.getName(builtinID));
+    return {};
   case X86::BI__builtin_ia32_vpmultishiftqb128:
+    return emitIntrinsicCallOp(*this, expr, "x86_avx512_pmultishift_qb_128", ops[0].getType(), ops);
   case X86::BI__builtin_ia32_vpmultishiftqb256:
+    return emitIntrinsicCallOp(*this, expr, "x86_avx512_pmultishift_qb_256", ops[0].getType(), ops);
   case X86::BI__builtin_ia32_vpmultishiftqb512:
+    return emitIntrinsicCallOp(*this, expr, "x86_avx512_pmultishift_qb_512", ops[0].getType(), ops);
   case X86::BI__builtin_ia32_vpshufbitqmb128_mask:
   case X86::BI__builtin_ia32_vpshufbitqmb256_mask:
   case X86::BI__builtin_ia32_vpshufbitqmb512_mask:
diff --git a/clang/test/CIR/CodeGen/X86/builtin_multishift.c b/clang/test/CIR/CodeGen/X86/builtin_multishift.c
new file mode 100644
index 0000000000000..7c57ef3191d1d
--- /dev/null
+++ b/clang/test/CIR/CodeGen/X86/builtin_multishift.c
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -target-feature +avx512vbmi \
+// RUN:   -fclangir -emit-cir %s -o - | FileCheck %s
+
+#include <immintrin.h>
+__m512i test_multishift(__m512i x, __m512i y) {
+  return _mm512_multishift_epi64_epi8(x, y);
+}
+
+// // CHECK: cir.func @test_multishift
+// // CHECK: cir.call @__builtin_ia32_vpmultishiftqb512
+

@cs25mtech12008 cs25mtech12008 marked this pull request as ready for review November 28, 2025 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang Clang issues not falling into any other category ClangIR Anything related to the ClangIR project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants