Author: Brendan Dahl
Date: 2026-05-27T09:58:16-07:00
New Revision: f8bf8af12c810434ca1d947aeb9bcae99bbbf135

URL: 
https://github.com/llvm/llvm-project/commit/f8bf8af12c810434ca1d947aeb9bcae99bbbf135
DIFF: 
https://github.com/llvm/llvm-project/commit/f8bf8af12c810434ca1d947aeb9bcae99bbbf135.diff

LOG: [WebAssembly] Add f16x8.demote_f32x4_zero to wasm_simd128.h. (#199795)

Missing header intrinsic.

Added: 
    

Modified: 
    clang/lib/Headers/wasm_simd128.h
    cross-project-tests/intrinsic-header-tests/wasm_simd128.c

Removed: 
    


################################################################################
diff  --git a/clang/lib/Headers/wasm_simd128.h 
b/clang/lib/Headers/wasm_simd128.h
index 1e6da28c052a0..b4b8e4667a8ae 100644
--- a/clang/lib/Headers/wasm_simd128.h
+++ b/clang/lib/Headers/wasm_simd128.h
@@ -2019,6 +2019,14 @@ wasm_f32x4_promote_low_f16x8(v128_t __a) {
       __f32x4);
 }
 
+static __inline__ v128_t __FP16_FN_ATTRS
+wasm_f16x8_demote_f32x4_zero(v128_t __a) {
+  return (v128_t) __builtin_convertvector(
+      __builtin_shufflevector((__f32x4)__a, (__f32x4){0, 0, 0, 0}, 0, 1, 2, 3,
+                              4, 5, 6, 7),
+      __f16x8);
+}
+
 static __inline__ v128_t __FP16_FN_ATTRS wasm_f16x8_relaxed_madd(v128_t __a,
                                                                  v128_t __b,
                                                                  v128_t __c) {

diff  --git a/cross-project-tests/intrinsic-header-tests/wasm_simd128.c 
b/cross-project-tests/intrinsic-header-tests/wasm_simd128.c
index b0bea4cb9d60f..fcc89aff9d503 100644
--- a/cross-project-tests/intrinsic-header-tests/wasm_simd128.c
+++ b/cross-project-tests/intrinsic-header-tests/wasm_simd128.c
@@ -1039,6 +1039,12 @@ v128_t test_f32x4_promote_low_f16x8(v128_t a) {
   return wasm_f32x4_promote_low_f16x8(a);
 }
 
+// CHECK-LABEL: test_f16x8_demote_f32x4_zero:
+// CHECK: f16x8.demote_f32x4_zero{{$}}
+v128_t test_f16x8_demote_f32x4_zero(v128_t a) {
+  return wasm_f16x8_demote_f32x4_zero(a);
+}
+
 // CHECK-LABEL: test_i8x16_shuffle:
 // CHECK: i8x16.shuffle 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1,
 // 0{{$}}


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

Reply via email to