[clang] [CIR] Upstream vec shuffle builtins in CIR codegen (PR #169178)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 26 15:47:58 PST 2025


================
@@ -0,0 +1,113 @@
+// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o %t.cir
+// RUN: FileCheck --input-file=%t.cir %s
+
+// Test that __builtin_ia32_pshufd and __builtin_ia32_vpermilp generates correct CIR vec.shuffle operations
----------------
andykaylor wrote:

It's not clear to me why these tests shouldn't just go in one of the other test files. You're using a different form of the builtins than is usually called directly, but they can be tested using the standard Intel intrinsics. For example, `__builtin_ia32_pshufd` is wrapped by `_mm_shuffle_epi32` which is called from `clang/test/CodeGen/X86/sse2-builtins.c` in the classic codegen tests.

In each case, if you search the clang source code for the builtin you're using here, you should find a wrapper or preprocessor define in one of the `*intrin.h` files and a call to that wrapper in one of the classic codegen tests.

https://github.com/llvm/llvm-project/pull/169178


More information about the cfe-commits mailing list