[clang] [llvm] [RISCV][P-ext] Add scalar merge intrinsics (PR #239119)

Sam Elliott via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 10 18:06:08 PST 2026


================
@@ -983,6 +983,31 @@ __riscv_wzip16p_64(uint32_t __rs1, uint32_t __rs2) {
   return (uint64_t)__riscv_pzip_u16x4((uint16x2_t)__rs1, (uint16x2_t)__rs2);
 }
 
+/* Scalar Merge */
+static __inline__ int32_t __DEFAULT_FN_ATTRS
+__riscv_merge_i32(int32_t __rs1, int32_t __rs2, uint32_t __rd) {
+  return (int32_t)__builtin_riscv_merge_u32((uint32_t)__rs1, (uint32_t)__rs2,
+                                            __rd);
----------------
lenary wrote:

> We already added the intrinsics for vector should we revisit that?

Potentially! Vector has more scalable intrinsics anyway.

Also apparently I'm wrong about `__builtin_ct_select` existing, that work has stalled at the RFC stage... 

Yeah let's try and file the issues we already see with kito's expression not becoming `merge`. They should be small self-contained examples we can potentially tag as good-first-issue? I'll let you decide on that, but it does sound like you have some examples in mind already.

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


More information about the cfe-commits mailing list