2144 lines · c
1/*===---- wasm_simd128.h - WebAssembly portable SIMD intrinsics ------------===2 *3 * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4 * See https://llvm.org/LICENSE.txt for license information.5 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6 *7 *===-----------------------------------------------------------------------===8 */9 10#ifndef __WASM_SIMD128_H11#define __WASM_SIMD128_H12 13#include <stdbool.h>14#include <stdint.h>15 16// User-facing type17typedef int32_t v128_t __attribute__((__vector_size__(16), __aligned__(16)));18 19// Internal types determined by clang builtin definitions20typedef int32_t __v128_u __attribute__((__vector_size__(16), __aligned__(1)));21typedef signed char __i8x1622 __attribute__((__vector_size__(16), __aligned__(16)));23typedef unsigned char __u8x1624 __attribute__((__vector_size__(16), __aligned__(16)));25typedef short __i16x8 __attribute__((__vector_size__(16), __aligned__(16)));26typedef unsigned short __u16x827 __attribute__((__vector_size__(16), __aligned__(16)));28typedef int __i32x4 __attribute__((__vector_size__(16), __aligned__(16)));29typedef unsigned int __u32x430 __attribute__((__vector_size__(16), __aligned__(16)));31typedef long long __i64x2 __attribute__((__vector_size__(16), __aligned__(16)));32typedef unsigned long long __u64x233 __attribute__((__vector_size__(16), __aligned__(16)));34typedef float __f32x4 __attribute__((__vector_size__(16), __aligned__(16)));35typedef double __f64x2 __attribute__((__vector_size__(16), __aligned__(16)));36typedef __fp16 __f16x8 __attribute__((__vector_size__(16), __aligned__(16)));37 38typedef signed char __i8x8 __attribute__((__vector_size__(8), __aligned__(8)));39typedef unsigned char __u8x840 __attribute__((__vector_size__(8), __aligned__(8)));41typedef short __i16x4 __attribute__((__vector_size__(8), __aligned__(8)));42typedef unsigned short __u16x443 __attribute__((__vector_size__(8), __aligned__(8)));44typedef int __i32x2 __attribute__((__vector_size__(8), __aligned__(8)));45typedef unsigned int __u32x246 __attribute__((__vector_size__(8), __aligned__(8)));47typedef float __f32x2 __attribute__((__vector_size__(8), __aligned__(8)));48 49#define __DEFAULT_FN_ATTRS \50 __attribute__((__always_inline__, __nodebug__, __target__("simd128"), \51 __min_vector_width__(128)))52 53#define __REQUIRE_CONSTANT(c) \54 __attribute__((__diagnose_if__(!__builtin_constant_p(c), \55 #c " must be constant", "error")))56 57static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_v128_load(const void *__mem) {58 // UB-free unaligned access copied from xmmintrin.h59 struct __wasm_v128_load_struct {60 __v128_u __v;61 } __attribute__((__packed__, __may_alias__));62 return ((const struct __wasm_v128_load_struct *)__mem)->__v;63}64 65static __inline__ v128_t __DEFAULT_FN_ATTRS66wasm_v128_load8_splat(const void *__mem) {67 struct __wasm_v128_load8_splat_struct {68 uint8_t __v;69 } __attribute__((__packed__, __may_alias__));70 uint8_t __v = ((const struct __wasm_v128_load8_splat_struct *)__mem)->__v;71 return (v128_t)(__u8x16){__v, __v, __v, __v, __v, __v, __v, __v,72 __v, __v, __v, __v, __v, __v, __v, __v};73}74 75static __inline__ v128_t __DEFAULT_FN_ATTRS76wasm_v128_load16_splat(const void *__mem) {77 struct __wasm_v128_load16_splat_struct {78 uint16_t __v;79 } __attribute__((__packed__, __may_alias__));80 uint16_t __v = ((const struct __wasm_v128_load16_splat_struct *)__mem)->__v;81 return (v128_t)(__u16x8){__v, __v, __v, __v, __v, __v, __v, __v};82}83 84static __inline__ v128_t __DEFAULT_FN_ATTRS85wasm_v128_load32_splat(const void *__mem) {86 struct __wasm_v128_load32_splat_struct {87 uint32_t __v;88 } __attribute__((__packed__, __may_alias__));89 uint32_t __v = ((const struct __wasm_v128_load32_splat_struct *)__mem)->__v;90 return (v128_t)(__u32x4){__v, __v, __v, __v};91}92 93static __inline__ v128_t __DEFAULT_FN_ATTRS94wasm_v128_load64_splat(const void *__mem) {95 struct __wasm_v128_load64_splat_struct {96 uint64_t __v;97 } __attribute__((__packed__, __may_alias__));98 uint64_t __v = ((const struct __wasm_v128_load64_splat_struct *)__mem)->__v;99 return (v128_t)(__u64x2){__v, __v};100}101 102static __inline__ v128_t __DEFAULT_FN_ATTRS103wasm_i16x8_load8x8(const void *__mem) {104 struct __wasm_i16x8_load8x8_struct {105 __i8x8 __v;106 } __attribute__((__packed__, __may_alias__));107 __i8x8 __v = ((const struct __wasm_i16x8_load8x8_struct *)__mem)->__v;108 return (v128_t) __builtin_convertvector(__v, __i16x8);109}110 111static __inline__ v128_t __DEFAULT_FN_ATTRS112wasm_u16x8_load8x8(const void *__mem) {113 struct __wasm_u16x8_load8x8_struct {114 __u8x8 __v;115 } __attribute__((__packed__, __may_alias__));116 __u8x8 __v = ((const struct __wasm_u16x8_load8x8_struct *)__mem)->__v;117 return (v128_t) __builtin_convertvector(__v, __u16x8);118}119 120static __inline__ v128_t __DEFAULT_FN_ATTRS121wasm_i32x4_load16x4(const void *__mem) {122 struct __wasm_i32x4_load16x4_struct {123 __i16x4 __v;124 } __attribute__((__packed__, __may_alias__));125 __i16x4 __v = ((const struct __wasm_i32x4_load16x4_struct *)__mem)->__v;126 return (v128_t) __builtin_convertvector(__v, __i32x4);127}128 129static __inline__ v128_t __DEFAULT_FN_ATTRS130wasm_u32x4_load16x4(const void *__mem) {131 struct __wasm_u32x4_load16x4_struct {132 __u16x4 __v;133 } __attribute__((__packed__, __may_alias__));134 __u16x4 __v = ((const struct __wasm_u32x4_load16x4_struct *)__mem)->__v;135 return (v128_t) __builtin_convertvector(__v, __u32x4);136}137 138static __inline__ v128_t __DEFAULT_FN_ATTRS139wasm_i64x2_load32x2(const void *__mem) {140 struct __wasm_i64x2_load32x2_struct {141 __i32x2 __v;142 } __attribute__((__packed__, __may_alias__));143 __i32x2 __v = ((const struct __wasm_i64x2_load32x2_struct *)__mem)->__v;144 return (v128_t) __builtin_convertvector(__v, __i64x2);145}146 147static __inline__ v128_t __DEFAULT_FN_ATTRS148wasm_u64x2_load32x2(const void *__mem) {149 struct __wasm_u64x2_load32x2_struct {150 __u32x2 __v;151 } __attribute__((__packed__, __may_alias__));152 __u32x2 __v = ((const struct __wasm_u64x2_load32x2_struct *)__mem)->__v;153 return (v128_t) __builtin_convertvector(__v, __u64x2);154}155 156static __inline__ v128_t __DEFAULT_FN_ATTRS157wasm_v128_load32_zero(const void *__mem) {158 struct __wasm_v128_load32_zero_struct {159 int32_t __v;160 } __attribute__((__packed__, __may_alias__));161 int32_t __v = ((const struct __wasm_v128_load32_zero_struct *)__mem)->__v;162 return (v128_t)(__i32x4){__v, 0, 0, 0};163}164 165static __inline__ v128_t __DEFAULT_FN_ATTRS166wasm_v128_load64_zero(const void *__mem) {167 struct __wasm_v128_load64_zero_struct {168 int64_t __v;169 } __attribute__((__packed__, __may_alias__));170 int64_t __v = ((const struct __wasm_v128_load64_zero_struct *)__mem)->__v;171 return (v128_t)(__i64x2){__v, 0};172}173 174static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_v128_load8_lane(175 const void *__mem, v128_t __vec, int __i) __REQUIRE_CONSTANT(__i) {176 struct __wasm_v128_load8_lane_struct {177 int8_t __v;178 } __attribute__((__packed__, __may_alias__));179 int8_t __v = ((const struct __wasm_v128_load8_lane_struct *)__mem)->__v;180 __i8x16 __ret = (__i8x16)__vec;181 __ret[__i] = __v;182 return (v128_t)__ret;183}184 185static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_v128_load16_lane(186 const void *__mem, v128_t __vec, int __i) __REQUIRE_CONSTANT(__i) {187 struct __wasm_v128_load16_lane_struct {188 int16_t __v;189 } __attribute__((__packed__, __may_alias__));190 int16_t __v = ((const struct __wasm_v128_load16_lane_struct *)__mem)->__v;191 __i16x8 __ret = (__i16x8)__vec;192 __ret[__i] = __v;193 return (v128_t)__ret;194}195 196static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_v128_load32_lane(197 const void *__mem, v128_t __vec, int __i) __REQUIRE_CONSTANT(__i) {198 struct __wasm_v128_load32_lane_struct {199 int32_t __v;200 } __attribute__((__packed__, __may_alias__));201 int32_t __v = ((const struct __wasm_v128_load32_lane_struct *)__mem)->__v;202 __i32x4 __ret = (__i32x4)__vec;203 __ret[__i] = __v;204 return (v128_t)__ret;205}206 207static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_v128_load64_lane(208 const void *__mem, v128_t __vec, int __i) __REQUIRE_CONSTANT(__i) {209 struct __wasm_v128_load64_lane_struct {210 int64_t __v;211 } __attribute__((__packed__, __may_alias__));212 int64_t __v = ((const struct __wasm_v128_load64_lane_struct *)__mem)->__v;213 __i64x2 __ret = (__i64x2)__vec;214 __ret[__i] = __v;215 return (v128_t)__ret;216}217 218static __inline__ void __DEFAULT_FN_ATTRS wasm_v128_store(void *__mem,219 v128_t __a) {220 // UB-free unaligned access copied from xmmintrin.h221 struct __wasm_v128_store_struct {222 __v128_u __v;223 } __attribute__((__packed__, __may_alias__));224 ((struct __wasm_v128_store_struct *)__mem)->__v = __a;225}226 227static __inline__ void __DEFAULT_FN_ATTRS wasm_v128_store8_lane(void *__mem,228 v128_t __vec,229 int __i)230 __REQUIRE_CONSTANT(__i) {231 struct __wasm_v128_store8_lane_struct {232 int8_t __v;233 } __attribute__((__packed__, __may_alias__));234 ((struct __wasm_v128_store8_lane_struct *)__mem)->__v = ((__i8x16)__vec)[__i];235}236 237static __inline__ void __DEFAULT_FN_ATTRS wasm_v128_store16_lane(void *__mem,238 v128_t __vec,239 int __i)240 __REQUIRE_CONSTANT(__i) {241 struct __wasm_v128_store16_lane_struct {242 int16_t __v;243 } __attribute__((__packed__, __may_alias__));244 ((struct __wasm_v128_store16_lane_struct *)__mem)->__v =245 ((__i16x8)__vec)[__i];246}247 248static __inline__ void __DEFAULT_FN_ATTRS wasm_v128_store32_lane(void *__mem,249 v128_t __vec,250 int __i)251 __REQUIRE_CONSTANT(__i) {252 struct __wasm_v128_store32_lane_struct {253 int32_t __v;254 } __attribute__((__packed__, __may_alias__));255 ((struct __wasm_v128_store32_lane_struct *)__mem)->__v =256 ((__i32x4)__vec)[__i];257}258 259static __inline__ void __DEFAULT_FN_ATTRS wasm_v128_store64_lane(void *__mem,260 v128_t __vec,261 int __i)262 __REQUIRE_CONSTANT(__i) {263 struct __wasm_v128_store64_lane_struct {264 int64_t __v;265 } __attribute__((__packed__, __may_alias__));266 ((struct __wasm_v128_store64_lane_struct *)__mem)->__v =267 ((__i64x2)__vec)[__i];268}269 270static __inline__ v128_t __DEFAULT_FN_ATTRS271wasm_i8x16_make(int8_t __c0, int8_t __c1, int8_t __c2, int8_t __c3, int8_t __c4,272 int8_t __c5, int8_t __c6, int8_t __c7, int8_t __c8, int8_t __c9,273 int8_t __c10, int8_t __c11, int8_t __c12, int8_t __c13,274 int8_t __c14, int8_t __c15) {275 return (v128_t)(__i8x16){__c0, __c1, __c2, __c3, __c4, __c5,276 __c6, __c7, __c8, __c9, __c10, __c11,277 __c12, __c13, __c14, __c15};278}279 280static __inline__ v128_t __DEFAULT_FN_ATTRS281wasm_u8x16_make(uint8_t __c0, uint8_t __c1, uint8_t __c2, uint8_t __c3,282 uint8_t __c4, uint8_t __c5, uint8_t __c6, uint8_t __c7,283 uint8_t __c8, uint8_t __c9, uint8_t __c10, uint8_t __c11,284 uint8_t __c12, uint8_t __c13, uint8_t __c14, uint8_t __c15) {285 return (v128_t)(__u8x16){__c0, __c1, __c2, __c3, __c4, __c5,286 __c6, __c7, __c8, __c9, __c10, __c11,287 __c12, __c13, __c14, __c15};288}289 290static __inline__ v128_t __DEFAULT_FN_ATTRS291wasm_i16x8_make(int16_t __c0, int16_t __c1, int16_t __c2, int16_t __c3,292 int16_t __c4, int16_t __c5, int16_t __c6, int16_t __c7) {293 return (v128_t)(__i16x8){__c0, __c1, __c2, __c3, __c4, __c5, __c6, __c7};294}295 296static __inline__ v128_t __DEFAULT_FN_ATTRS297wasm_u16x8_make(uint16_t __c0, uint16_t __c1, uint16_t __c2, uint16_t __c3,298 uint16_t __c4, uint16_t __c5, uint16_t __c6, uint16_t __c7) {299 return (v128_t)(__u16x8){__c0, __c1, __c2, __c3, __c4, __c5, __c6, __c7};300}301 302static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i32x4_make(int32_t __c0,303 int32_t __c1,304 int32_t __c2,305 int32_t __c3) {306 return (v128_t)(__i32x4){__c0, __c1, __c2, __c3};307}308 309static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u32x4_make(uint32_t __c0,310 uint32_t __c1,311 uint32_t __c2,312 uint32_t __c3) {313 return (v128_t)(__u32x4){__c0, __c1, __c2, __c3};314}315 316static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i64x2_make(int64_t __c0,317 int64_t __c1) {318 return (v128_t)(__i64x2){__c0, __c1};319}320 321static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u64x2_make(uint64_t __c0,322 uint64_t __c1) {323 return (v128_t)(__u64x2){__c0, __c1};324}325 326static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f32x4_make(float __c0,327 float __c1,328 float __c2,329 float __c3) {330 return (v128_t)(__f32x4){__c0, __c1, __c2, __c3};331}332 333static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f64x2_make(double __c0,334 double __c1) {335 return (v128_t)(__f64x2){__c0, __c1};336}337 338static __inline__ v128_t __DEFAULT_FN_ATTRS339wasm_i8x16_const(int8_t __c0, int8_t __c1, int8_t __c2, int8_t __c3,340 int8_t __c4, int8_t __c5, int8_t __c6, int8_t __c7,341 int8_t __c8, int8_t __c9, int8_t __c10, int8_t __c11,342 int8_t __c12, int8_t __c13, int8_t __c14, int8_t __c15)343 __REQUIRE_CONSTANT(__c0) __REQUIRE_CONSTANT(__c1) __REQUIRE_CONSTANT(__c2)344 __REQUIRE_CONSTANT(__c3) __REQUIRE_CONSTANT(__c4)345 __REQUIRE_CONSTANT(__c5) __REQUIRE_CONSTANT(__c6)346 __REQUIRE_CONSTANT(__c7) __REQUIRE_CONSTANT(__c8)347 __REQUIRE_CONSTANT(__c9) __REQUIRE_CONSTANT(__c10)348 __REQUIRE_CONSTANT(__c11) __REQUIRE_CONSTANT(__c12)349 __REQUIRE_CONSTANT(__c13) __REQUIRE_CONSTANT(__c14)350 __REQUIRE_CONSTANT(__c15) {351 return (v128_t)(__i8x16){__c0, __c1, __c2, __c3, __c4, __c5,352 __c6, __c7, __c8, __c9, __c10, __c11,353 __c12, __c13, __c14, __c15};354}355 356static __inline__ v128_t __DEFAULT_FN_ATTRS357wasm_u8x16_const(uint8_t __c0, uint8_t __c1, uint8_t __c2, uint8_t __c3,358 uint8_t __c4, uint8_t __c5, uint8_t __c6, uint8_t __c7,359 uint8_t __c8, uint8_t __c9, uint8_t __c10, uint8_t __c11,360 uint8_t __c12, uint8_t __c13, uint8_t __c14, uint8_t __c15)361 __REQUIRE_CONSTANT(__c0) __REQUIRE_CONSTANT(__c1) __REQUIRE_CONSTANT(__c2)362 __REQUIRE_CONSTANT(__c3) __REQUIRE_CONSTANT(__c4)363 __REQUIRE_CONSTANT(__c5) __REQUIRE_CONSTANT(__c6)364 __REQUIRE_CONSTANT(__c7) __REQUIRE_CONSTANT(__c8)365 __REQUIRE_CONSTANT(__c9) __REQUIRE_CONSTANT(__c10)366 __REQUIRE_CONSTANT(__c11) __REQUIRE_CONSTANT(__c12)367 __REQUIRE_CONSTANT(__c13) __REQUIRE_CONSTANT(__c14)368 __REQUIRE_CONSTANT(__c15) {369 return (v128_t)(__u8x16){__c0, __c1, __c2, __c3, __c4, __c5,370 __c6, __c7, __c8, __c9, __c10, __c11,371 __c12, __c13, __c14, __c15};372}373 374static __inline__ v128_t __DEFAULT_FN_ATTRS375wasm_i16x8_const(int16_t __c0, int16_t __c1, int16_t __c2, int16_t __c3,376 int16_t __c4, int16_t __c5, int16_t __c6, int16_t __c7)377 __REQUIRE_CONSTANT(__c0) __REQUIRE_CONSTANT(__c1) __REQUIRE_CONSTANT(__c2)378 __REQUIRE_CONSTANT(__c3) __REQUIRE_CONSTANT(__c4)379 __REQUIRE_CONSTANT(__c5) __REQUIRE_CONSTANT(__c6)380 __REQUIRE_CONSTANT(__c7) {381 return (v128_t)(__i16x8){__c0, __c1, __c2, __c3, __c4, __c5, __c6, __c7};382}383 384static __inline__ v128_t __DEFAULT_FN_ATTRS385wasm_u16x8_const(uint16_t __c0, uint16_t __c1, uint16_t __c2, uint16_t __c3,386 uint16_t __c4, uint16_t __c5, uint16_t __c6, uint16_t __c7)387 __REQUIRE_CONSTANT(__c0) __REQUIRE_CONSTANT(__c1) __REQUIRE_CONSTANT(__c2)388 __REQUIRE_CONSTANT(__c3) __REQUIRE_CONSTANT(__c4)389 __REQUIRE_CONSTANT(__c5) __REQUIRE_CONSTANT(__c6)390 __REQUIRE_CONSTANT(__c7) {391 return (v128_t)(__u16x8){__c0, __c1, __c2, __c3, __c4, __c5, __c6, __c7};392}393 394static __inline__ v128_t __DEFAULT_FN_ATTRS395wasm_i32x4_const(int32_t __c0, int32_t __c1, int32_t __c2, int32_t __c3)396 __REQUIRE_CONSTANT(__c0) __REQUIRE_CONSTANT(__c1) __REQUIRE_CONSTANT(__c2)397 __REQUIRE_CONSTANT(__c3) {398 return (v128_t)(__i32x4){__c0, __c1, __c2, __c3};399}400 401static __inline__ v128_t __DEFAULT_FN_ATTRS402wasm_u32x4_const(uint32_t __c0, uint32_t __c1, uint32_t __c2, uint32_t __c3)403 __REQUIRE_CONSTANT(__c0) __REQUIRE_CONSTANT(__c1) __REQUIRE_CONSTANT(__c2)404 __REQUIRE_CONSTANT(__c3) {405 return (v128_t)(__u32x4){__c0, __c1, __c2, __c3};406}407 408static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i64x2_const(int64_t __c0,409 int64_t __c1)410 __REQUIRE_CONSTANT(__c0) __REQUIRE_CONSTANT(__c1) {411 return (v128_t)(__i64x2){__c0, __c1};412}413 414static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u64x2_const(uint64_t __c0,415 uint64_t __c1)416 __REQUIRE_CONSTANT(__c0) __REQUIRE_CONSTANT(__c1) {417 return (v128_t)(__u64x2){__c0, __c1};418}419 420static __inline__ v128_t __DEFAULT_FN_ATTRS421wasm_f32x4_const(float __c0, float __c1, float __c2, float __c3)422 __REQUIRE_CONSTANT(__c0) __REQUIRE_CONSTANT(__c1) __REQUIRE_CONSTANT(__c2)423 __REQUIRE_CONSTANT(__c3) {424 return (v128_t)(__f32x4){__c0, __c1, __c2, __c3};425}426 427static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f64x2_const(double __c0,428 double __c1)429 __REQUIRE_CONSTANT(__c0) __REQUIRE_CONSTANT(__c1) {430 return (v128_t)(__f64x2){__c0, __c1};431}432 433static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i8x16_const_splat(int8_t __c)434 __REQUIRE_CONSTANT(__c) {435 return (v128_t)(__i8x16){__c, __c, __c, __c, __c, __c, __c, __c,436 __c, __c, __c, __c, __c, __c, __c, __c};437}438 439static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u8x16_const_splat(uint8_t __c)440 __REQUIRE_CONSTANT(__c) {441 return (v128_t)(__u8x16){__c, __c, __c, __c, __c, __c, __c, __c,442 __c, __c, __c, __c, __c, __c, __c, __c};443}444 445static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i16x8_const_splat(int16_t __c)446 __REQUIRE_CONSTANT(__c) {447 return (v128_t)(__i16x8){__c, __c, __c, __c, __c, __c, __c, __c};448}449 450static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u16x8_const_splat(uint16_t __c)451 __REQUIRE_CONSTANT(__c) {452 return (v128_t)(__u16x8){__c, __c, __c, __c, __c, __c, __c, __c};453}454 455static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i32x4_const_splat(int32_t __c)456 __REQUIRE_CONSTANT(__c) {457 return (v128_t)(__i32x4){__c, __c, __c, __c};458}459 460static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u32x4_const_splat(uint32_t __c)461 __REQUIRE_CONSTANT(__c) {462 return (v128_t)(__u32x4){__c, __c, __c, __c};463}464 465static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i64x2_const_splat(int64_t __c)466 __REQUIRE_CONSTANT(__c) {467 return (v128_t)(__i64x2){__c, __c};468}469 470static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u64x2_const_splat(uint64_t __c)471 __REQUIRE_CONSTANT(__c) {472 return (v128_t)(__u64x2){__c, __c};473}474 475static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f32x4_const_splat(float __c)476 __REQUIRE_CONSTANT(__c) {477 return (v128_t)(__f32x4){__c, __c, __c, __c};478}479 480static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f64x2_const_splat(double __c)481 __REQUIRE_CONSTANT(__c) {482 return (v128_t)(__f64x2){__c, __c};483}484 485static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i8x16_splat(int8_t __a) {486 return (v128_t)(__i8x16){__a, __a, __a, __a, __a, __a, __a, __a,487 __a, __a, __a, __a, __a, __a, __a, __a};488}489 490static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u8x16_splat(uint8_t __a) {491 return (v128_t)(__u8x16){__a, __a, __a, __a, __a, __a, __a, __a,492 __a, __a, __a, __a, __a, __a, __a, __a};493}494 495static __inline__ int8_t __DEFAULT_FN_ATTRS wasm_i8x16_extract_lane(v128_t __a,496 int __i)497 __REQUIRE_CONSTANT(__i) {498 return ((__i8x16)__a)[__i];499}500 501static __inline__ uint8_t __DEFAULT_FN_ATTRS wasm_u8x16_extract_lane(v128_t __a,502 int __i)503 __REQUIRE_CONSTANT(__i) {504 return ((__u8x16)__a)[__i];505}506 507static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i8x16_replace_lane(v128_t __a,508 int __i,509 int8_t __b)510 __REQUIRE_CONSTANT(__i) {511 __i8x16 __v = (__i8x16)__a;512 __v[__i] = __b;513 return (v128_t)__v;514}515 516static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u8x16_replace_lane(v128_t __a,517 int __i,518 uint8_t __b)519 __REQUIRE_CONSTANT(__i) {520 __u8x16 __v = (__u8x16)__a;521 __v[__i] = __b;522 return (v128_t)__v;523}524 525static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i16x8_splat(int16_t __a) {526 return (v128_t)(__i16x8){__a, __a, __a, __a, __a, __a, __a, __a};527}528 529static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u16x8_splat(uint16_t __a) {530 return (v128_t)(__u16x8){__a, __a, __a, __a, __a, __a, __a, __a};531}532 533static __inline__ int16_t __DEFAULT_FN_ATTRS wasm_i16x8_extract_lane(v128_t __a,534 int __i)535 __REQUIRE_CONSTANT(__i) {536 return ((__i16x8)__a)[__i];537}538 539static __inline__ uint16_t __DEFAULT_FN_ATTRS540wasm_u16x8_extract_lane(v128_t __a, int __i) __REQUIRE_CONSTANT(__i) {541 return ((__u16x8)__a)[__i];542}543 544static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i16x8_replace_lane(v128_t __a,545 int __i,546 int16_t __b)547 __REQUIRE_CONSTANT(__i) {548 __i16x8 __v = (__i16x8)__a;549 __v[__i] = __b;550 return (v128_t)__v;551}552 553static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u16x8_replace_lane(554 v128_t __a, int __i, uint16_t __b) __REQUIRE_CONSTANT(__i) {555 __u16x8 __v = (__u16x8)__a;556 __v[__i] = __b;557 return (v128_t)__v;558}559 560static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i32x4_splat(int32_t __a) {561 return (v128_t)(__i32x4){__a, __a, __a, __a};562}563 564static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u32x4_splat(uint32_t __a) {565 return (v128_t)(__u32x4){__a, __a, __a, __a};566}567 568static __inline__ int32_t __DEFAULT_FN_ATTRS wasm_i32x4_extract_lane(v128_t __a,569 int __i)570 __REQUIRE_CONSTANT(__i) {571 return ((__i32x4)__a)[__i];572}573 574static __inline__ uint32_t __DEFAULT_FN_ATTRS575wasm_u32x4_extract_lane(v128_t __a, int __i) __REQUIRE_CONSTANT(__i) {576 return ((__u32x4)__a)[__i];577}578 579static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i32x4_replace_lane(v128_t __a,580 int __i,581 int32_t __b)582 __REQUIRE_CONSTANT(__i) {583 __i32x4 __v = (__i32x4)__a;584 __v[__i] = __b;585 return (v128_t)__v;586}587 588static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u32x4_replace_lane(589 v128_t __a, int __i, uint32_t __b) __REQUIRE_CONSTANT(__i) {590 __u32x4 __v = (__u32x4)__a;591 __v[__i] = __b;592 return (v128_t)__v;593}594 595static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i64x2_splat(int64_t __a) {596 return (v128_t)(__i64x2){__a, __a};597}598 599static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u64x2_splat(uint64_t __a) {600 return (v128_t)(__u64x2){__a, __a};601}602 603static __inline__ int64_t __DEFAULT_FN_ATTRS wasm_i64x2_extract_lane(v128_t __a,604 int __i)605 __REQUIRE_CONSTANT(__i) {606 return ((__i64x2)__a)[__i];607}608 609static __inline__ uint64_t __DEFAULT_FN_ATTRS610wasm_u64x2_extract_lane(v128_t __a, int __i) __REQUIRE_CONSTANT(__i) {611 return ((__u64x2)__a)[__i];612}613 614static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i64x2_replace_lane(v128_t __a,615 int __i,616 int64_t __b)617 __REQUIRE_CONSTANT(__i) {618 __i64x2 __v = (__i64x2)__a;619 __v[__i] = __b;620 return (v128_t)__v;621}622 623static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u64x2_replace_lane(624 v128_t __a, int __i, uint64_t __b) __REQUIRE_CONSTANT(__i) {625 __u64x2 __v = (__u64x2)__a;626 __v[__i] = __b;627 return (v128_t)__v;628}629 630static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f32x4_splat(float __a) {631 return (v128_t)(__f32x4){__a, __a, __a, __a};632}633 634static __inline__ float __DEFAULT_FN_ATTRS wasm_f32x4_extract_lane(v128_t __a,635 int __i)636 __REQUIRE_CONSTANT(__i) {637 return ((__f32x4)__a)[__i];638}639 640static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f32x4_replace_lane(v128_t __a,641 int __i,642 float __b)643 __REQUIRE_CONSTANT(__i) {644 __f32x4 __v = (__f32x4)__a;645 __v[__i] = __b;646 return (v128_t)__v;647}648 649static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f64x2_splat(double __a) {650 return (v128_t)(__f64x2){__a, __a};651}652 653static __inline__ double __DEFAULT_FN_ATTRS wasm_f64x2_extract_lane(v128_t __a,654 int __i)655 __REQUIRE_CONSTANT(__i) {656 return ((__f64x2)__a)[__i];657}658 659static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f64x2_replace_lane(v128_t __a,660 int __i,661 double __b)662 __REQUIRE_CONSTANT(__i) {663 __f64x2 __v = (__f64x2)__a;664 __v[__i] = __b;665 return (v128_t)__v;666}667 668static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i8x16_eq(v128_t __a,669 v128_t __b) {670 return (v128_t)((__i8x16)__a == (__i8x16)__b);671}672 673static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i8x16_ne(v128_t __a,674 v128_t __b) {675 return (v128_t)((__i8x16)__a != (__i8x16)__b);676}677 678static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i8x16_lt(v128_t __a,679 v128_t __b) {680 return (v128_t)((__i8x16)__a < (__i8x16)__b);681}682 683static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u8x16_lt(v128_t __a,684 v128_t __b) {685 return (v128_t)((__u8x16)__a < (__u8x16)__b);686}687 688static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i8x16_gt(v128_t __a,689 v128_t __b) {690 return (v128_t)((__i8x16)__a > (__i8x16)__b);691}692 693static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u8x16_gt(v128_t __a,694 v128_t __b) {695 return (v128_t)((__u8x16)__a > (__u8x16)__b);696}697 698static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i8x16_le(v128_t __a,699 v128_t __b) {700 return (v128_t)((__i8x16)__a <= (__i8x16)__b);701}702 703static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u8x16_le(v128_t __a,704 v128_t __b) {705 return (v128_t)((__u8x16)__a <= (__u8x16)__b);706}707 708static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i8x16_ge(v128_t __a,709 v128_t __b) {710 return (v128_t)((__i8x16)__a >= (__i8x16)__b);711}712 713static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u8x16_ge(v128_t __a,714 v128_t __b) {715 return (v128_t)((__u8x16)__a >= (__u8x16)__b);716}717 718static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i16x8_eq(v128_t __a,719 v128_t __b) {720 return (v128_t)((__i16x8)__a == (__i16x8)__b);721}722 723static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i16x8_ne(v128_t __a,724 v128_t __b) {725 return (v128_t)((__u16x8)__a != (__u16x8)__b);726}727 728static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i16x8_lt(v128_t __a,729 v128_t __b) {730 return (v128_t)((__i16x8)__a < (__i16x8)__b);731}732 733static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u16x8_lt(v128_t __a,734 v128_t __b) {735 return (v128_t)((__u16x8)__a < (__u16x8)__b);736}737 738static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i16x8_gt(v128_t __a,739 v128_t __b) {740 return (v128_t)((__i16x8)__a > (__i16x8)__b);741}742 743static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u16x8_gt(v128_t __a,744 v128_t __b) {745 return (v128_t)((__u16x8)__a > (__u16x8)__b);746}747 748static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i16x8_le(v128_t __a,749 v128_t __b) {750 return (v128_t)((__i16x8)__a <= (__i16x8)__b);751}752 753static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u16x8_le(v128_t __a,754 v128_t __b) {755 return (v128_t)((__u16x8)__a <= (__u16x8)__b);756}757 758static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i16x8_ge(v128_t __a,759 v128_t __b) {760 return (v128_t)((__i16x8)__a >= (__i16x8)__b);761}762 763static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u16x8_ge(v128_t __a,764 v128_t __b) {765 return (v128_t)((__u16x8)__a >= (__u16x8)__b);766}767 768static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i32x4_eq(v128_t __a,769 v128_t __b) {770 return (v128_t)((__i32x4)__a == (__i32x4)__b);771}772 773static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i32x4_ne(v128_t __a,774 v128_t __b) {775 return (v128_t)((__i32x4)__a != (__i32x4)__b);776}777 778static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i32x4_lt(v128_t __a,779 v128_t __b) {780 return (v128_t)((__i32x4)__a < (__i32x4)__b);781}782 783static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u32x4_lt(v128_t __a,784 v128_t __b) {785 return (v128_t)((__u32x4)__a < (__u32x4)__b);786}787 788static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i32x4_gt(v128_t __a,789 v128_t __b) {790 return (v128_t)((__i32x4)__a > (__i32x4)__b);791}792 793static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u32x4_gt(v128_t __a,794 v128_t __b) {795 return (v128_t)((__u32x4)__a > (__u32x4)__b);796}797 798static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i32x4_le(v128_t __a,799 v128_t __b) {800 return (v128_t)((__i32x4)__a <= (__i32x4)__b);801}802 803static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u32x4_le(v128_t __a,804 v128_t __b) {805 return (v128_t)((__u32x4)__a <= (__u32x4)__b);806}807 808static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i32x4_ge(v128_t __a,809 v128_t __b) {810 return (v128_t)((__i32x4)__a >= (__i32x4)__b);811}812 813static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u32x4_ge(v128_t __a,814 v128_t __b) {815 return (v128_t)((__u32x4)__a >= (__u32x4)__b);816}817 818static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i64x2_eq(v128_t __a,819 v128_t __b) {820 return (v128_t)((__i64x2)__a == (__i64x2)__b);821}822 823static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i64x2_ne(v128_t __a,824 v128_t __b) {825 return (v128_t)((__i64x2)__a != (__i64x2)__b);826}827 828static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i64x2_lt(v128_t __a,829 v128_t __b) {830 return (v128_t)((__i64x2)__a < (__i64x2)__b);831}832 833static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i64x2_gt(v128_t __a,834 v128_t __b) {835 return (v128_t)((__i64x2)__a > (__i64x2)__b);836}837 838static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i64x2_le(v128_t __a,839 v128_t __b) {840 return (v128_t)((__i64x2)__a <= (__i64x2)__b);841}842 843static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i64x2_ge(v128_t __a,844 v128_t __b) {845 return (v128_t)((__i64x2)__a >= (__i64x2)__b);846}847 848static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f32x4_eq(v128_t __a,849 v128_t __b) {850 return (v128_t)((__f32x4)__a == (__f32x4)__b);851}852 853static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f32x4_ne(v128_t __a,854 v128_t __b) {855 return (v128_t)((__f32x4)__a != (__f32x4)__b);856}857 858static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f32x4_lt(v128_t __a,859 v128_t __b) {860 return (v128_t)((__f32x4)__a < (__f32x4)__b);861}862 863static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f32x4_gt(v128_t __a,864 v128_t __b) {865 return (v128_t)((__f32x4)__a > (__f32x4)__b);866}867 868static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f32x4_le(v128_t __a,869 v128_t __b) {870 return (v128_t)((__f32x4)__a <= (__f32x4)__b);871}872 873static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f32x4_ge(v128_t __a,874 v128_t __b) {875 return (v128_t)((__f32x4)__a >= (__f32x4)__b);876}877 878static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f64x2_eq(v128_t __a,879 v128_t __b) {880 return (v128_t)((__f64x2)__a == (__f64x2)__b);881}882 883static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f64x2_ne(v128_t __a,884 v128_t __b) {885 return (v128_t)((__f64x2)__a != (__f64x2)__b);886}887 888static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f64x2_lt(v128_t __a,889 v128_t __b) {890 return (v128_t)((__f64x2)__a < (__f64x2)__b);891}892 893static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f64x2_gt(v128_t __a,894 v128_t __b) {895 return (v128_t)((__f64x2)__a > (__f64x2)__b);896}897 898static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f64x2_le(v128_t __a,899 v128_t __b) {900 return (v128_t)((__f64x2)__a <= (__f64x2)__b);901}902 903static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f64x2_ge(v128_t __a,904 v128_t __b) {905 return (v128_t)((__f64x2)__a >= (__f64x2)__b);906}907 908static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_v128_not(v128_t __a) {909 return ~__a;910}911 912static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_v128_and(v128_t __a,913 v128_t __b) {914 return __a & __b;915}916 917static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_v128_or(v128_t __a,918 v128_t __b) {919 return __a | __b;920}921 922static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_v128_xor(v128_t __a,923 v128_t __b) {924 return __a ^ __b;925}926 927static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_v128_andnot(v128_t __a,928 v128_t __b) {929 return __a & ~__b;930}931 932static __inline__ bool __DEFAULT_FN_ATTRS wasm_v128_any_true(v128_t __a) {933 return __builtin_wasm_any_true_v128((__i8x16)__a);934}935 936static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_v128_bitselect(v128_t __a,937 v128_t __b,938 v128_t __mask) {939 return (v128_t)__builtin_wasm_bitselect((__i32x4)__a, (__i32x4)__b,940 (__i32x4)__mask);941}942 943static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i8x16_abs(v128_t __a) {944 return (v128_t)__builtin_wasm_abs_i8x16((__i8x16)__a);945}946 947static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i8x16_neg(v128_t __a) {948 return (v128_t)(-(__u8x16)__a);949}950 951static __inline__ bool __DEFAULT_FN_ATTRS wasm_i8x16_all_true(v128_t __a) {952 return __builtin_wasm_all_true_i8x16((__i8x16)__a);953}954 955static __inline__ uint32_t __DEFAULT_FN_ATTRS wasm_i8x16_bitmask(v128_t __a) {956 return __builtin_wasm_bitmask_i8x16((__i8x16)__a);957}958 959static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i8x16_popcnt(v128_t __a) {960 return (v128_t)__builtin_elementwise_popcount((__i8x16)__a);961}962 963static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i8x16_shl(v128_t __a,964 uint32_t __b) {965 return (v128_t)((__i8x16)__a << (__b & 0x7));966}967 968static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i8x16_shr(v128_t __a,969 uint32_t __b) {970 return (v128_t)((__i8x16)__a >> (__b & 0x7));971}972 973static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u8x16_shr(v128_t __a,974 uint32_t __b) {975 return (v128_t)((__u8x16)__a >> (__b & 0x7));976}977 978static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i8x16_add(v128_t __a,979 v128_t __b) {980 return (v128_t)((__u8x16)__a + (__u8x16)__b);981}982 983static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i8x16_add_sat(v128_t __a,984 v128_t __b) {985 return (v128_t)__builtin_elementwise_add_sat((__i8x16)__a, (__i8x16)__b);986}987 988static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u8x16_add_sat(v128_t __a,989 v128_t __b) {990 return (v128_t)__builtin_elementwise_add_sat((__u8x16)__a, (__u8x16)__b);991}992 993static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i8x16_sub(v128_t __a,994 v128_t __b) {995 return (v128_t)((__u8x16)__a - (__u8x16)__b);996}997 998static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i8x16_sub_sat(v128_t __a,999 v128_t __b) {1000 return (v128_t)__builtin_elementwise_sub_sat((__i8x16)__a, (__i8x16)__b);1001}1002 1003static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u8x16_sub_sat(v128_t __a,1004 v128_t __b) {1005 return (v128_t)__builtin_elementwise_sub_sat((__u8x16)__a, (__u8x16)__b);1006}1007 1008static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i8x16_min(v128_t __a,1009 v128_t __b) {1010 return (v128_t)__builtin_elementwise_min((__i8x16)__a, (__i8x16)__b);1011}1012 1013static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u8x16_min(v128_t __a,1014 v128_t __b) {1015 return (v128_t)__builtin_elementwise_min((__u8x16)__a, (__u8x16)__b);1016}1017 1018static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i8x16_max(v128_t __a,1019 v128_t __b) {1020 return (v128_t)__builtin_elementwise_max((__i8x16)__a, (__i8x16)__b);1021}1022 1023static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u8x16_max(v128_t __a,1024 v128_t __b) {1025 return (v128_t)__builtin_elementwise_max((__u8x16)__a, (__u8x16)__b);1026}1027 1028static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u8x16_avgr(v128_t __a,1029 v128_t __b) {1030 return (v128_t)__builtin_wasm_avgr_u_i8x16((__u8x16)__a, (__u8x16)__b);1031}1032 1033static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i16x8_abs(v128_t __a) {1034 return (v128_t)__builtin_wasm_abs_i16x8((__i16x8)__a);1035}1036 1037static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i16x8_neg(v128_t __a) {1038 return (v128_t)(-(__u16x8)__a);1039}1040 1041static __inline__ bool __DEFAULT_FN_ATTRS wasm_i16x8_all_true(v128_t __a) {1042 return __builtin_wasm_all_true_i16x8((__i16x8)__a);1043}1044 1045static __inline__ uint32_t __DEFAULT_FN_ATTRS wasm_i16x8_bitmask(v128_t __a) {1046 return __builtin_wasm_bitmask_i16x8((__i16x8)__a);1047}1048 1049static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i16x8_shl(v128_t __a,1050 uint32_t __b) {1051 return (v128_t)((__i16x8)__a << (__b & 0xF));1052}1053 1054static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i16x8_shr(v128_t __a,1055 uint32_t __b) {1056 return (v128_t)((__i16x8)__a >> (__b & 0xF));1057}1058 1059static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u16x8_shr(v128_t __a,1060 uint32_t __b) {1061 return (v128_t)((__u16x8)__a >> (__b & 0xF));1062}1063 1064static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i16x8_add(v128_t __a,1065 v128_t __b) {1066 return (v128_t)((__u16x8)__a + (__u16x8)__b);1067}1068 1069static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i16x8_add_sat(v128_t __a,1070 v128_t __b) {1071 return (v128_t)__builtin_elementwise_add_sat((__i16x8)__a, (__i16x8)__b);1072}1073 1074static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u16x8_add_sat(v128_t __a,1075 v128_t __b) {1076 return (v128_t)__builtin_elementwise_add_sat((__u16x8)__a, (__u16x8)__b);1077}1078 1079static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i16x8_sub(v128_t __a,1080 v128_t __b) {1081 return (v128_t)((__i16x8)__a - (__i16x8)__b);1082}1083 1084static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i16x8_sub_sat(v128_t __a,1085 v128_t __b) {1086 return (v128_t)__builtin_elementwise_sub_sat((__i16x8)__a, (__i16x8)__b);1087}1088 1089static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u16x8_sub_sat(v128_t __a,1090 v128_t __b) {1091 return (v128_t)__builtin_elementwise_sub_sat((__u16x8)__a, (__u16x8)__b);1092}1093 1094static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i16x8_mul(v128_t __a,1095 v128_t __b) {1096 return (v128_t)((__u16x8)__a * (__u16x8)__b);1097}1098 1099static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i16x8_min(v128_t __a,1100 v128_t __b) {1101 return (v128_t)__builtin_elementwise_min((__i16x8)__a, (__i16x8)__b);1102}1103 1104static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u16x8_min(v128_t __a,1105 v128_t __b) {1106 return (v128_t)__builtin_elementwise_min((__u16x8)__a, (__u16x8)__b);1107}1108 1109static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i16x8_max(v128_t __a,1110 v128_t __b) {1111 return (v128_t)__builtin_elementwise_max((__i16x8)__a, (__i16x8)__b);1112}1113 1114static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u16x8_max(v128_t __a,1115 v128_t __b) {1116 return (v128_t)__builtin_elementwise_max((__u16x8)__a, (__u16x8)__b);1117}1118 1119static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u16x8_avgr(v128_t __a,1120 v128_t __b) {1121 return (v128_t)__builtin_wasm_avgr_u_i16x8((__u16x8)__a, (__u16x8)__b);1122}1123 1124static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i32x4_abs(v128_t __a) {1125 return (v128_t)__builtin_wasm_abs_i32x4((__i32x4)__a);1126}1127 1128static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i32x4_neg(v128_t __a) {1129 return (v128_t)(-(__u32x4)__a);1130}1131 1132static __inline__ bool __DEFAULT_FN_ATTRS wasm_i32x4_all_true(v128_t __a) {1133 return __builtin_wasm_all_true_i32x4((__i32x4)__a);1134}1135 1136static __inline__ uint32_t __DEFAULT_FN_ATTRS wasm_i32x4_bitmask(v128_t __a) {1137 return __builtin_wasm_bitmask_i32x4((__i32x4)__a);1138}1139 1140static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i32x4_shl(v128_t __a,1141 uint32_t __b) {1142 return (v128_t)((__i32x4)__a << (__b & 0x1F));1143}1144 1145static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i32x4_shr(v128_t __a,1146 uint32_t __b) {1147 return (v128_t)((__i32x4)__a >> (__b & 0x1F));1148}1149 1150static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u32x4_shr(v128_t __a,1151 uint32_t __b) {1152 return (v128_t)((__u32x4)__a >> (__b & 0x1F));1153}1154 1155static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i32x4_add(v128_t __a,1156 v128_t __b) {1157 return (v128_t)((__u32x4)__a + (__u32x4)__b);1158}1159 1160static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i32x4_sub(v128_t __a,1161 v128_t __b) {1162 return (v128_t)((__u32x4)__a - (__u32x4)__b);1163}1164 1165static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i32x4_mul(v128_t __a,1166 v128_t __b) {1167 return (v128_t)((__u32x4)__a * (__u32x4)__b);1168}1169 1170static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i32x4_min(v128_t __a,1171 v128_t __b) {1172 return (v128_t)__builtin_elementwise_min((__i32x4)__a, (__i32x4)__b);1173}1174 1175static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u32x4_min(v128_t __a,1176 v128_t __b) {1177 return (v128_t)__builtin_elementwise_min((__u32x4)__a, (__u32x4)__b);1178}1179 1180static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i32x4_max(v128_t __a,1181 v128_t __b) {1182 return (v128_t)__builtin_elementwise_max((__i32x4)__a, (__i32x4)__b);1183}1184 1185static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u32x4_max(v128_t __a,1186 v128_t __b) {1187 return (v128_t)__builtin_elementwise_max((__u32x4)__a, (__u32x4)__b);1188}1189 1190static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i32x4_dot_i16x8(v128_t __a,1191 v128_t __b) {1192 return (v128_t)__builtin_wasm_dot_s_i32x4_i16x8((__i16x8)__a, (__i16x8)__b);1193}1194 1195static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i64x2_abs(v128_t __a) {1196 return (v128_t)__builtin_wasm_abs_i64x2((__i64x2)__a);1197}1198 1199static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i64x2_neg(v128_t __a) {1200 return (v128_t)(-(__u64x2)__a);1201}1202 1203static __inline__ bool __DEFAULT_FN_ATTRS wasm_i64x2_all_true(v128_t __a) {1204 return __builtin_wasm_all_true_i64x2((__i64x2)__a);1205}1206 1207static __inline__ uint32_t __DEFAULT_FN_ATTRS wasm_i64x2_bitmask(v128_t __a) {1208 return __builtin_wasm_bitmask_i64x2((__i64x2)__a);1209}1210 1211static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i64x2_shl(v128_t __a,1212 uint32_t __b) {1213 return (v128_t)((__i64x2)__a << ((int64_t)__b & 0x3F));1214}1215 1216static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i64x2_shr(v128_t __a,1217 uint32_t __b) {1218 return (v128_t)((__i64x2)__a >> ((int64_t)__b & 0x3F));1219}1220 1221static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u64x2_shr(v128_t __a,1222 uint32_t __b) {1223 return (v128_t)((__u64x2)__a >> ((int64_t)__b & 0x3F));1224}1225 1226static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i64x2_add(v128_t __a,1227 v128_t __b) {1228 return (v128_t)((__u64x2)__a + (__u64x2)__b);1229}1230 1231static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i64x2_sub(v128_t __a,1232 v128_t __b) {1233 return (v128_t)((__u64x2)__a - (__u64x2)__b);1234}1235 1236static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i64x2_mul(v128_t __a,1237 v128_t __b) {1238 return (v128_t)((__u64x2)__a * (__u64x2)__b);1239}1240 1241static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f32x4_abs(v128_t __a) {1242 return (v128_t)__builtin_wasm_abs_f32x4((__f32x4)__a);1243}1244 1245static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f32x4_neg(v128_t __a) {1246 return (v128_t)(-(__f32x4)__a);1247}1248 1249static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f32x4_sqrt(v128_t __a) {1250 return (v128_t)__builtin_wasm_sqrt_f32x4((__f32x4)__a);1251}1252 1253static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f32x4_ceil(v128_t __a) {1254 return (v128_t)__builtin_wasm_ceil_f32x4((__f32x4)__a);1255}1256 1257static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f32x4_floor(v128_t __a) {1258 return (v128_t)__builtin_wasm_floor_f32x4((__f32x4)__a);1259}1260 1261static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f32x4_trunc(v128_t __a) {1262 return (v128_t)__builtin_wasm_trunc_f32x4((__f32x4)__a);1263}1264 1265static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f32x4_nearest(v128_t __a) {1266 return (v128_t)__builtin_wasm_nearest_f32x4((__f32x4)__a);1267}1268 1269static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f32x4_add(v128_t __a,1270 v128_t __b) {1271 return (v128_t)((__f32x4)__a + (__f32x4)__b);1272}1273 1274static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f32x4_sub(v128_t __a,1275 v128_t __b) {1276 return (v128_t)((__f32x4)__a - (__f32x4)__b);1277}1278 1279static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f32x4_mul(v128_t __a,1280 v128_t __b) {1281 return (v128_t)((__f32x4)__a * (__f32x4)__b);1282}1283 1284static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f32x4_div(v128_t __a,1285 v128_t __b) {1286 return (v128_t)((__f32x4)__a / (__f32x4)__b);1287}1288 1289static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f32x4_min(v128_t __a,1290 v128_t __b) {1291 return (v128_t)__builtin_wasm_min_f32x4((__f32x4)__a, (__f32x4)__b);1292}1293 1294static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f32x4_max(v128_t __a,1295 v128_t __b) {1296 return (v128_t)__builtin_wasm_max_f32x4((__f32x4)__a, (__f32x4)__b);1297}1298 1299static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f32x4_pmin(v128_t __a,1300 v128_t __b) {1301 return (v128_t)__builtin_wasm_pmin_f32x4((__f32x4)__a, (__f32x4)__b);1302}1303 1304static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f32x4_pmax(v128_t __a,1305 v128_t __b) {1306 return (v128_t)__builtin_wasm_pmax_f32x4((__f32x4)__a, (__f32x4)__b);1307}1308 1309static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f64x2_abs(v128_t __a) {1310 return (v128_t)__builtin_wasm_abs_f64x2((__f64x2)__a);1311}1312 1313static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f64x2_neg(v128_t __a) {1314 return (v128_t)(-(__f64x2)__a);1315}1316 1317static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f64x2_sqrt(v128_t __a) {1318 return (v128_t)__builtin_wasm_sqrt_f64x2((__f64x2)__a);1319}1320 1321static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f64x2_ceil(v128_t __a) {1322 return (v128_t)__builtin_wasm_ceil_f64x2((__f64x2)__a);1323}1324 1325static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f64x2_floor(v128_t __a) {1326 return (v128_t)__builtin_wasm_floor_f64x2((__f64x2)__a);1327}1328 1329static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f64x2_trunc(v128_t __a) {1330 return (v128_t)__builtin_wasm_trunc_f64x2((__f64x2)__a);1331}1332 1333static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f64x2_nearest(v128_t __a) {1334 return (v128_t)__builtin_wasm_nearest_f64x2((__f64x2)__a);1335}1336 1337static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f64x2_add(v128_t __a,1338 v128_t __b) {1339 return (v128_t)((__f64x2)__a + (__f64x2)__b);1340}1341 1342static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f64x2_sub(v128_t __a,1343 v128_t __b) {1344 return (v128_t)((__f64x2)__a - (__f64x2)__b);1345}1346 1347static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f64x2_mul(v128_t __a,1348 v128_t __b) {1349 return (v128_t)((__f64x2)__a * (__f64x2)__b);1350}1351 1352static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f64x2_div(v128_t __a,1353 v128_t __b) {1354 return (v128_t)((__f64x2)__a / (__f64x2)__b);1355}1356 1357static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f64x2_min(v128_t __a,1358 v128_t __b) {1359 return (v128_t)__builtin_wasm_min_f64x2((__f64x2)__a, (__f64x2)__b);1360}1361 1362static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f64x2_max(v128_t __a,1363 v128_t __b) {1364 return (v128_t)__builtin_wasm_max_f64x2((__f64x2)__a, (__f64x2)__b);1365}1366 1367static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f64x2_pmin(v128_t __a,1368 v128_t __b) {1369 return (v128_t)__builtin_wasm_pmin_f64x2((__f64x2)__a, (__f64x2)__b);1370}1371 1372static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f64x2_pmax(v128_t __a,1373 v128_t __b) {1374 return (v128_t)__builtin_wasm_pmax_f64x2((__f64x2)__a, (__f64x2)__b);1375}1376 1377static __inline__ v128_t __DEFAULT_FN_ATTRS1378wasm_i32x4_trunc_sat_f32x4(v128_t __a) {1379 return (v128_t)__builtin_wasm_trunc_saturate_s_i32x4_f32x4((__f32x4)__a);1380}1381 1382static __inline__ v128_t __DEFAULT_FN_ATTRS1383wasm_u32x4_trunc_sat_f32x4(v128_t __a) {1384 return (v128_t)__builtin_wasm_trunc_saturate_u_i32x4_f32x4((__f32x4)__a);1385}1386 1387static __inline__ v128_t __DEFAULT_FN_ATTRS1388wasm_f32x4_convert_i32x4(v128_t __a) {1389 return (v128_t) __builtin_convertvector((__i32x4)__a, __f32x4);1390}1391 1392static __inline__ v128_t __DEFAULT_FN_ATTRS1393wasm_f32x4_convert_u32x4(v128_t __a) {1394 return (v128_t) __builtin_convertvector((__u32x4)__a, __f32x4);1395}1396 1397static __inline__ v128_t __DEFAULT_FN_ATTRS1398wasm_f64x2_convert_low_i32x4(v128_t __a) {1399 return (v128_t) __builtin_convertvector((__i32x2){__a[0], __a[1]}, __f64x2);1400}1401 1402static __inline__ v128_t __DEFAULT_FN_ATTRS1403wasm_f64x2_convert_low_u32x4(v128_t __a) {1404 return (v128_t) __builtin_convertvector((__u32x2){__a[0], __a[1]}, __f64x2);1405}1406 1407static __inline__ v128_t __DEFAULT_FN_ATTRS1408wasm_i32x4_trunc_sat_f64x2_zero(v128_t __a) {1409 return (v128_t)__builtin_wasm_trunc_sat_s_zero_f64x2_i32x4((__f64x2)__a);1410}1411 1412static __inline__ v128_t __DEFAULT_FN_ATTRS1413wasm_u32x4_trunc_sat_f64x2_zero(v128_t __a) {1414 return (v128_t)__builtin_wasm_trunc_sat_u_zero_f64x2_i32x4((__f64x2)__a);1415}1416 1417static __inline__ v128_t __DEFAULT_FN_ATTRS1418wasm_f32x4_demote_f64x2_zero(v128_t __a) {1419 return (v128_t) __builtin_convertvector(1420 __builtin_shufflevector((__f64x2)__a, (__f64x2){0, 0}, 0, 1, 2, 3),1421 __f32x4);1422}1423 1424static __inline__ v128_t __DEFAULT_FN_ATTRS1425wasm_f64x2_promote_low_f32x4(v128_t __a) {1426 return (v128_t) __builtin_convertvector(1427 (__f32x2){((__f32x4)__a)[0], ((__f32x4)__a)[1]}, __f64x2);1428}1429 1430#define wasm_i8x16_shuffle(__a, __b, __c0, __c1, __c2, __c3, __c4, __c5, __c6, \1431 __c7, __c8, __c9, __c10, __c11, __c12, __c13, \1432 __c14, __c15) \1433 ((v128_t)__builtin_wasm_shuffle_i8x16( \1434 (__i8x16)(__a), (__i8x16)(__b), __c0, __c1, __c2, __c3, __c4, __c5, \1435 __c6, __c7, __c8, __c9, __c10, __c11, __c12, __c13, __c14, __c15))1436 1437#define wasm_i16x8_shuffle(__a, __b, __c0, __c1, __c2, __c3, __c4, __c5, __c6, \1438 __c7) \1439 ((v128_t)__builtin_wasm_shuffle_i8x16( \1440 (__i8x16)(__a), (__i8x16)(__b), (__c0)*2, (__c0)*2 + 1, (__c1)*2, \1441 (__c1)*2 + 1, (__c2)*2, (__c2)*2 + 1, (__c3)*2, (__c3)*2 + 1, (__c4)*2, \1442 (__c4)*2 + 1, (__c5)*2, (__c5)*2 + 1, (__c6)*2, (__c6)*2 + 1, (__c7)*2, \1443 (__c7)*2 + 1))1444 1445#define wasm_i32x4_shuffle(__a, __b, __c0, __c1, __c2, __c3) \1446 ((v128_t)__builtin_wasm_shuffle_i8x16( \1447 (__i8x16)(__a), (__i8x16)(__b), (__c0)*4, (__c0)*4 + 1, (__c0)*4 + 2, \1448 (__c0)*4 + 3, (__c1)*4, (__c1)*4 + 1, (__c1)*4 + 2, (__c1)*4 + 3, \1449 (__c2)*4, (__c2)*4 + 1, (__c2)*4 + 2, (__c2)*4 + 3, (__c3)*4, \1450 (__c3)*4 + 1, (__c3)*4 + 2, (__c3)*4 + 3))1451 1452#define wasm_i64x2_shuffle(__a, __b, __c0, __c1) \1453 ((v128_t)__builtin_wasm_shuffle_i8x16( \1454 (__i8x16)(__a), (__i8x16)(__b), (__c0)*8, (__c0)*8 + 1, (__c0)*8 + 2, \1455 (__c0)*8 + 3, (__c0)*8 + 4, (__c0)*8 + 5, (__c0)*8 + 6, (__c0)*8 + 7, \1456 (__c1)*8, (__c1)*8 + 1, (__c1)*8 + 2, (__c1)*8 + 3, (__c1)*8 + 4, \1457 (__c1)*8 + 5, (__c1)*8 + 6, (__c1)*8 + 7))1458 1459static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i8x16_swizzle(v128_t __a,1460 v128_t __b) {1461 return (v128_t)__builtin_wasm_swizzle_i8x16((__i8x16)__a, (__i8x16)__b);1462}1463 1464static __inline__ v128_t __DEFAULT_FN_ATTRS1465wasm_i8x16_narrow_i16x8(v128_t __a, v128_t __b) {1466 return (v128_t)__builtin_wasm_narrow_s_i8x16_i16x8((__i16x8)__a,1467 (__i16x8)__b);1468}1469 1470static __inline__ v128_t __DEFAULT_FN_ATTRS1471wasm_u8x16_narrow_i16x8(v128_t __a, v128_t __b) {1472 return (v128_t)__builtin_wasm_narrow_u_i8x16_i16x8((__i16x8)__a,1473 (__i16x8)__b);1474}1475 1476static __inline__ v128_t __DEFAULT_FN_ATTRS1477wasm_i16x8_narrow_i32x4(v128_t __a, v128_t __b) {1478 return (v128_t)__builtin_wasm_narrow_s_i16x8_i32x4((__i32x4)__a,1479 (__i32x4)__b);1480}1481 1482static __inline__ v128_t __DEFAULT_FN_ATTRS1483wasm_u16x8_narrow_i32x4(v128_t __a, v128_t __b) {1484 return (v128_t)__builtin_wasm_narrow_u_i16x8_i32x4((__i32x4)__a,1485 (__i32x4)__b);1486}1487 1488static __inline__ v128_t __DEFAULT_FN_ATTRS1489wasm_i16x8_extend_low_i8x16(v128_t __a) {1490 return (v128_t) __builtin_convertvector(1491 (__i8x8){((__i8x16)__a)[0], ((__i8x16)__a)[1], ((__i8x16)__a)[2],1492 ((__i8x16)__a)[3], ((__i8x16)__a)[4], ((__i8x16)__a)[5],1493 ((__i8x16)__a)[6], ((__i8x16)__a)[7]},1494 __i16x8);1495}1496 1497static __inline__ v128_t __DEFAULT_FN_ATTRS1498wasm_i16x8_extend_high_i8x16(v128_t __a) {1499 return (v128_t) __builtin_convertvector(1500 (__i8x8){((__i8x16)__a)[8], ((__i8x16)__a)[9], ((__i8x16)__a)[10],1501 ((__i8x16)__a)[11], ((__i8x16)__a)[12], ((__i8x16)__a)[13],1502 ((__i8x16)__a)[14], ((__i8x16)__a)[15]},1503 __i16x8);1504}1505 1506static __inline__ v128_t __DEFAULT_FN_ATTRS1507wasm_u16x8_extend_low_u8x16(v128_t __a) {1508 return (v128_t) __builtin_convertvector(1509 (__u8x8){((__u8x16)__a)[0], ((__u8x16)__a)[1], ((__u8x16)__a)[2],1510 ((__u8x16)__a)[3], ((__u8x16)__a)[4], ((__u8x16)__a)[5],1511 ((__u8x16)__a)[6], ((__u8x16)__a)[7]},1512 __u16x8);1513}1514 1515static __inline__ v128_t __DEFAULT_FN_ATTRS1516wasm_u16x8_extend_high_u8x16(v128_t __a) {1517 return (v128_t) __builtin_convertvector(1518 (__u8x8){((__u8x16)__a)[8], ((__u8x16)__a)[9], ((__u8x16)__a)[10],1519 ((__u8x16)__a)[11], ((__u8x16)__a)[12], ((__u8x16)__a)[13],1520 ((__u8x16)__a)[14], ((__u8x16)__a)[15]},1521 __u16x8);1522}1523 1524static __inline__ v128_t __DEFAULT_FN_ATTRS1525wasm_i32x4_extend_low_i16x8(v128_t __a) {1526 return (v128_t) __builtin_convertvector(1527 (__i16x4){((__i16x8)__a)[0], ((__i16x8)__a)[1], ((__i16x8)__a)[2],1528 ((__i16x8)__a)[3]},1529 __i32x4);1530}1531 1532static __inline__ v128_t __DEFAULT_FN_ATTRS1533wasm_i32x4_extend_high_i16x8(v128_t __a) {1534 return (v128_t) __builtin_convertvector(1535 (__i16x4){((__i16x8)__a)[4], ((__i16x8)__a)[5], ((__i16x8)__a)[6],1536 ((__i16x8)__a)[7]},1537 __i32x4);1538}1539 1540static __inline__ v128_t __DEFAULT_FN_ATTRS1541wasm_u32x4_extend_low_u16x8(v128_t __a) {1542 return (v128_t) __builtin_convertvector(1543 (__u16x4){((__u16x8)__a)[0], ((__u16x8)__a)[1], ((__u16x8)__a)[2],1544 ((__u16x8)__a)[3]},1545 __u32x4);1546}1547 1548static __inline__ v128_t __DEFAULT_FN_ATTRS1549wasm_u32x4_extend_high_u16x8(v128_t __a) {1550 return (v128_t) __builtin_convertvector(1551 (__u16x4){((__u16x8)__a)[4], ((__u16x8)__a)[5], ((__u16x8)__a)[6],1552 ((__u16x8)__a)[7]},1553 __u32x4);1554}1555 1556static __inline__ v128_t __DEFAULT_FN_ATTRS1557wasm_i64x2_extend_low_i32x4(v128_t __a) {1558 return (v128_t) __builtin_convertvector(1559 (__i32x2){((__i32x4)__a)[0], ((__i32x4)__a)[1]}, __i64x2);1560}1561 1562static __inline__ v128_t __DEFAULT_FN_ATTRS1563wasm_i64x2_extend_high_i32x4(v128_t __a) {1564 return (v128_t) __builtin_convertvector(1565 (__i32x2){((__i32x4)__a)[2], ((__i32x4)__a)[3]}, __i64x2);1566}1567 1568static __inline__ v128_t __DEFAULT_FN_ATTRS1569wasm_u64x2_extend_low_u32x4(v128_t __a) {1570 return (v128_t) __builtin_convertvector(1571 (__u32x2){((__u32x4)__a)[0], ((__u32x4)__a)[1]}, __u64x2);1572}1573 1574static __inline__ v128_t __DEFAULT_FN_ATTRS1575wasm_u64x2_extend_high_u32x4(v128_t __a) {1576 return (v128_t) __builtin_convertvector(1577 (__u32x2){((__u32x4)__a)[2], ((__u32x4)__a)[3]}, __u64x2);1578}1579 1580static __inline__ v128_t __DEFAULT_FN_ATTRS1581wasm_i16x8_extadd_pairwise_i8x16(v128_t __a) {1582 return (v128_t)__builtin_wasm_extadd_pairwise_i8x16_s_i16x8((__i8x16)__a);1583}1584 1585static __inline__ v128_t __DEFAULT_FN_ATTRS1586wasm_u16x8_extadd_pairwise_u8x16(v128_t __a) {1587 return (v128_t)__builtin_wasm_extadd_pairwise_i8x16_u_i16x8((__u8x16)__a);1588}1589 1590static __inline__ v128_t __DEFAULT_FN_ATTRS1591wasm_i32x4_extadd_pairwise_i16x8(v128_t __a) {1592 return (v128_t)__builtin_wasm_extadd_pairwise_i16x8_s_i32x4((__i16x8)__a);1593}1594 1595static __inline__ v128_t __DEFAULT_FN_ATTRS1596wasm_u32x4_extadd_pairwise_u16x8(v128_t __a) {1597 return (v128_t)__builtin_wasm_extadd_pairwise_i16x8_u_i32x4((__u16x8)__a);1598}1599 1600static __inline__ v128_t __DEFAULT_FN_ATTRS1601wasm_i16x8_extmul_low_i8x16(v128_t __a, v128_t __b) {1602 return (v128_t)((__i16x8)wasm_i16x8_extend_low_i8x16(__a) *1603 (__i16x8)wasm_i16x8_extend_low_i8x16(__b));1604}1605 1606static __inline__ v128_t __DEFAULT_FN_ATTRS1607wasm_i16x8_extmul_high_i8x16(v128_t __a, v128_t __b) {1608 return (v128_t)((__i16x8)wasm_i16x8_extend_high_i8x16(__a) *1609 (__i16x8)wasm_i16x8_extend_high_i8x16(__b));1610}1611 1612static __inline__ v128_t __DEFAULT_FN_ATTRS1613wasm_u16x8_extmul_low_u8x16(v128_t __a, v128_t __b) {1614 return (v128_t)((__u16x8)wasm_u16x8_extend_low_u8x16(__a) *1615 (__u16x8)wasm_u16x8_extend_low_u8x16(__b));1616}1617 1618static __inline__ v128_t __DEFAULT_FN_ATTRS1619wasm_u16x8_extmul_high_u8x16(v128_t __a, v128_t __b) {1620 return (v128_t)((__u16x8)wasm_u16x8_extend_high_u8x16(__a) *1621 (__u16x8)wasm_u16x8_extend_high_u8x16(__b));1622}1623 1624static __inline__ v128_t __DEFAULT_FN_ATTRS1625wasm_i32x4_extmul_low_i16x8(v128_t __a, v128_t __b) {1626 return (v128_t)((__i32x4)wasm_i32x4_extend_low_i16x8(__a) *1627 (__i32x4)wasm_i32x4_extend_low_i16x8(__b));1628}1629 1630static __inline__ v128_t __DEFAULT_FN_ATTRS1631wasm_i32x4_extmul_high_i16x8(v128_t __a, v128_t __b) {1632 return (v128_t)((__i32x4)wasm_i32x4_extend_high_i16x8(__a) *1633 (__i32x4)wasm_i32x4_extend_high_i16x8(__b));1634}1635 1636static __inline__ v128_t __DEFAULT_FN_ATTRS1637wasm_u32x4_extmul_low_u16x8(v128_t __a, v128_t __b) {1638 return (v128_t)((__u32x4)wasm_u32x4_extend_low_u16x8(__a) *1639 (__u32x4)wasm_u32x4_extend_low_u16x8(__b));1640}1641 1642static __inline__ v128_t __DEFAULT_FN_ATTRS1643wasm_u32x4_extmul_high_u16x8(v128_t __a, v128_t __b) {1644 return (v128_t)((__u32x4)wasm_u32x4_extend_high_u16x8(__a) *1645 (__u32x4)wasm_u32x4_extend_high_u16x8(__b));1646}1647 1648static __inline__ v128_t __DEFAULT_FN_ATTRS1649wasm_i64x2_extmul_low_i32x4(v128_t __a, v128_t __b) {1650 return (v128_t)((__i64x2)wasm_i64x2_extend_low_i32x4(__a) *1651 (__i64x2)wasm_i64x2_extend_low_i32x4(__b));1652}1653 1654static __inline__ v128_t __DEFAULT_FN_ATTRS1655wasm_i64x2_extmul_high_i32x4(v128_t __a, v128_t __b) {1656 return (v128_t)((__i64x2)wasm_i64x2_extend_high_i32x4(__a) *1657 (__i64x2)wasm_i64x2_extend_high_i32x4(__b));1658}1659 1660static __inline__ v128_t __DEFAULT_FN_ATTRS1661wasm_u64x2_extmul_low_u32x4(v128_t __a, v128_t __b) {1662 return (v128_t)((__u64x2)wasm_u64x2_extend_low_u32x4(__a) *1663 (__u64x2)wasm_u64x2_extend_low_u32x4(__b));1664}1665 1666static __inline__ v128_t __DEFAULT_FN_ATTRS1667wasm_u64x2_extmul_high_u32x4(v128_t __a, v128_t __b) {1668 return (v128_t)((__u64x2)wasm_u64x2_extend_high_u32x4(__a) *1669 (__u64x2)wasm_u64x2_extend_high_u32x4(__b));1670}1671 1672static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i16x8_q15mulr_sat(v128_t __a,1673 v128_t __b) {1674 return (v128_t)__builtin_wasm_q15mulr_sat_s_i16x8((__i16x8)__a, (__i16x8)__b);1675}1676 1677// Old intrinsic names supported to ease transitioning to the standard names. Do1678// not use these; they will be removed in the near future.1679 1680#define __DEPRECATED_FN_ATTRS(__replacement) \1681 __DEFAULT_FN_ATTRS __attribute__( \1682 (deprecated("use " __replacement " instead", __replacement)))1683 1684#define __WASM_STR(X) #X1685 1686#ifdef __DEPRECATED1687#define __DEPRECATED_WASM_MACRO(__name, __replacement) \1688 _Pragma(__WASM_STR(GCC warning( \1689 "'" __name "' is deprecated: use '" __replacement "' instead")))1690#else1691#define __DEPRECATED_WASM_MACRO(__name, __replacement)1692#endif1693 1694static __inline__ v128_t __DEPRECATED_FN_ATTRS("wasm_v128_load8_splat")1695wasm_v8x16_load_splat(const void *__mem) {1696 return wasm_v128_load8_splat(__mem);1697}1698 1699static __inline__ v128_t __DEPRECATED_FN_ATTRS("wasm_v128_load16_splat")1700wasm_v16x8_load_splat(const void *__mem) {1701 return wasm_v128_load16_splat(__mem);1702}1703 1704static __inline__ v128_t __DEPRECATED_FN_ATTRS("wasm_v128_load32_splat")1705wasm_v32x4_load_splat(const void *__mem) {1706 return wasm_v128_load32_splat(__mem);1707}1708 1709static __inline__ v128_t __DEPRECATED_FN_ATTRS("wasm_v128_load64_splat")1710wasm_v64x2_load_splat(const void *__mem) {1711 return wasm_v128_load64_splat(__mem);1712}1713 1714static __inline__ v128_t __DEPRECATED_FN_ATTRS("wasm_i16x8_load8x8")1715wasm_i16x8_load_8x8(const void *__mem) {1716 return wasm_i16x8_load8x8(__mem);1717}1718 1719static __inline__ v128_t __DEPRECATED_FN_ATTRS("wasm_u16x8_load8x8")1720wasm_u16x8_load_8x8(const void *__mem) {1721 return wasm_u16x8_load8x8(__mem);1722}1723 1724static __inline__ v128_t __DEPRECATED_FN_ATTRS("wasm_i32x4_load16x4")1725wasm_i32x4_load_16x4(const void *__mem) {1726 return wasm_i32x4_load16x4(__mem);1727}1728 1729static __inline__ v128_t __DEPRECATED_FN_ATTRS("wasm_u32x4_load16x4")1730wasm_u32x4_load_16x4(const void *__mem) {1731 return wasm_u32x4_load16x4(__mem);1732}1733 1734static __inline__ v128_t __DEPRECATED_FN_ATTRS("wasm_i64x2_load32x2")1735wasm_i64x2_load_32x2(const void *__mem) {1736 return wasm_i64x2_load32x2(__mem);1737}1738 1739static __inline__ v128_t __DEPRECATED_FN_ATTRS("wasm_u64x2_load32x2")1740wasm_u64x2_load_32x2(const void *__mem) {1741 return wasm_u64x2_load32x2(__mem);1742}1743 1744#define wasm_v8x16_shuffle(__a, __b, __c0, __c1, __c2, __c3, __c4, __c5, __c6, \1745 __c7, __c8, __c9, __c10, __c11, __c12, __c13, \1746 __c14, __c15) \1747 __DEPRECATED_WASM_MACRO("wasm_v8x16_shuffle", "wasm_i8x16_shuffle") \1748 wasm_i8x16_shuffle(__a, __b, __c0, __c1, __c2, __c3, __c4, __c5, __c6, __c7, \1749 __c8, __c9, __c10, __c11, __c12, __c13, __c14, __c15)1750 1751#define wasm_v16x8_shuffle(__a, __b, __c0, __c1, __c2, __c3, __c4, __c5, __c6, \1752 __c7) \1753 __DEPRECATED_WASM_MACRO("wasm_v16x8_shuffle", "wasm_i16x8_shuffle") \1754 wasm_i16x8_shuffle(__a, __b, __c0, __c1, __c2, __c3, __c4, __c5, __c6, __c7)1755 1756#define wasm_v32x4_shuffle(__a, __b, __c0, __c1, __c2, __c3) \1757 __DEPRECATED_WASM_MACRO("wasm_v32x4_shuffle", "wasm_i32x4_shuffle") \1758 wasm_i32x4_shuffle(__a, __b, __c0, __c1, __c2, __c3)1759 1760#define wasm_v64x2_shuffle(__a, __b, __c0, __c1) \1761 __DEPRECATED_WASM_MACRO("wasm_v64x2_shuffle", "wasm_i64x2_shuffle") \1762 wasm_i64x2_shuffle(__a, __b, __c0, __c1)1763 1764// Relaxed SIMD intrinsics1765 1766#define __RELAXED_FN_ATTRS \1767 __attribute__((__always_inline__, __nodebug__, __target__("relaxed-simd"), \1768 __min_vector_width__(128)))1769 1770static __inline__ v128_t __RELAXED_FN_ATTRS1771wasm_f32x4_relaxed_madd(v128_t __a, v128_t __b, v128_t __c) {1772 return (v128_t)__builtin_wasm_relaxed_madd_f32x4((__f32x4)__a, (__f32x4)__b,1773 (__f32x4)__c);1774}1775 1776static __inline__ v128_t __RELAXED_FN_ATTRS1777wasm_f32x4_relaxed_nmadd(v128_t __a, v128_t __b, v128_t __c) {1778 return (v128_t)__builtin_wasm_relaxed_nmadd_f32x4((__f32x4)__a, (__f32x4)__b,1779 (__f32x4)__c);1780}1781 1782static __inline__ v128_t __RELAXED_FN_ATTRS1783wasm_f64x2_relaxed_madd(v128_t __a, v128_t __b, v128_t __c) {1784 return (v128_t)__builtin_wasm_relaxed_madd_f64x2((__f64x2)__a, (__f64x2)__b,1785 (__f64x2)__c);1786}1787 1788static __inline__ v128_t __RELAXED_FN_ATTRS1789wasm_f64x2_relaxed_nmadd(v128_t __a, v128_t __b, v128_t __c) {1790 return (v128_t)__builtin_wasm_relaxed_nmadd_f64x2((__f64x2)__a, (__f64x2)__b,1791 (__f64x2)__c);1792}1793 1794static __inline__ v128_t __RELAXED_FN_ATTRS1795wasm_i8x16_relaxed_laneselect(v128_t __a, v128_t __b, v128_t __m) {1796 return (v128_t)__builtin_wasm_relaxed_laneselect_i8x16(1797 (__i8x16)__a, (__i8x16)__b, (__i8x16)__m);1798}1799 1800static __inline__ v128_t __RELAXED_FN_ATTRS1801wasm_i16x8_relaxed_laneselect(v128_t __a, v128_t __b, v128_t __m) {1802 return (v128_t)__builtin_wasm_relaxed_laneselect_i16x8(1803 (__i16x8)__a, (__i16x8)__b, (__i16x8)__m);1804}1805 1806static __inline__ v128_t __RELAXED_FN_ATTRS1807wasm_i32x4_relaxed_laneselect(v128_t __a, v128_t __b, v128_t __m) {1808 return (v128_t)__builtin_wasm_relaxed_laneselect_i32x4(1809 (__i32x4)__a, (__i32x4)__b, (__i32x4)__m);1810}1811 1812static __inline__ v128_t __RELAXED_FN_ATTRS1813wasm_i64x2_relaxed_laneselect(v128_t __a, v128_t __b, v128_t __m) {1814 return (v128_t)__builtin_wasm_relaxed_laneselect_i64x2(1815 (__i64x2)__a, (__i64x2)__b, (__i64x2)__m);1816}1817 1818static __inline__ v128_t __RELAXED_FN_ATTRS1819wasm_i8x16_relaxed_swizzle(v128_t __a, v128_t __s) {1820 return (v128_t)__builtin_wasm_relaxed_swizzle_i8x16((__i8x16)__a,1821 (__i8x16)__s);1822}1823 1824static __inline__ v128_t __RELAXED_FN_ATTRS wasm_f32x4_relaxed_min(v128_t __a,1825 v128_t __b) {1826 return (v128_t)__builtin_wasm_relaxed_min_f32x4((__f32x4)__a, (__f32x4)__b);1827}1828 1829static __inline__ v128_t __RELAXED_FN_ATTRS wasm_f32x4_relaxed_max(v128_t __a,1830 v128_t __b) {1831 return (v128_t)__builtin_wasm_relaxed_max_f32x4((__f32x4)__a, (__f32x4)__b);1832}1833 1834static __inline__ v128_t __RELAXED_FN_ATTRS wasm_f64x2_relaxed_min(v128_t __a,1835 v128_t __b) {1836 return (v128_t)__builtin_wasm_relaxed_min_f64x2((__f64x2)__a, (__f64x2)__b);1837}1838 1839static __inline__ v128_t __RELAXED_FN_ATTRS wasm_f64x2_relaxed_max(v128_t __a,1840 v128_t __b) {1841 return (v128_t)__builtin_wasm_relaxed_max_f64x2((__f64x2)__a, (__f64x2)__b);1842}1843 1844static __inline__ v128_t __RELAXED_FN_ATTRS1845wasm_i32x4_relaxed_trunc_f32x4(v128_t __a) {1846 return (v128_t)__builtin_wasm_relaxed_trunc_s_i32x4_f32x4((__f32x4)__a);1847}1848 1849static __inline__ v128_t __RELAXED_FN_ATTRS1850wasm_u32x4_relaxed_trunc_f32x4(v128_t __a) {1851 return (v128_t)__builtin_wasm_relaxed_trunc_u_i32x4_f32x4((__f32x4)__a);1852}1853 1854static __inline__ v128_t __RELAXED_FN_ATTRS1855wasm_i32x4_relaxed_trunc_f64x2_zero(v128_t __a) {1856 return (v128_t)__builtin_wasm_relaxed_trunc_s_zero_i32x4_f64x2((__f64x2)__a);1857}1858 1859static __inline__ v128_t __RELAXED_FN_ATTRS1860wasm_u32x4_relaxed_trunc_f64x2_zero(v128_t __a) {1861 return (v128_t)__builtin_wasm_relaxed_trunc_u_zero_i32x4_f64x2((__f64x2)__a);1862}1863 1864static __inline__ v128_t __RELAXED_FN_ATTRS1865wasm_i16x8_relaxed_q15mulr(v128_t __a, v128_t __b) {1866 return (v128_t)__builtin_wasm_relaxed_q15mulr_s_i16x8((__i16x8)__a,1867 (__i16x8)__b);1868}1869 1870static __inline__ v128_t __RELAXED_FN_ATTRS1871wasm_i16x8_relaxed_dot_i8x16_i7x16(v128_t __a, v128_t __b) {1872 return (v128_t)__builtin_wasm_relaxed_dot_i8x16_i7x16_s_i16x8((__i8x16)__a,1873 (__i8x16)__b);1874}1875 1876static __inline__ v128_t __RELAXED_FN_ATTRS1877wasm_i32x4_relaxed_dot_i8x16_i7x16_add(v128_t __a, v128_t __b, v128_t __c) {1878 return (v128_t)__builtin_wasm_relaxed_dot_i8x16_i7x16_add_s_i32x4(1879 (__i8x16)__a, (__i8x16)__b, (__i32x4)__c);1880}1881 1882// FP16 intrinsics1883#define __FP16_FN_ATTRS \1884 __attribute__((__always_inline__, __nodebug__, __target__("fp16"), \1885 __min_vector_width__(128)))1886 1887static __inline__ v128_t __FP16_FN_ATTRS wasm_f16x8_splat(float __a) {1888 return (v128_t)__builtin_wasm_splat_f16x8(__a);1889}1890 1891#ifdef __wasm_fp16__1892// TODO Replace the following macros with regular C functions and use normal1893// target-independent vector code like the other replace/extract instructions.1894 1895#define wasm_f16x8_extract_lane(__a, __i) \1896 (__builtin_wasm_extract_lane_f16x8((__f16x8)(__a), __i))1897 1898#define wasm_f16x8_replace_lane(__a, __i, __b) \1899 ((v128_t)__builtin_wasm_replace_lane_f16x8((__f16x8)(__a), __i, __b))1900 1901#endif1902 1903static __inline__ v128_t __FP16_FN_ATTRS wasm_f16x8_abs(v128_t __a) {1904 return (v128_t)__builtin_wasm_abs_f16x8((__f16x8)__a);1905}1906 1907static __inline__ v128_t __FP16_FN_ATTRS wasm_f16x8_neg(v128_t __a) {1908 return (v128_t)(-(__f16x8)__a);1909}1910 1911static __inline__ v128_t __FP16_FN_ATTRS wasm_f16x8_sqrt(v128_t __a) {1912 return (v128_t)__builtin_wasm_sqrt_f16x8((__f16x8)__a);1913}1914 1915static __inline__ v128_t __FP16_FN_ATTRS wasm_f16x8_ceil(v128_t __a) {1916 return (v128_t)__builtin_wasm_ceil_f16x8((__f16x8)__a);1917}1918 1919static __inline__ v128_t __FP16_FN_ATTRS wasm_f16x8_floor(v128_t __a) {1920 return (v128_t)__builtin_wasm_floor_f16x8((__f16x8)__a);1921}1922 1923static __inline__ v128_t __FP16_FN_ATTRS wasm_f16x8_trunc(v128_t __a) {1924 return (v128_t)__builtin_wasm_trunc_f16x8((__f16x8)__a);1925}1926 1927static __inline__ v128_t __FP16_FN_ATTRS wasm_f16x8_nearest(v128_t __a) {1928 return (v128_t)__builtin_wasm_nearest_f16x8((__f16x8)__a);1929}1930 1931static __inline__ v128_t __FP16_FN_ATTRS wasm_f16x8_eq(v128_t __a, v128_t __b) {1932 return (v128_t)((__f16x8)__a == (__f16x8)__b);1933}1934 1935static __inline__ v128_t __FP16_FN_ATTRS wasm_f16x8_ne(v128_t __a, v128_t __b) {1936 return (v128_t)((__f16x8)__a != (__f16x8)__b);1937}1938 1939static __inline__ v128_t __FP16_FN_ATTRS wasm_f16x8_lt(v128_t __a, v128_t __b) {1940 return (v128_t)((__f16x8)__a < (__f16x8)__b);1941}1942 1943static __inline__ v128_t __FP16_FN_ATTRS wasm_f16x8_gt(v128_t __a, v128_t __b) {1944 return (v128_t)((__f16x8)__a > (__f16x8)__b);1945}1946 1947static __inline__ v128_t __FP16_FN_ATTRS wasm_f16x8_le(v128_t __a, v128_t __b) {1948 return (v128_t)((__f16x8)__a <= (__f16x8)__b);1949}1950 1951static __inline__ v128_t __FP16_FN_ATTRS wasm_f16x8_ge(v128_t __a, v128_t __b) {1952 return (v128_t)((__f16x8)__a >= (__f16x8)__b);1953}1954 1955static __inline__ v128_t __FP16_FN_ATTRS wasm_f16x8_add(v128_t __a,1956 v128_t __b) {1957 return (v128_t)((__f16x8)__a + (__f16x8)__b);1958}1959 1960static __inline__ v128_t __FP16_FN_ATTRS wasm_f16x8_sub(v128_t __a,1961 v128_t __b) {1962 return (v128_t)((__f16x8)__a - (__f16x8)__b);1963}1964 1965static __inline__ v128_t __FP16_FN_ATTRS wasm_f16x8_mul(v128_t __a,1966 v128_t __b) {1967 return (v128_t)((__f16x8)__a * (__f16x8)__b);1968}1969 1970static __inline__ v128_t __FP16_FN_ATTRS wasm_f16x8_div(v128_t __a,1971 v128_t __b) {1972 return (v128_t)((__f16x8)__a / (__f16x8)__b);1973}1974 1975static __inline__ v128_t __FP16_FN_ATTRS wasm_f16x8_min(v128_t __a,1976 v128_t __b) {1977 return (v128_t)__builtin_wasm_min_f16x8((__f16x8)__a, (__f16x8)__b);1978}1979 1980static __inline__ v128_t __FP16_FN_ATTRS wasm_f16x8_max(v128_t __a,1981 v128_t __b) {1982 return (v128_t)__builtin_wasm_max_f16x8((__f16x8)__a, (__f16x8)__b);1983}1984 1985static __inline__ v128_t __FP16_FN_ATTRS wasm_f16x8_pmin(v128_t __a,1986 v128_t __b) {1987 return (v128_t)__builtin_wasm_pmin_f16x8((__f16x8)__a, (__f16x8)__b);1988}1989 1990static __inline__ v128_t __FP16_FN_ATTRS wasm_f16x8_pmax(v128_t __a,1991 v128_t __b) {1992 return (v128_t)__builtin_wasm_pmax_f16x8((__f16x8)__a, (__f16x8)__b);1993}1994 1995static __inline__ v128_t __FP16_FN_ATTRS1996wasm_i16x8_trunc_sat_f16x8(v128_t __a) {1997 return (v128_t)__builtin_wasm_trunc_saturate_s_i16x8_f16x8((__f16x8)__a);1998}1999 2000static __inline__ v128_t __FP16_FN_ATTRS2001wasm_u16x8_trunc_sat_f16x8(v128_t __a) {2002 return (v128_t)__builtin_wasm_trunc_saturate_u_i16x8_f16x8((__f16x8)__a);2003}2004 2005static __inline__ v128_t __FP16_FN_ATTRS wasm_f16x8_convert_i16x8(v128_t __a) {2006 return (v128_t) __builtin_convertvector((__i16x8)__a, __f16x8);2007}2008 2009static __inline__ v128_t __FP16_FN_ATTRS wasm_f16x8_convert_u16x8(v128_t __a) {2010 return (v128_t) __builtin_convertvector((__u16x8)__a, __f16x8);2011}2012 2013static __inline__ v128_t __FP16_FN_ATTRS wasm_f16x8_relaxed_madd(v128_t __a,2014 v128_t __b,2015 v128_t __c) {2016 return (v128_t)__builtin_wasm_relaxed_madd_f16x8((__f16x8)__a, (__f16x8)__b,2017 (__f16x8)__c);2018}2019 2020static __inline__ v128_t __FP16_FN_ATTRS wasm_f16x8_relaxed_nmadd(v128_t __a,2021 v128_t __b,2022 v128_t __c) {2023 return (v128_t)__builtin_wasm_relaxed_nmadd_f16x8((__f16x8)__a, (__f16x8)__b,2024 (__f16x8)__c);2025}2026 2027// Deprecated intrinsics2028 2029static __inline__ v128_t __DEPRECATED_FN_ATTRS("wasm_i8x16_swizzle")2030wasm_v8x16_swizzle(v128_t __a, v128_t __b) {2031 return wasm_i8x16_swizzle(__a, __b);2032}2033 2034static __inline__ bool __DEPRECATED_FN_ATTRS("wasm_v128_any_true")2035wasm_i8x16_any_true(v128_t __a) {2036 return wasm_v128_any_true(__a);2037}2038 2039static __inline__ bool __DEPRECATED_FN_ATTRS("wasm_v128_any_true")2040wasm_i16x8_any_true(v128_t __a) {2041 return wasm_v128_any_true(__a);2042}2043 2044static __inline__ bool __DEPRECATED_FN_ATTRS("wasm_v128_any_true")2045wasm_i32x4_any_true(v128_t __a) {2046 return wasm_v128_any_true(__a);2047}2048 2049static __inline__ v128_t __DEPRECATED_FN_ATTRS("wasm_i8x16_add_sat")2050wasm_i8x16_add_saturate(v128_t __a, v128_t __b) {2051 return wasm_i8x16_add_sat(__a, __b);2052}2053 2054static __inline__ v128_t __DEPRECATED_FN_ATTRS("wasm_u8x16_add_sat")2055wasm_u8x16_add_saturate(v128_t __a, v128_t __b) {2056 return wasm_u8x16_add_sat(__a, __b);2057}2058 2059static __inline__ v128_t __DEPRECATED_FN_ATTRS("wasm_i8x16_sub_sat")2060wasm_i8x16_sub_saturate(v128_t __a, v128_t __b) {2061 return wasm_i8x16_sub_sat(__a, __b);2062}2063 2064static __inline__ v128_t __DEPRECATED_FN_ATTRS("wasm_u8x16_sub_sat")2065wasm_u8x16_sub_saturate(v128_t __a, v128_t __b) {2066 return wasm_u8x16_sub_sat(__a, __b);2067}2068 2069static __inline__ v128_t __DEPRECATED_FN_ATTRS("wasm_i16x8_add_sat")2070wasm_i16x8_add_saturate(v128_t __a, v128_t __b) {2071 return wasm_i16x8_add_sat(__a, __b);2072}2073 2074static __inline__ v128_t __DEPRECATED_FN_ATTRS("wasm_u16x8_add_sat")2075wasm_u16x8_add_saturate(v128_t __a, v128_t __b) {2076 return wasm_u16x8_add_sat(__a, __b);2077}2078 2079static __inline__ v128_t __DEPRECATED_FN_ATTRS("wasm_i16x8_sub_sat")2080wasm_i16x8_sub_saturate(v128_t __a, v128_t __b) {2081 return wasm_i16x8_sub_sat(__a, __b);2082}2083 2084static __inline__ v128_t __DEPRECATED_FN_ATTRS("wasm_u16x8_sub_sat")2085wasm_u16x8_sub_saturate(v128_t __a, v128_t __b) {2086 return wasm_u16x8_sub_sat(__a, __b);2087}2088 2089static __inline__ v128_t __DEPRECATED_FN_ATTRS("wasm_i16x8_extend_low_i8x16")2090wasm_i16x8_widen_low_i8x16(v128_t __a) {2091 return wasm_i16x8_extend_low_i8x16(__a);2092}2093 2094static __inline__ v128_t __DEPRECATED_FN_ATTRS("wasm_i16x8_extend_high_i8x16")2095wasm_i16x8_widen_high_i8x16(v128_t __a) {2096 return wasm_i16x8_extend_high_i8x16(__a);2097}2098 2099static __inline__ v128_t __DEPRECATED_FN_ATTRS("wasm_u16x8_extend_low_u8x16")2100wasm_i16x8_widen_low_u8x16(v128_t __a) {2101 return wasm_u16x8_extend_low_u8x16(__a);2102}2103 2104static __inline__ v128_t __DEPRECATED_FN_ATTRS("wasm_u16x8_extend_high_u8x16")2105wasm_i16x8_widen_high_u8x16(v128_t __a) {2106 return wasm_u16x8_extend_high_u8x16(__a);2107}2108 2109static __inline__ v128_t __DEPRECATED_FN_ATTRS("wasm_i32x4_extend_low_i16x8")2110wasm_i32x4_widen_low_i16x8(v128_t __a) {2111 return wasm_i32x4_extend_low_i16x8(__a);2112}2113 2114static __inline__ v128_t __DEPRECATED_FN_ATTRS("wasm_i32x4_extend_high_i16x8")2115wasm_i32x4_widen_high_i16x8(v128_t __a) {2116 return wasm_i32x4_extend_high_i16x8(__a);2117}2118 2119static __inline__ v128_t __DEPRECATED_FN_ATTRS("wasm_u32x4_extend_low_u16x8")2120wasm_i32x4_widen_low_u16x8(v128_t __a) {2121 return wasm_u32x4_extend_low_u16x8(__a);2122}2123 2124static __inline__ v128_t __DEPRECATED_FN_ATTRS("wasm_u32x4_extend_high_u16x8")2125wasm_i32x4_widen_high_u16x8(v128_t __a) {2126 return wasm_u32x4_extend_high_u16x8(__a);2127}2128 2129static __inline__ v128_t __DEPRECATED_FN_ATTRS("wasm_i32x4_trunc_sat_f32x4")2130wasm_i32x4_trunc_saturate_f32x4(v128_t __a) {2131 return wasm_i32x4_trunc_sat_f32x4(__a);2132}2133 2134static __inline__ v128_t __DEPRECATED_FN_ATTRS("wasm_u32x4_trunc_sat_f32x4")2135wasm_u32x4_trunc_saturate_f32x4(v128_t __a) {2136 return wasm_u32x4_trunc_sat_f32x4(__a);2137}2138 2139// Undefine helper macros2140#undef __DEFAULT_FN_ATTRS2141#undef __DEPRECATED_FN_ATTRS2142 2143#endif // __WASM_SIMD128_H2144