Commit 5634cec0 authored by Yi-Yen Chung's avatar Yi-Yen Chung Committed by GitHub

NEON: more fp16 using intrinsics supported by architecture v7 (skip version) (#1081)

* [NEON] Add vabal_{s/u}{8/16/32}

* [NEON] Add vabal_high_{s/u}{8/16/32}

* [NEON] Add all vcale* intrinsics (9)

* [NEON] Add all vcalt intrinsics (9)

* [NEON] Add vcreate_f16

* [NEON] Add vreinterpret_u64_f16

* [NEON] Add vcvth_f16_s16 and vcvth_f16_u16

* [NEON] Add vduph_lane_f16, vdup_lane_f16, and vdupq_lane_f16

* [NEON] Add vext_f16

* [NEON] Add 16 vcvt{q}_n_* intrinsics

* [Fix] Correct function input parameters

* [NEON] Add 6 vcvtn_{s/u}{16/32/64}_f{*} intrinsics

* [Fix] Correct vdup_lane_f16 and vdupq_lane_f16.

* [Fix] Correct function input parameters.

* [NEON] Add 24 vcvt{q}_n_* intrinsics

* [NEON] Add all vcvtn* intrinsics

* [NEON] Add vfmah_f16 and vfma_f16

* [NEON] Add vfma_n_f16 and vfmaq_n_f16

* [NEON] Add vmulh_f16

* [NEON] Add fma_lane related intrinsics.

* [NEON] Add 5 vmul* related intrinsics
vmulh_lane_f16, vmulh_laneq_f16, vmul_lane_f16,
vmul_laneq_f16, vmulq_laneq_f16.

* [NEON] Add neg related intrinsics.

* [NEON] Add all fms, fms_n, and fms_lane intrinsics

* [NEON] Add types float16x{4/8}x{2/3/4}

* [NEON] Add 9 vld1 related intrinsics

* [Fix] Modified wrong rounding implementation.
Modified wrong implementation "Ties to Away" to "rounding to nearest
with ties to Away"
add.h: Remove redundant code.

* [Fix] Fix wrong intrinsic alias names.

* [Refactor] Remove redundant functions.

* [NEON] Add 45 ld2 related intrinsics
one ld2_f16, twenty-two ld2_lane series, and twenty-two ld2_dup series.

* [NEON] Add ld3_dup, ld3_lane, and ld4_dup

* [NEON] Add vld3_f16 and vld4_f16.

* [NEON] Add vld{3/4}_{dup/lane} series intrinsics

* [NEON] Add mla_{high}_lane series intrinsics

* [NEON] Add qdmlal_{high}_{lane} series intrinsics.

* [NEON] Add qdmlal_lane and qdmlal_n series intrinsics

* [NEON] Add mls_lane and mlsl_high_lane series intrinsics

* [NEON] Add 22 qdmlsl series intrinsics

* [NEON] Add 10 qdmull_* series intrinsics

* [NEON] Add 3 qdmulh series intrinsics

* [Fix] Fix wrong function name.

* [Fix] Correct the wrong alias function name.

* [NEON] Add qdmullh_lane{q}_s{16/32} related intrinsics

* [NEON] Add qdmull_n and qdmull_high_lane series intrinsics

* [Fix] Add conditions for fp16 intrinsics

* [Hack] Skip functions that trigger compiler bugs.
parent cfd91723
...@@ -31,6 +31,8 @@ ...@@ -31,6 +31,8 @@
#include "neon/types.h" #include "neon/types.h"
#include "neon/aba.h" #include "neon/aba.h"
#include "neon/abal.h"
#include "neon/abal_high.h"
#include "neon/abd.h" #include "neon/abd.h"
#include "neon/abdl.h" #include "neon/abdl.h"
#include "neon/abs.h" #include "neon/abs.h"
...@@ -50,6 +52,8 @@ ...@@ -50,6 +52,8 @@
#include "neon/cadd_rot90.h" #include "neon/cadd_rot90.h"
#include "neon/cage.h" #include "neon/cage.h"
#include "neon/cagt.h" #include "neon/cagt.h"
#include "neon/cale.h"
#include "neon/calt.h"
#include "neon/ceq.h" #include "neon/ceq.h"
#include "neon/ceqz.h" #include "neon/ceqz.h"
#include "neon/cge.h" #include "neon/cge.h"
...@@ -72,6 +76,7 @@ ...@@ -72,6 +76,7 @@
#include "neon/cmla_rot270.h" #include "neon/cmla_rot270.h"
#include "neon/cnt.h" #include "neon/cnt.h"
#include "neon/cvt.h" #include "neon/cvt.h"
#include "neon/cvt_n.h"
#include "neon/cvtn.h" #include "neon/cvtn.h"
#include "neon/combine.h" #include "neon/combine.h"
#include "neon/create.h" #include "neon/create.h"
...@@ -85,6 +90,9 @@ ...@@ -85,6 +90,9 @@
#include "neon/fma.h" #include "neon/fma.h"
#include "neon/fma_lane.h" #include "neon/fma_lane.h"
#include "neon/fma_n.h" #include "neon/fma_n.h"
#include "neon/fms.h"
#include "neon/fms_lane.h"
#include "neon/fms_n.h"
#include "neon/get_high.h" #include "neon/get_high.h"
#include "neon/get_lane.h" #include "neon/get_lane.h"
#include "neon/get_low.h" #include "neon/get_low.h"
...@@ -100,8 +108,13 @@ ...@@ -100,8 +108,13 @@
#include "neon/ld1q_x3.h" #include "neon/ld1q_x3.h"
#include "neon/ld1q_x4.h" #include "neon/ld1q_x4.h"
#include "neon/ld2.h" #include "neon/ld2.h"
#include "neon/ld2_dup.h"
#include "neon/ld2_lane.h"
#include "neon/ld3.h" #include "neon/ld3.h"
#include "neon/ld3_dup.h"
#include "neon/ld3_lane.h"
#include "neon/ld4.h" #include "neon/ld4.h"
#include "neon/ld4_dup.h"
#include "neon/ld4_lane.h" #include "neon/ld4_lane.h"
#include "neon/max.h" #include "neon/max.h"
#include "neon/maxnm.h" #include "neon/maxnm.h"
...@@ -114,16 +127,20 @@ ...@@ -114,16 +127,20 @@
#include "neon/mla_n.h" #include "neon/mla_n.h"
#include "neon/mlal.h" #include "neon/mlal.h"
#include "neon/mlal_high.h" #include "neon/mlal_high.h"
#include "neon/mlal_high_lane.h"
#include "neon/mlal_high_n.h" #include "neon/mlal_high_n.h"
#include "neon/mlal_lane.h" #include "neon/mlal_lane.h"
#include "neon/mlal_n.h" #include "neon/mlal_n.h"
#include "neon/mls.h" #include "neon/mls.h"
#include "neon/mls_lane.h"
#include "neon/mls_n.h" #include "neon/mls_n.h"
#include "neon/mlsl.h" #include "neon/mlsl.h"
#include "neon/mlsl_high.h" #include "neon/mlsl_high.h"
#include "neon/mlsl_high_lane.h"
#include "neon/mlsl_high_n.h" #include "neon/mlsl_high_n.h"
#include "neon/mlsl_lane.h" #include "neon/mlsl_lane.h"
#include "neon/mlsl_n.h" #include "neon/mlsl_n.h"
//#include "neon/mmlaq.h"
#include "neon/movl.h" #include "neon/movl.h"
#include "neon/movl_high.h" #include "neon/movl_high.h"
#include "neon/movn.h" #include "neon/movn.h"
...@@ -146,10 +163,27 @@ ...@@ -146,10 +163,27 @@
#include "neon/pmin.h" #include "neon/pmin.h"
#include "neon/qabs.h" #include "neon/qabs.h"
#include "neon/qadd.h" #include "neon/qadd.h"
#include "neon/qdmlal.h"
#include "neon/qdmlal_high.h"
#include "neon/qdmlal_high_lane.h"
#include "neon/qdmlal_high_n.h"
#include "neon/qdmlal_lane.h"
#include "neon/qdmlal_n.h"
#include "neon/qdmlsl.h"
#include "neon/qdmlsl_high.h"
#include "neon/qdmlsl_high_lane.h"
#include "neon/qdmlsl_high_n.h"
#include "neon/qdmlsl_lane.h"
#include "neon/qdmlsl_n.h"
#include "neon/qdmulh.h" #include "neon/qdmulh.h"
#include "neon/qdmulh_lane.h" #include "neon/qdmulh_lane.h"
#include "neon/qdmulh_n.h" #include "neon/qdmulh_n.h"
#include "neon/qdmull.h" #include "neon/qdmull.h"
#include "neon/qdmull_high.h"
#include "neon/qdmull_high_lane.h"
#include "neon/qdmull_high_n.h"
#include "neon/qdmull_lane.h"
#include "neon/qdmull_n.h"
#include "neon/qrdmulh.h" #include "neon/qrdmulh.h"
#include "neon/qrdmulh_lane.h" #include "neon/qrdmulh_lane.h"
#include "neon/qrdmulh_n.h" #include "neon/qrdmulh_n.h"
......
/* SPDX-License-Identifier: MIT
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* Copyright:
* 2023 Yi-Yen Chung <eric681@andestech.com> (Copyright owned by Andes Technology)
*/
#if !defined(SIMDE_ARM_NEON_ABAL_H)
#define SIMDE_ARM_NEON_ABAL_H
#include "abdl.h"
#include "add.h"
HEDLEY_DIAGNOSTIC_PUSH
SIMDE_DISABLE_UNWANTED_DIAGNOSTICS
SIMDE_BEGIN_DECLS_
SIMDE_FUNCTION_ATTRIBUTES
simde_int16x8_t
simde_vabal_s8(simde_int16x8_t a, simde_int8x8_t b, simde_int8x8_t c) {
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
return vabal_s8(a, b, c);
#else
return simde_vaddq_s16(simde_vabdl_s8(b, c), a);
#endif
}
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
#undef vabal_s8
#define vabal_s8(a, b, c) simde_vabal_s8((a), (b), (c))
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde_int32x4_t
simde_vabal_s16(simde_int32x4_t a, simde_int16x4_t b, simde_int16x4_t c) {
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
return vabal_s16(a, b, c);
#else
return simde_vaddq_s32(simde_vabdl_s16(b, c), a);
#endif
}
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
#undef vabal_s16
#define vabal_s16(a, b, c) simde_vabal_s16((a), (b), (c))
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde_int64x2_t
simde_vabal_s32(simde_int64x2_t a, simde_int32x2_t b, simde_int32x2_t c) {
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
return vabal_s32(a, b, c);
#else
return simde_vaddq_s64(simde_vabdl_s32(b, c), a);
#endif
}
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
#undef vabal_s32
#define vabal_s32(a, b, c) simde_vabal_s32((a), (b), (c))
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde_uint16x8_t
simde_vabal_u8(simde_uint16x8_t a, simde_uint8x8_t b, simde_uint8x8_t c) {
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
return vabal_u8(a, b, c);
#else
return simde_vaddq_u16(simde_vabdl_u8(b, c), a);
#endif
}
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
#undef vabal_u8
#define vabal_u8(a, b, c) simde_vabal_u8((a), (b), (c))
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde_uint32x4_t
simde_vabal_u16(simde_uint32x4_t a, simde_uint16x4_t b, simde_uint16x4_t c) {
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
return vabal_u16(a, b, c);
#else
return simde_vaddq_u32(simde_vabdl_u16(b, c), a);
#endif
}
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
#undef vabal_u16
#define vabal_u16(a, b, c) simde_vabal_u16((a), (b), (c))
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde_uint64x2_t
simde_vabal_u32(simde_uint64x2_t a, simde_uint32x2_t b, simde_uint32x2_t c) {
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
return vabal_u32(a, b, c);
#else
return simde_vaddq_u64(simde_vabdl_u32(b, c), a);
#endif
}
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
#undef vabal_u32
#define vabal_u32(a, b, c) simde_vabal_u32((a), (b), (c))
#endif
SIMDE_END_DECLS_
HEDLEY_DIAGNOSTIC_POP
#endif /* !defined(SIMDE_ARM_NEON_abal_H) */
/* SPDX-License-Identifier: MIT
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* Copyright:
* 2023 Yi-Yen Chung <eric681@andestech.com> (Copyright owned by Andes Technology)
*/
#if !defined(SIMDE_ARM_NEON_ABAL_HIGH_H)
#define SIMDE_ARM_NEON_ABAL_HIGH_H
#include "abdl.h"
#include "add.h"
#include "movl_high.h"
HEDLEY_DIAGNOSTIC_PUSH
SIMDE_DISABLE_UNWANTED_DIAGNOSTICS
SIMDE_BEGIN_DECLS_
SIMDE_FUNCTION_ATTRIBUTES
simde_int16x8_t
simde_vabal_high_s8(simde_int16x8_t a, simde_int8x16_t b, simde_int8x16_t c) {
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
return vabal_high_s8(a, b, c);
#else
return simde_vaddq_s16(simde_vabdl_s8(simde_vget_high_s8(b), simde_vget_high_s8(c)), a);
#endif
}
#if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
#undef vabal_high_s8
#define vabal_high_s8(a, b, c) simde_vabal_high_s8((a), (b), (c))
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde_int32x4_t
simde_vabal_high_s16(simde_int32x4_t a, simde_int16x8_t b, simde_int16x8_t c) {
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
return vabal_high_s16(a, b, c);
#else
return simde_vaddq_s32(simde_vabdl_s16(simde_vget_high_s16(b), simde_vget_high_s16(c)), a);
#endif
}
#if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
#undef vabal_high_s16
#define vabal_high_s16(a, b, c) simde_vabal_high_s16((a), (b), (c))
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde_int64x2_t
simde_vabal_high_s32(simde_int64x2_t a, simde_int32x4_t b, simde_int32x4_t c) {
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
return vabal_high_s32(a, b, c);
#else
return simde_vaddq_s64(simde_vabdl_s32(simde_vget_high_s32(b), simde_vget_high_s32(c)), a);
#endif
}
#if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
#undef vabal_high_s32
#define vabal_high_s32(a, b, c) simde_vabal_high_s32((a), (b), (c))
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde_uint16x8_t
simde_vabal_high_u8(simde_uint16x8_t a, simde_uint8x16_t b, simde_uint8x16_t c) {
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
return vabal_high_u8(a, b, c);
#else
return simde_vaddq_u16(simde_vabdl_u8(simde_vget_high_u8(b), simde_vget_high_u8(c)), a);
#endif
}
#if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
#undef vabal_high_u8
#define vabal_high_u8(a, b, c) simde_vabal_high_u8((a), (b), (c))
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde_uint32x4_t
simde_vabal_high_u16(simde_uint32x4_t a, simde_uint16x8_t b, simde_uint16x8_t c) {
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
return vabal_high_u16(a, b, c);
#else
return simde_vaddq_u32(simde_vabdl_u16(simde_vget_high_u16(b), simde_vget_high_u16(c)), a);
#endif
}
#if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
#undef vabal_high_u16
#define vabal_high_u16(a, b, c) simde_vabal_high_u16((a), (b), (c))
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde_uint64x2_t
simde_vabal_high_u32(simde_uint64x2_t a, simde_uint32x4_t b, simde_uint32x4_t c) {
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
return vabal_high_u32(a, b, c);
#else
return simde_vaddq_u64(simde_vabdl_u32(simde_vget_high_u32(b), simde_vget_high_u32(c)), a);
#endif
}
#if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
#undef vabal_high_u32
#define vabal_high_u32(a, b, c) simde_vabal_high_u32((a), (b), (c))
#endif
SIMDE_END_DECLS_
HEDLEY_DIAGNOSTIC_POP
#endif /* !defined(SIMDE_ARM_NEON_abal_H) */
/* SPDX-License-Identifier: MIT
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* Copyright:
* 2023 Yi-Yen Chung <eric681@andestech.com> (Copyright owned by Andes Technology)
*/
#if !defined(SIMDE_ARM_NEON_CALE_H)
#define SIMDE_ARM_NEON_CALE_H
#include "cage.h"
HEDLEY_DIAGNOSTIC_PUSH
SIMDE_DISABLE_UNWANTED_DIAGNOSTICS
SIMDE_BEGIN_DECLS_
SIMDE_FUNCTION_ATTRIBUTES
uint16_t
simde_vcaleh_f16(simde_float16_t a, simde_float16_t b) {
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE) && defined(SIMDE_ARM_NEON_FP16)
return vcaleh_f16(a, b);
#else
return simde_vcageh_f16(b, a);
#endif
}
#if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
#undef vcaleh_f16
#define vcaleh_f16(a, b) simde_vcaleh_f16((a), (b))
#endif
SIMDE_FUNCTION_ATTRIBUTES
uint32_t
simde_vcales_f32(simde_float32_t a, simde_float32_t b) {
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
return vcales_f32(a, b);
#else
return simde_vcages_f32(b, a);
#endif
}
#if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
#undef vcales_f32
#define vcales_f32(a, b) simde_vcales_f32((a), (b))
#endif
SIMDE_FUNCTION_ATTRIBUTES
uint64_t
simde_vcaled_f64(simde_float64_t a, simde_float64_t b) {
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
return vcaled_f64(a, b);
#else
return simde_vcaged_f64(b, a);
#endif
}
#if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
#undef vcaled_f64
#define vcaled_f64(a, b) simde_vcaled_f64((a), (b))
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde_uint16x4_t
simde_vcale_f16(simde_float16x4_t a, simde_float16x4_t b) {
#if defined(SIMDE_ARM_NEON_A32V8_NATIVE) && defined(SIMDE_ARM_NEON_FP16)
return vcale_f16(a, b);
#else
return simde_vcage_f16(b, a);
#endif
}
#if defined(SIMDE_ARM_NEON_A32V8_ENABLE_NATIVE_ALIASES)
#undef vcale_f16
#define vcale_f16(a, b) simde_vcale_f16((a), (b))
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde_uint32x2_t
simde_vcale_f32(simde_float32x2_t a, simde_float32x2_t b) {
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
return vcale_f32(a, b);
#else
return simde_vcage_f32(b, a);
#endif
}
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
#undef vcale_f32
#define vcale_f32(a, b) simde_vcale_f32((a), (b))
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde_uint64x1_t
simde_vcale_f64(simde_float64x1_t a, simde_float64x1_t b) {
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
return vcale_f64(a, b);
#else
return simde_vcage_f64(b, a);
#endif
}
#if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
#undef vcale_f64
#define vcale_f64(a, b) simde_vcale_f64((a), (b))
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde_uint16x8_t
simde_vcaleq_f16(simde_float16x8_t a, simde_float16x8_t b) {
#if defined(SIMDE_ARM_NEON_A32V8_NATIVE) && defined(SIMDE_ARM_NEON_FP16)
return vcaleq_f16(a, b);
#else
return simde_vcageq_f16(b, a);
#endif
}
#if defined(SIMDE_ARM_NEON_A32V8_ENABLE_NATIVE_ALIASES)
#undef vcaleq_f16
#define vcaleq_f16(a, b) simde_vcaleq_f16((a), (b))
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde_uint32x4_t
simde_vcaleq_f32(simde_float32x4_t a, simde_float32x4_t b) {
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
return vcaleq_f32(a, b);
#else
return simde_vcageq_f32(b, a);
#endif
}
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
#undef vcaleq_f32
#define vcaleq_f32(a, b) simde_vcaleq_f32((a), (b))
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde_uint64x2_t
simde_vcaleq_f64(simde_float64x2_t a, simde_float64x2_t b) {
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
return vcaleq_f64(a, b);
#else
return simde_vcageq_f64(b, a);
#endif
}
#if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
#undef vcaleq_f64
#define vcaleq_f64(a, b) simde_vcaleq_f64((a), (b))
#endif
SIMDE_END_DECLS_
HEDLEY_DIAGNOSTIC_POP
#endif /* !defined(SIMDE_ARM_NEON_cale_H) */
/* SPDX-License-Identifier: MIT
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* Copyright:
* 2023 Yi-Yen Chung <eric681@andestech.com> (Copyright owned by Andes Technology)
*/
#if !defined(SIMDE_ARM_NEON_CALT_H)
#define SIMDE_ARM_NEON_CALT_H
#include "cagt.h"
HEDLEY_DIAGNOSTIC_PUSH
SIMDE_DISABLE_UNWANTED_DIAGNOSTICS
SIMDE_BEGIN_DECLS_
SIMDE_FUNCTION_ATTRIBUTES
uint16_t
simde_vcalth_f16(simde_float16_t a, simde_float16_t b) {
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE) && defined(SIMDE_ARM_NEON_FP16)
return vcalth_f16(a, b);
#else
return simde_vcagth_f16(b, a);
#endif
}
#if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
#undef vcalth_f16
#define vcalth_f16(a, b) simde_vcalth_f16((a), (b))
#endif
SIMDE_FUNCTION_ATTRIBUTES
uint32_t
simde_vcalts_f32(simde_float32_t a, simde_float32_t b) {
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
return vcalts_f32(a, b);
#else
return simde_vcagts_f32(b, a);
#endif
}
#if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
#undef vcalts_f32
#define vcalts_f32(a, b) simde_vcalts_f32((a), (b))
#endif
SIMDE_FUNCTION_ATTRIBUTES
uint64_t
simde_vcaltd_f64(simde_float64_t a, simde_float64_t b) {
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
return vcaltd_f64(a, b);
#else
return simde_vcagtd_f64(b, a);
#endif
}
#if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
#undef vcaltd_f64
#define vcaltd_f64(a, b) simde_vcaltd_f64((a), (b))
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde_uint16x4_t
simde_vcalt_f16(simde_float16x4_t a, simde_float16x4_t b) {
#if defined(SIMDE_ARM_NEON_A32V8_NATIVE) && defined(SIMDE_ARM_NEON_FP16)
return vcalt_f16(a, b);
#else
return simde_vcagt_f16(b, a);
#endif
}
#if defined(SIMDE_ARM_NEON_A32V8_ENABLE_NATIVE_ALIASES)
#undef vcalt_f16
#define vcalt_f16(a, b) simde_vcalt_f16((a), (b))
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde_uint32x2_t
simde_vcalt_f32(simde_float32x2_t a, simde_float32x2_t b) {
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
return vcalt_f32(a, b);
#else
return simde_vcagt_f32(b, a);
#endif
}
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
#undef vcalt_f32
#define vcalt_f32(a, b) simde_vcalt_f32((a), (b))
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde_uint64x1_t
simde_vcalt_f64(simde_float64x1_t a, simde_float64x1_t b) {
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
return vcalt_f64(a, b);
#else
return simde_vcagt_f64(b, a);
#endif
}
#if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
#undef vcalt_f64
#define vcalt_f64(a, b) simde_vcalt_f64((a), (b))
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde_uint16x8_t
simde_vcaltq_f16(simde_float16x8_t a, simde_float16x8_t b) {
#if defined(SIMDE_ARM_NEON_A32V8_NATIVE) && defined(SIMDE_ARM_NEON_FP16)
return vcaltq_f16(a, b);
#else
return simde_vcagtq_f16(b, a);
#endif
}
#if defined(SIMDE_ARM_NEON_A32V8_ENABLE_NATIVE_ALIASES)
#undef vcaltq_f16
#define vcaltq_f16(a, b) simde_vcaltq_f16((a), (b))
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde_uint32x4_t
simde_vcaltq_f32(simde_float32x4_t a, simde_float32x4_t b) {
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
return vcaltq_f32(a, b);
#else
return simde_vcagtq_f32(b, a);
#endif
}
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
#undef vcaltq_f32
#define vcaltq_f32(a, b) simde_vcaltq_f32((a), (b))
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde_uint64x2_t
simde_vcaltq_f64(simde_float64x2_t a, simde_float64x2_t b) {
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
return vcaltq_f64(a, b);
#else
return simde_vcagtq_f64(b, a);
#endif
}
#if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
#undef vcaltq_f64
#define vcaltq_f64(a, b) simde_vcaltq_f64((a), (b))
#endif
SIMDE_END_DECLS_
HEDLEY_DIAGNOSTIC_POP
#endif /* !defined(SIMDE_ARM_NEON_CAGT_H) */
...@@ -23,11 +23,10 @@ ...@@ -23,11 +23,10 @@
* Copyright: * Copyright:
* 2020 Evan Nemerson <evan@nemerson.com> * 2020 Evan Nemerson <evan@nemerson.com>
* 2020 Christopher Moore <moore@free.fr> * 2020 Christopher Moore <moore@free.fr>
* 2023 Yi-Yen Chung <eric681@andestech.com> (Copyright owned by Andes Technology)
*/ */
/* N.B. CM: vcreate_f16 and vcreate_bf16 are omitted as /* Yi-Yen Chung: Added vcreate_f16 */
* SIMDe has no 16-bit floating point support.
* Idem for the poly types. */
#if !defined(SIMDE_ARM_NEON_CREATE_H) #if !defined(SIMDE_ARM_NEON_CREATE_H)
#define SIMDE_ARM_NEON_CREATE_H #define SIMDE_ARM_NEON_CREATE_H
...@@ -152,6 +151,20 @@ simde_vcreate_u64(uint64_t a) { ...@@ -152,6 +151,20 @@ simde_vcreate_u64(uint64_t a) {
#define vcreate_u64(a) simde_vcreate_u64(a) #define vcreate_u64(a) simde_vcreate_u64(a)
#endif #endif
SIMDE_FUNCTION_ATTRIBUTES
simde_float16x4_t
simde_vcreate_f16(uint64_t a) {
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE) && defined(SIMDE_ARM_NEON_FP16)
return vcreate_f16(a);
#else
return simde_vreinterpret_f16_u64(simde_vdup_n_u64(a));
#endif
}
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
#undef vcreate_f16
#define vcreate_f16(a) simde_vcreate_f16(a)
#endif
SIMDE_FUNCTION_ATTRIBUTES SIMDE_FUNCTION_ATTRIBUTES
simde_float32x2_t simde_float32x2_t
simde_vcreate_f32(uint64_t a) { simde_vcreate_f32(uint64_t a) {
......
...@@ -141,9 +141,9 @@ simde_vcvt_f64_f32(simde_float32x2_t a) { ...@@ -141,9 +141,9 @@ simde_vcvt_f64_f32(simde_float32x2_t a) {
SIMDE_FUNCTION_ATTRIBUTES SIMDE_FUNCTION_ATTRIBUTES
int16_t int16_t
simde_x_vcvts_s16_f16(simde_float16 a) { simde_vcvth_s16_f16(simde_float16 a) {
#if defined(SIMDE_FAST_CONVERSION_RANGE) && defined(SIMDE_ARM_NEON_FP16) #if defined(SIMDE_ARM_NEON_A64V8_NATIVE) && defined(SIMDE_ARM_NEON_FP16)
return HEDLEY_STATIC_CAST(int16_t, a); return vcvth_s16_f16(a);
#else #else
simde_float32 af = simde_float16_to_float32(a); simde_float32 af = simde_float16_to_float32(a);
if (HEDLEY_UNLIKELY(af < HEDLEY_STATIC_CAST(simde_float32, INT16_MIN))) { if (HEDLEY_UNLIKELY(af < HEDLEY_STATIC_CAST(simde_float32, INT16_MIN))) {
...@@ -157,12 +157,16 @@ simde_x_vcvts_s16_f16(simde_float16 a) { ...@@ -157,12 +157,16 @@ simde_x_vcvts_s16_f16(simde_float16 a) {
} }
#endif #endif
} }
#if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
#undef vcvth_s16_f16
#define vcvth_s16_f16(a) simde_vcvth_s16_f16(a)
#endif
SIMDE_FUNCTION_ATTRIBUTES SIMDE_FUNCTION_ATTRIBUTES
uint16_t uint16_t
simde_x_vcvts_u16_f16(simde_float16 a) { simde_vcvth_u16_f16(simde_float16 a) {
#if defined(SIMDE_FAST_CONVERSION_RANGE) #if defined(SIMDE_ARM_NEON_A64V8_NATIVE) && defined(SIMDE_ARM_NEON_FP16)
return HEDLEY_STATIC_CAST(uint16_t, simde_float16_to_float32(a)); return vcvth_u16_f16(a);
#else #else
simde_float32 af = simde_float16_to_float32(a); simde_float32 af = simde_float16_to_float32(a);
if (HEDLEY_UNLIKELY(af < SIMDE_FLOAT32_C(0.0))) { if (HEDLEY_UNLIKELY(af < SIMDE_FLOAT32_C(0.0))) {
...@@ -176,6 +180,10 @@ simde_x_vcvts_u16_f16(simde_float16 a) { ...@@ -176,6 +180,10 @@ simde_x_vcvts_u16_f16(simde_float16 a) {
} }
#endif #endif
} }
#if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
#undef vcvth_u16_f16
#define vcvth_u16_f16(a) simde_vcvth_u16_f16(a)
#endif
SIMDE_FUNCTION_ATTRIBUTES SIMDE_FUNCTION_ATTRIBUTES
int32_t int32_t
...@@ -266,7 +274,7 @@ simde_vcvtd_s64_f64(simde_float64 a) { ...@@ -266,7 +274,7 @@ simde_vcvtd_s64_f64(simde_float64 a) {
return INT64_MIN; return INT64_MIN;
} else if (HEDLEY_UNLIKELY(a > HEDLEY_STATIC_CAST(simde_float64, INT64_MAX))) { } else if (HEDLEY_UNLIKELY(a > HEDLEY_STATIC_CAST(simde_float64, INT64_MAX))) {
return INT64_MAX; return INT64_MAX;
} else if (simde_math_isnanf(a)) { } else if (simde_math_isnan(a)) {
return 0; return 0;
} else { } else {
return HEDLEY_STATIC_CAST(int64_t, a); return HEDLEY_STATIC_CAST(int64_t, a);
...@@ -344,7 +352,7 @@ simde_vcvt_s16_f16(simde_float16x4_t a) { ...@@ -344,7 +352,7 @@ simde_vcvt_s16_f16(simde_float16x4_t a) {
#else #else
SIMDE_VECTORIZE SIMDE_VECTORIZE
for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) { for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
r_.values[i] = simde_x_vcvts_s16_f16(a_.values[i]); r_.values[i] = simde_vcvth_s16_f16(a_.values[i]);
} }
#endif #endif
...@@ -396,7 +404,7 @@ simde_vcvt_u16_f16(simde_float16x4_t a) { ...@@ -396,7 +404,7 @@ simde_vcvt_u16_f16(simde_float16x4_t a) {
#else #else
SIMDE_VECTORIZE SIMDE_VECTORIZE
for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) { for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
r_.values[i] = simde_x_vcvts_u16_f16(a_.values[i]); r_.values[i] = simde_vcvth_u16_f16(a_.values[i]);
} }
#endif #endif
...@@ -501,7 +509,7 @@ simde_vcvtq_s16_f16(simde_float16x8_t a) { ...@@ -501,7 +509,7 @@ simde_vcvtq_s16_f16(simde_float16x8_t a) {
#else #else
SIMDE_VECTORIZE SIMDE_VECTORIZE
for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) { for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
r_.values[i] = simde_x_vcvts_s16_f16(a_.values[i]); r_.values[i] = simde_vcvth_s16_f16(a_.values[i]);
} }
#endif #endif
...@@ -605,7 +613,7 @@ simde_vcvtq_u16_f16(simde_float16x8_t a) { ...@@ -605,7 +613,7 @@ simde_vcvtq_u16_f16(simde_float16x8_t a) {
#else #else
SIMDE_VECTORIZE SIMDE_VECTORIZE
for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) { for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
r_.values[i] = simde_x_vcvts_u16_f16(a_.values[i]); r_.values[i] = simde_vcvth_u16_f16(a_.values[i]);
} }
#endif #endif
...@@ -1182,8 +1190,6 @@ simde_vcvtas_s32_f32(simde_float32 a) { ...@@ -1182,8 +1190,6 @@ simde_vcvtas_s32_f32(simde_float32 a) {
} else if (HEDLEY_UNLIKELY(simde_math_isnanf(a))) { } else if (HEDLEY_UNLIKELY(simde_math_isnanf(a))) {
return 0; return 0;
} else { } else {
// Round to Nearest with Ties to Away (a.k.a Rounding away from zero) rounding mode.
// For example, 23.2 gets rounded to 24, and −23.2 gets rounded to −24.
return HEDLEY_STATIC_CAST(int32_t, simde_math_roundf(a)); return HEDLEY_STATIC_CAST(int32_t, simde_math_roundf(a));
} }
#endif #endif
...@@ -1199,13 +1205,13 @@ simde_vcvtas_u32_f32(simde_float32 a) { ...@@ -1199,13 +1205,13 @@ simde_vcvtas_u32_f32(simde_float32 a) {
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE) #if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
return vcvtas_u32_f32(a); return vcvtas_u32_f32(a);
#else #else
if (HEDLEY_UNLIKELY(a > HEDLEY_STATIC_CAST(simde_float32, UINT32_MAX))) { if (HEDLEY_UNLIKELY(a < SIMDE_FLOAT32_C(0.0))) {
return 0;
} else if (HEDLEY_UNLIKELY(a >= HEDLEY_STATIC_CAST(simde_float32, UINT32_MAX))) {
return UINT32_MAX; return UINT32_MAX;
} else if (HEDLEY_UNLIKELY(simde_math_isnanf(a))) { } else if (HEDLEY_UNLIKELY(simde_math_isnanf(a))) {
return 0; return 0;
} else { } else {
// Round to Nearest with Ties to Away (a.k.a Rounding away from zero) rounding mode.
// For example, 23.2 gets rounded to 24, and −23.2 gets rounded to −24.
if(a < 0) return 0; if(a < 0) return 0;
return HEDLEY_STATIC_CAST(uint32_t, simde_math_roundf(a)); return HEDLEY_STATIC_CAST(uint32_t, simde_math_roundf(a));
} }
......
This diff is collapsed.
This diff is collapsed.
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
* *
* Copyright: * Copyright:
* 2020-2021 Evan Nemerson <evan@nemerson.com> * 2020-2021 Evan Nemerson <evan@nemerson.com>
* 2023 Yi-Yen Chung <eric681@andestech.com> (Copyright owned by Andes Technology)
*/ */
#if !defined(SIMDE_ARM_NEON_DUP_LANE_H) #if !defined(SIMDE_ARM_NEON_DUP_LANE_H)
...@@ -146,6 +147,46 @@ simde_vdupd_lane_u64(simde_uint64x1_t vec, const int lane) ...@@ -146,6 +147,46 @@ simde_vdupd_lane_u64(simde_uint64x1_t vec, const int lane)
#define vdupd_lane_u64(vec, lane) simde_vdupd_lane_u64((vec), (lane)) #define vdupd_lane_u64(vec, lane) simde_vdupd_lane_u64((vec), (lane))
#endif #endif
SIMDE_FUNCTION_ATTRIBUTES
simde_float16_t
simde_vduph_lane_f16(simde_float16x4_t vec, const int lane)
SIMDE_REQUIRE_CONSTANT_RANGE(lane, 0, 3) {
return simde_float16x4_to_private(vec).values[lane];
}
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE) && defined(SIMDE_ARM_NEON_FP16)
#define simde_vduph_lane_f16(vec, lane) vduph_lane_f16(vec, lane)
#endif
#if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
#undef vduph_lane_f16
#define vduph_lane_f16(vec, lane) simde_vduph_lane_f16((vec), (lane))
#endif
// simde_vdup_lane_f16
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE) && defined(SIMDE_ARM_NEON_FP16)
#define simde_vdup_lane_f16(vec, lane) vdup_lane_f16(vec, lane)
#else
#define simde_vdup_lane_f16(vec, lane) simde_vdup_n_f16(simde_vduph_lane_f16(vec, lane))
#endif
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
#undef vdup_lane_f16
#define vdup_lane_f16(vec, lane) simde_vdup_lane_f16((vec), (lane))
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde_float16x8_t
simde_vdupq_lane_f16(simde_float16x4_t vec, const int lane)
SIMDE_REQUIRE_CONSTANT_RANGE(lane, 0, 3) {
return simde_vdupq_n_f16(simde_float16x4_to_private(vec).values[lane]);
}
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE) && defined(SIMDE_ARM_NEON_FP16)
#define simde_vdupq_lane_f16(vec, lane) vdupq_lane_f16(vec, lane)
#endif
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
#undef vdupq_lane_f16
#define vdupq_lane_f16(vec, lane) simde_vdupq_lane_f16((vec), (lane))
#endif
SIMDE_FUNCTION_ATTRIBUTES SIMDE_FUNCTION_ATTRIBUTES
simde_float64_t simde_float64_t
simde_vdupd_lane_f64(simde_float64x1_t vec, const int lane) simde_vdupd_lane_f64(simde_float64x1_t vec, const int lane)
......
...@@ -34,6 +34,32 @@ HEDLEY_DIAGNOSTIC_PUSH ...@@ -34,6 +34,32 @@ HEDLEY_DIAGNOSTIC_PUSH
SIMDE_DISABLE_UNWANTED_DIAGNOSTICS SIMDE_DISABLE_UNWANTED_DIAGNOSTICS
SIMDE_BEGIN_DECLS_ SIMDE_BEGIN_DECLS_
SIMDE_FUNCTION_ATTRIBUTES
simde_float16x4_t
simde_vext_f16(simde_float16x4_t a, simde_float16x4_t b, const int n)
SIMDE_REQUIRE_CONSTANT_RANGE(n, 0, 3) {
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE) && defined(SIMDE_ARM_NEON_FP16)
simde_float16x4_t r;
SIMDE_CONSTIFY_4_(vext_f16, r, (HEDLEY_UNREACHABLE(), a), n, a, b);
return r;
#else
simde_float16x4_private
a_ = simde_float16x4_to_private(a),
b_ = simde_float16x4_to_private(b),
r_ = a_;
const size_t n_ = HEDLEY_STATIC_CAST(size_t, n);
for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
size_t src = i + n_;
r_.values[i] = (src < (sizeof(r_.values) / sizeof(r_.values[0]))) ? a_.values[src] : b_.values[src & 3];
}
return simde_float16x4_from_private(r_);
#endif
}
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
#undef vext_f16
#define vext_f16(a, b, n) simde_vext_f16((a), (b), (n))
#endif
SIMDE_FUNCTION_ATTRIBUTES SIMDE_FUNCTION_ATTRIBUTES
simde_float32x2_t simde_float32x2_t
simde_vext_f32(simde_float32x2_t a, simde_float32x2_t b, const int n) simde_vext_f32(simde_float32x2_t a, simde_float32x2_t b, const int n)
......
...@@ -35,6 +35,20 @@ HEDLEY_DIAGNOSTIC_PUSH ...@@ -35,6 +35,20 @@ HEDLEY_DIAGNOSTIC_PUSH
SIMDE_DISABLE_UNWANTED_DIAGNOSTICS SIMDE_DISABLE_UNWANTED_DIAGNOSTICS
SIMDE_BEGIN_DECLS_ SIMDE_BEGIN_DECLS_
SIMDE_FUNCTION_ATTRIBUTES
simde_float16_t
simde_vfmah_f16(simde_float16_t a, simde_float16_t b, simde_float16_t c) {
#if defined(SIMDE_ARM_NEON_A32V8_NATIVE) && defined(SIMDE_ARCH_ARM_FMA) && defined(SIMDE_ARM_NEON_FP16)
return vfmah_f16(a, b, c);
#else
return simde_vaddh_f16(a, simde_vmulh_f16(b, c));
#endif
}
#if defined(SIMDE_ARM_NEON_A32V8_ENABLE_NATIVE_ALIASES)
#undef vfmah_f16
#define vfmah_f16(a, b, c) simde_vfmah_f16(a, b, c)
#endif
SIMDE_FUNCTION_ATTRIBUTES SIMDE_FUNCTION_ATTRIBUTES
simde_float32x2_t simde_float32x2_t
simde_vfma_f32(simde_float32x2_t a, simde_float32x2_t b, simde_float32x2_t c) { simde_vfma_f32(simde_float32x2_t a, simde_float32x2_t b, simde_float32x2_t c) {
...@@ -63,6 +77,20 @@ simde_vfma_f64(simde_float64x1_t a, simde_float64x1_t b, simde_float64x1_t c) { ...@@ -63,6 +77,20 @@ simde_vfma_f64(simde_float64x1_t a, simde_float64x1_t b, simde_float64x1_t c) {
#define vfma_f64(a, b, c) simde_vfma_f64(a, b, c) #define vfma_f64(a, b, c) simde_vfma_f64(a, b, c)
#endif #endif
SIMDE_FUNCTION_ATTRIBUTES
simde_float16x4_t
simde_vfma_f16(simde_float16x4_t a, simde_float16x4_t b, simde_float16x4_t c) {
#if defined(SIMDE_ARM_NEON_A32V8_NATIVE) && defined(SIMDE_ARCH_ARM_FMA) && defined(SIMDE_ARM_NEON_FP16)
return vfma_f16(a, b, c);
#else
return simde_vadd_f16(a, simde_vmul_f16(b, c));
#endif
}
#if defined(SIMDE_ARM_NEON_A32V8_ENABLE_NATIVE_ALIASES)
#undef vfma_f16
#define vfma_f16(a, b, c) simde_vfma_f16(a, b, c)
#endif
SIMDE_FUNCTION_ATTRIBUTES SIMDE_FUNCTION_ATTRIBUTES
simde_float16x8_t simde_float16x8_t
simde_vfmaq_f16(simde_float16x8_t a, simde_float16x8_t b, simde_float16x8_t c) { simde_vfmaq_f16(simde_float16x8_t a, simde_float16x8_t b, simde_float16x8_t c) {
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
* *
* Copyright: * Copyright:
* 2021 Atharva Nimbalkar <atharvakn@gmail.com> * 2021 Atharva Nimbalkar <atharvakn@gmail.com>
* 2023 Yi-Yen Chung <eric681@andestech.com> (Copyright owned by Andes Technology)
*/ */
#if !defined(SIMDE_ARM_NEON_FMA_LANE_H) #if !defined(SIMDE_ARM_NEON_FMA_LANE_H)
...@@ -83,6 +84,52 @@ SIMDE_BEGIN_DECLS_ ...@@ -83,6 +84,52 @@ SIMDE_BEGIN_DECLS_
#define vfmad_laneq_f64(a, b, v, lane) simde_vfmad_laneq_f64(a, b, v, lane) #define vfmad_laneq_f64(a, b, v, lane) simde_vfmad_laneq_f64(a, b, v, lane)
#endif #endif
/* simde_vfmah_lane_f16 */
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE) && defined(SIMDE_ARCH_ARM_FMA) && defined(SIMDE_ARM_NEON_FP16)
#if defined(__clang__) && !SIMDE_DETECT_CLANG_VERSION_CHECK(11,0,0)
#define simde_vfmah_lane_f16(a, b, v, lane) \
SIMDE_DISABLE_DIAGNOSTIC_EXPR_(SIMDE_DIAGNOSTIC_DISABLE_VECTOR_CONVERSION_, vfmah_lane_f16(a, b, v, lane))
#else
#define simde_vfmah_lane_f16(a, b, v, lane) vfmah_lane_f16((a), (b), (v), (lane))
#endif
#else
#define simde_vfmah_lane_f16(a, b, v, lane) \
simde_vget_lane_f16( \
simde_vadd_f16( \
simde_vdup_n_f16(a), \
simde_vdup_n_f16(simde_vmulh_lane_f16(b, v, lane)) \
), \
0 \
)
#endif
#if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
#undef vfmah_lane_f16
#define vfmah_lane_f16(a, b, v, lane) simde_vfmah_lane_f16(a, b, v, lane)
#endif
/* simde_vfmah_laneq_f16 */
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE) && defined(SIMDE_ARCH_ARM_FMA) && defined(SIMDE_ARM_NEON_FP16)
#if defined(__clang__) && !SIMDE_DETECT_CLANG_VERSION_CHECK(11,0,0)
#define simde_vfmah_laneq_f16(a, b, v, lane) \
SIMDE_DISABLE_DIAGNOSTIC_EXPR_(SIMDE_DIAGNOSTIC_DISABLE_VECTOR_CONVERSION_, vfmah_laneq_f16(a, b, v, lane))
#else
#define simde_vfmah_laneq_f16(a, b, v, lane) vfmah_laneq_f16((a), (b), (v), (lane))
#endif
#else
#define simde_vfmah_laneq_f16(a, b, v, lane) \
simde_vget_lane_f16( \
simde_vadd_f16( \
simde_vdup_n_f16(a), \
simde_vdup_n_f16(simde_vmulh_laneq_f16(b, v, lane)) \
), \
0 \
)
#endif
#if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
#undef vfmah_laneq_f16
#define vfmah_laneq_f16(a, b, v, lane) simde_vfmah_laneq_f16(a, b, v, lane)
#endif
/* simde_vfmas_lane_f32 */ /* simde_vfmas_lane_f32 */
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE) && defined(SIMDE_ARCH_ARM_FMA) #if defined(SIMDE_ARM_NEON_A64V8_NATIVE) && defined(SIMDE_ARCH_ARM_FMA)
#if defined(__clang__) && !SIMDE_DETECT_CLANG_VERSION_CHECK(11,0,0) #if defined(__clang__) && !SIMDE_DETECT_CLANG_VERSION_CHECK(11,0,0)
...@@ -129,6 +176,17 @@ SIMDE_BEGIN_DECLS_ ...@@ -129,6 +176,17 @@ SIMDE_BEGIN_DECLS_
#define vfmas_laneq_f32(a, b, v, lane) simde_vfmas_laneq_f32(a, b, v, lane) #define vfmas_laneq_f32(a, b, v, lane) simde_vfmas_laneq_f32(a, b, v, lane)
#endif #endif
/* simde_vfma_lane_f16 */
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE) && defined(SIMDE_ARCH_ARM_FMA) && defined(SIMDE_ARM_NEON_FP16)
#define simde_vfma_lane_f16(a, b, v, lane) vfma_lane_f16(a, b, v, lane)
#else
#define simde_vfma_lane_f16(a, b, v, lane) simde_vadd_f16(a, simde_vmul_lane_f16(b, v, lane))
#endif
#if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
#undef vfma_lane_f16
#define vfma_lane_f16(a, b, v, lane) simde_vfma_lane_f16(a, b, v, lane)
#endif
/* simde_vfma_lane_f32 */ /* simde_vfma_lane_f32 */
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE) && defined(SIMDE_ARCH_ARM_FMA) #if defined(SIMDE_ARM_NEON_A64V8_NATIVE) && defined(SIMDE_ARCH_ARM_FMA)
#define simde_vfma_lane_f32(a, b, v, lane) vfma_lane_f32(a, b, v, lane) #define simde_vfma_lane_f32(a, b, v, lane) vfma_lane_f32(a, b, v, lane)
...@@ -151,6 +209,17 @@ SIMDE_BEGIN_DECLS_ ...@@ -151,6 +209,17 @@ SIMDE_BEGIN_DECLS_
#define vfma_lane_f64(a, b, v, lane) simde_vfma_lane_f64(a, b, v, lane) #define vfma_lane_f64(a, b, v, lane) simde_vfma_lane_f64(a, b, v, lane)
#endif #endif
/* simde_vfma_laneq_f16 */
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE) && defined(SIMDE_ARCH_ARM_FMA) && defined(SIMDE_ARM_NEON_FP16)
#define simde_vfma_laneq_f16(a, b, v, lane) vfma_laneq_f16((a), (b), (v), (lane))
#else
#define simde_vfma_laneq_f16(a, b, v, lane) simde_vadd_f16(a, simde_vmul_laneq_f16(b, v, lane))
#endif
#if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
#undef vfma_laneq_f16
#define vfma_laneq_f16(a, b, v, lane) simde_vfma_laneq_f16(a, b, v, lane)
#endif
/* simde_vfma_laneq_f32 */ /* simde_vfma_laneq_f32 */
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE) && defined(SIMDE_ARCH_ARM_FMA) #if defined(SIMDE_ARM_NEON_A64V8_NATIVE) && defined(SIMDE_ARCH_ARM_FMA)
#define simde_vfma_laneq_f32(a, b, v, lane) vfma_laneq_f32((a), (b), (v), (lane)) #define simde_vfma_laneq_f32(a, b, v, lane) vfma_laneq_f32((a), (b), (v), (lane))
...@@ -184,6 +253,17 @@ SIMDE_BEGIN_DECLS_ ...@@ -184,6 +253,17 @@ SIMDE_BEGIN_DECLS_
#define vfmaq_lane_f64(a, b, v, lane) simde_vfmaq_lane_f64(a, b, v, lane) #define vfmaq_lane_f64(a, b, v, lane) simde_vfmaq_lane_f64(a, b, v, lane)
#endif #endif
/* simde_vfmaq_lane_f16 */
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE) && defined(SIMDE_ARCH_ARM_FMA) && defined(SIMDE_ARM_NEON_FP16)
#define simde_vfmaq_lane_f16(a, b, v, lane) vfmaq_lane_f16((a), (b), (v), (lane))
#else
#define simde_vfmaq_lane_f16(a, b, v, lane) simde_vaddq_f16(a, simde_vmulq_lane_f16(b, v, lane))
#endif
#if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
#undef vfmaq_lane_f16
#define vfmaq_lane_f16(a, b, v, lane) simde_vfmaq_lane_f16(a, b, v, lane)
#endif
/* simde_vfmaq_lane_f32 */ /* simde_vfmaq_lane_f32 */
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE) && defined(SIMDE_ARCH_ARM_FMA) #if defined(SIMDE_ARM_NEON_A64V8_NATIVE) && defined(SIMDE_ARCH_ARM_FMA)
#define simde_vfmaq_lane_f32(a, b, v, lane) vfmaq_lane_f32((a), (b), (v), (lane)) #define simde_vfmaq_lane_f32(a, b, v, lane) vfmaq_lane_f32((a), (b), (v), (lane))
...@@ -195,6 +275,18 @@ SIMDE_BEGIN_DECLS_ ...@@ -195,6 +275,18 @@ SIMDE_BEGIN_DECLS_
#define vfmaq_lane_f32(a, b, v, lane) simde_vfmaq_lane_f32(a, b, v, lane) #define vfmaq_lane_f32(a, b, v, lane) simde_vfmaq_lane_f32(a, b, v, lane)
#endif #endif
/* simde_vfmaq_laneq_f16 */
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE) && defined(SIMDE_ARCH_ARM_FMA) && defined(SIMDE_ARM_NEON_FP16)
#define simde_vfmaq_laneq_f16(a, b, v, lane) vfmaq_laneq_f16((a), (b), (v), (lane))
#else
#define simde_vfmaq_laneq_f16(a, b, v, lane) \
simde_vaddq_f16(a, simde_vmulq_laneq_f16(b, v, lane))
#endif
#if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
#undef vfmaq_laneq_f16
#define vfmaq_laneq_f16(a, b, v, lane) simde_vfmaq_laneq_f16(a, b, v, lane)
#endif
/* simde_vfmaq_laneq_f32 */ /* simde_vfmaq_laneq_f32 */
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE) && defined(SIMDE_ARCH_ARM_FMA) #if defined(SIMDE_ARM_NEON_A64V8_NATIVE) && defined(SIMDE_ARCH_ARM_FMA)
#define simde_vfmaq_laneq_f32(a, b, v, lane) vfmaq_laneq_f32((a), (b), (v), (lane)) #define simde_vfmaq_laneq_f32(a, b, v, lane) vfmaq_laneq_f32((a), (b), (v), (lane))
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
* *
* Copyright: * Copyright:
* 2021 Evan Nemerson <evan@nemerson.com> * 2021 Evan Nemerson <evan@nemerson.com>
* 2023 Yi-Yen Chung <eric681@andestech.com> (Copyright owned by Andes Technology)
*/ */
#if !defined(SIMDE_ARM_NEON_FMA_N_H) #if !defined(SIMDE_ARM_NEON_FMA_N_H)
...@@ -35,6 +36,34 @@ HEDLEY_DIAGNOSTIC_PUSH ...@@ -35,6 +36,34 @@ HEDLEY_DIAGNOSTIC_PUSH
SIMDE_DISABLE_UNWANTED_DIAGNOSTICS SIMDE_DISABLE_UNWANTED_DIAGNOSTICS
SIMDE_BEGIN_DECLS_ SIMDE_BEGIN_DECLS_
SIMDE_FUNCTION_ATTRIBUTES
simde_float16x4_t
simde_vfma_n_f16(simde_float16x4_t a, simde_float16x4_t b, simde_float16_t c) {
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE) && defined(SIMDE_ARCH_ARM_FMA) && (!defined(__clang__) || SIMDE_DETECT_CLANG_VERSION_CHECK(7,0,0)) && !defined(SIMDE_BUG_GCC_95399) && defined(SIMDE_ARM_NEON_FP16)
return vfma_n_f16(a, b, c);
#else
return simde_vfma_f16(a, b, simde_vdup_n_f16(c));
#endif
}
#if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
#undef vfma_n_f16
#define vfma_n_f16(a, b, c) simde_vfma_n_f16(a, b, c)
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde_float16x8_t
simde_vfmaq_n_f16(simde_float16x8_t a, simde_float16x8_t b, simde_float16_t c) {
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE) && defined(SIMDE_ARCH_ARM_FMA) && (!defined(__clang__) || SIMDE_DETECT_CLANG_VERSION_CHECK(7,0,0)) && !defined(SIMDE_BUG_GCC_95399) && defined(SIMDE_ARM_NEON_FP16)
return vfmaq_n_f16(a, b, c);
#else
return simde_vfmaq_f16(a, b, simde_vdupq_n_f16(c));
#endif
}
#if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
#undef vfmaq_n_f16
#define vfmaq_n_f16(a, b, c) simde_vfmaq_n_f16(a, b, c)
#endif
SIMDE_FUNCTION_ATTRIBUTES SIMDE_FUNCTION_ATTRIBUTES
simde_float32x2_t simde_float32x2_t
simde_vfma_n_f32(simde_float32x2_t a, simde_float32x2_t b, simde_float32_t c) { simde_vfma_n_f32(simde_float32x2_t a, simde_float32x2_t b, simde_float32_t c) {
......
/* SPDX-License-Identifier: MIT
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* Copyright:
* 2023 Yi-Yen Chung <eric681@andestech.com> (Copyright owned by Andes Technology)
*/
#if !defined(SIMDE_ARM_NEON_FMS_H)
#define SIMDE_ARM_NEON_FMS_H
#include "add.h"
#include "mul.h"
#include "neg.h"
HEDLEY_DIAGNOSTIC_PUSH
SIMDE_DISABLE_UNWANTED_DIAGNOSTICS
SIMDE_BEGIN_DECLS_
SIMDE_FUNCTION_ATTRIBUTES
simde_float16_t
simde_vfmsh_f16(simde_float16_t a, simde_float16_t b, simde_float16_t c) {
#if defined(SIMDE_ARM_NEON_A32V8_NATIVE) && defined(SIMDE_ARCH_ARM_FMA) && defined(SIMDE_ARM_NEON_FP16)
return vfmsh_f16(a, b, c);
#else
return simde_vaddh_f16(a, simde_vnegh_f16(simde_vmulh_f16(b, c)));
#endif
}
#if defined(SIMDE_ARM_NEON_A32V8_ENABLE_NATIVE_ALIASES)
#undef vfmsh_f16
#define vfmsh_f16(a, b, c) simde_vfmsh_f16(a, b, c)
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde_float32x2_t
simde_vfms_f32(simde_float32x2_t a, simde_float32x2_t b, simde_float32x2_t c) {
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE) && defined(SIMDE_ARCH_ARM_FMA)
return vfms_f32(a, b, c);
#else
return simde_vadd_f32(a, simde_vneg_f32(simde_vmul_f32(b, c)));
#endif
}
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
#undef vfms_f32
#define vfms_f32(a, b, c) simde_vfms_f32(a, b, c)
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde_float64x1_t
simde_vfms_f64(simde_float64x1_t a, simde_float64x1_t b, simde_float64x1_t c) {
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE) && defined(SIMDE_ARCH_ARM_FMA)
return vfms_f64(a, b, c);
#else
return simde_vadd_f64(a, simde_vneg_f64(simde_vmul_f64(b, c)));
#endif
}
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
#undef vfms_f64
#define vfms_f64(a, b, c) simde_vfms_f64(a, b, c)
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde_float16x4_t
simde_vfms_f16(simde_float16x4_t a, simde_float16x4_t b, simde_float16x4_t c) {
#if defined(SIMDE_ARM_NEON_A32V8_NATIVE) && defined(SIMDE_ARCH_ARM_FMA) && defined(SIMDE_ARM_NEON_FP16)
return vfms_f16(a, b, c);
#else
return simde_vadd_f16(a, simde_vneg_f16(simde_vmul_f16(b, c)));
#endif
}
#if defined(SIMDE_ARM_NEON_A32V8_ENABLE_NATIVE_ALIASES)
#undef vfms_f16
#define vfms_f16(a, b, c) simde_vfms_f16(a, b, c)
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde_float16x8_t
simde_vfmsq_f16(simde_float16x8_t a, simde_float16x8_t b, simde_float16x8_t c) {
#if defined(SIMDE_ARM_NEON_A32V8_NATIVE) && defined(SIMDE_ARCH_ARM_FMA) && defined(SIMDE_ARM_NEON_FP16)
return vfmsq_f16(a, b, c);
#else
return simde_vaddq_f16(a, simde_vnegq_f16(simde_vmulq_f16(b, c)));
#endif
}
#if defined(SIMDE_ARM_NEON_A32V8_ENABLE_NATIVE_ALIASES)
#undef vfmsq_f16
#define vfmsq_f16(a, b, c) simde_vfmsq_f16(a, b, c)
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde_float32x4_t
simde_vfmsq_f32(simde_float32x4_t a, simde_float32x4_t b, simde_float32x4_t c) {
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE) && defined(SIMDE_ARCH_ARM_FMA)
return vfmsq_f32(a, b, c);
#else
return simde_vaddq_f32(a, simde_vnegq_f32(simde_vmulq_f32(b, c)));
#endif
}
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
#undef vfmsq_f32
#define vfmsq_f32(a, b, c) simde_vfmsq_f32(a, b, c)
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde_float64x2_t
simde_vfmsq_f64(simde_float64x2_t a, simde_float64x2_t b, simde_float64x2_t c) {
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE) && defined(SIMDE_ARCH_ARM_FMA)
return vfmsq_f64(a, b, c);
#else
return simde_vaddq_f64(a, simde_vnegq_f64(simde_vmulq_f64(b, c)));
#endif
}
#if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
#undef vfmsq_f64
#define vfmsq_f64(a, b, c) simde_vfmsq_f64(a, b, c)
#endif
SIMDE_END_DECLS_
HEDLEY_DIAGNOSTIC_POP
#endif /* !defined(SIMDE_ARM_NEON_FMS_H) */
This diff is collapsed.
/* SPDX-License-Identifier: MIT
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* Copyright:
* 2023 Yi-Yen Chung <eric681@andestech.com> (Copyright owned by Andes Technology)
*/
#if !defined(SIMDE_ARM_NEON_FMS_N_H)
#define SIMDE_ARM_NEON_FMS_N_H
#include "types.h"
#include "dup_n.h"
#include "fms.h"
HEDLEY_DIAGNOSTIC_PUSH
SIMDE_DISABLE_UNWANTED_DIAGNOSTICS
SIMDE_BEGIN_DECLS_
SIMDE_FUNCTION_ATTRIBUTES
simde_float16x4_t
simde_vfms_n_f16(simde_float16x4_t a, simde_float16x4_t b, simde_float16_t c) {
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE) && defined(SIMDE_ARCH_ARM_FMA) && (!defined(__clang__) || SIMDE_DETECT_CLANG_VERSION_CHECK(7,0,0)) && !defined(SIMDE_BUG_GCC_95399) && defined(SIMDE_ARM_NEON_FP16)
return vfms_n_f16(a, b, c);
#else
return simde_vfms_f16(a, b, simde_vdup_n_f16(c));
#endif
}
#if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
#undef vfms_n_f16
#define vfms_n_f16(a, b, c) simde_vfms_n_f16(a, b, c)
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde_float16x8_t
simde_vfmsq_n_f16(simde_float16x8_t a, simde_float16x8_t b, simde_float16_t c) {
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE) && defined(SIMDE_ARCH_ARM_FMA) && (!defined(__clang__) || SIMDE_DETECT_CLANG_VERSION_CHECK(7,0,0)) && !defined(SIMDE_BUG_GCC_95399) && defined(SIMDE_ARM_NEON_FP16)
return vfmsq_n_f16(a, b, c);
#else
return simde_vfmsq_f16(a, b, simde_vdupq_n_f16(c));
#endif
}
#if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
#undef vfmsq_n_f16
#define vfmsq_n_f16(a, b, c) simde_vfmsq_n_f16(a, b, c)
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde_float32x2_t
simde_vfms_n_f32(simde_float32x2_t a, simde_float32x2_t b, simde_float32_t c) {
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE) && defined(SIMDE_ARCH_ARM_FMA) && (!defined(__clang__) || SIMDE_DETECT_CLANG_VERSION_CHECK(7,0,0)) && !defined(SIMDE_BUG_GCC_95399)
return vfms_n_f32(a, b, c);
#else
return simde_vfms_f32(a, b, simde_vdup_n_f32(c));
#endif
}
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
#undef vfms_n_f32
#define vfms_n_f32(a, b, c) simde_vfms_n_f32(a, b, c)
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde_float64x1_t
simde_vfms_n_f64(simde_float64x1_t a, simde_float64x1_t b, simde_float64_t c) {
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE) && defined(SIMDE_ARCH_ARM_FMA) && (!defined(__clang__) || SIMDE_DETECT_CLANG_VERSION_CHECK(7,0,0))
return vfms_n_f64(a, b, c);
#else
return simde_vfms_f64(a, b, simde_vdup_n_f64(c));
#endif
}
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
#undef vfms_n_f64
#define vfms_n_f64(a, b, c) simde_vfms_n_f64(a, b, c)
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde_float32x4_t
simde_vfmsq_n_f32(simde_float32x4_t a, simde_float32x4_t b, simde_float32_t c) {
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE) && defined(SIMDE_ARCH_ARM_FMA) && (!defined(__clang__) || SIMDE_DETECT_CLANG_VERSION_CHECK(7,0,0)) && !defined(SIMDE_BUG_GCC_95399)
return vfmsq_n_f32(a, b, c);
#else
return simde_vfmsq_f32(a, b, simde_vdupq_n_f32(c));
#endif
}
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
#undef vfmsq_n_f32
#define vfmsq_n_f32(a, b, c) simde_vfmsq_n_f32(a, b, c)
#endif
SIMDE_FUNCTION_ATTRIBUTES
simde_float64x2_t
simde_vfmsq_n_f64(simde_float64x2_t a, simde_float64x2_t b, simde_float64_t c) {
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE) && defined(SIMDE_ARCH_ARM_FMA) && (!defined(__clang__) || SIMDE_DETECT_CLANG_VERSION_CHECK(7,0,0))
return vfmsq_n_f64(a, b, c);
#else
return simde_vfmsq_f64(a, b, simde_vdupq_n_f64(c));
#endif
}
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
#undef vfmsq_n_f64
#define vfmsq_n_f64(a, b, c) simde_vfmsq_n_f64(a, b, c)
#endif
SIMDE_END_DECLS_
HEDLEY_DIAGNOSTIC_POP
#endif /* !defined(SIMDE_ARM_NEON_FMS_N_H) */
...@@ -276,7 +276,7 @@ simde_vgetq_lane_f16(simde_float16x8_t v, const int lane) ...@@ -276,7 +276,7 @@ simde_vgetq_lane_f16(simde_float16x8_t v, const int lane)
simde_float16_t r; simde_float16_t r;
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE) && defined(SIMDE_ARM_NEON_FP16) #if defined(SIMDE_ARM_NEON_A32V7_NATIVE) && defined(SIMDE_ARM_NEON_FP16)
SIMDE_CONSTIFY_8_(vget_lane_f16, r, (HEDLEY_UNREACHABLE(), SIMDE_FLOAT16_VALUE(0.0)), lane, v); SIMDE_CONSTIFY_8_(vgetq_lane_f16, r, (HEDLEY_UNREACHABLE(), SIMDE_FLOAT16_VALUE(0.0)), lane, v);
#else #else
simde_float16x8_private v_ = simde_float16x8_to_private(v); simde_float16x8_private v_ = simde_float16x8_to_private(v);
......
...@@ -36,6 +36,20 @@ HEDLEY_DIAGNOSTIC_PUSH ...@@ -36,6 +36,20 @@ HEDLEY_DIAGNOSTIC_PUSH
SIMDE_DISABLE_UNWANTED_DIAGNOSTICS SIMDE_DISABLE_UNWANTED_DIAGNOSTICS
SIMDE_BEGIN_DECLS_ SIMDE_BEGIN_DECLS_
SIMDE_FUNCTION_ATTRIBUTES
simde_float16x4_t
simde_vld1_dup_f16(simde_float16 const * ptr) {
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE) && defined(SIMDE_ARM_NEON_FP16)
return vld1_dup_f16(ptr);
#else
return simde_vdup_n_f16(*ptr);
#endif
}
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
#undef vld1_dup_f16
#define vld1_dup_f16(a) simde_vld1_dup_f16((a))
#endif
SIMDE_FUNCTION_ATTRIBUTES SIMDE_FUNCTION_ATTRIBUTES
simde_float32x2_t simde_float32x2_t
simde_vld1_dup_f32(simde_float32 const * ptr) { simde_vld1_dup_f32(simde_float32 const * ptr) {
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
* *
* Copyright: * Copyright:
* 2021 Zhi An Ng <zhin@google.com> (Copyright owned by Google, LLC) * 2021 Zhi An Ng <zhin@google.com> (Copyright owned by Google, LLC)
* 2023 Yi-Yen Chung <eric681@andestech.com> (Copyright owned by Andes Technology)
*/ */
#if !defined(SIMDE_ARM_NEON_LD1_LANE_H) #if !defined(SIMDE_ARM_NEON_LD1_LANE_H)
...@@ -161,6 +162,22 @@ simde_uint64x1_t simde_vld1_lane_u64(uint64_t const *ptr, simde_uint64x1_t src, ...@@ -161,6 +162,22 @@ simde_uint64x1_t simde_vld1_lane_u64(uint64_t const *ptr, simde_uint64x1_t src,
#define vld1_lane_u64(ptr, src, lane) simde_vld1_lane_u64((ptr), (src), (lane)) #define vld1_lane_u64(ptr, src, lane) simde_vld1_lane_u64((ptr), (src), (lane))
#endif #endif
SIMDE_FUNCTION_ATTRIBUTES
simde_float16x4_t simde_vld1_lane_f16(simde_float16_t const *ptr, simde_float16x4_t src,
const int lane)
SIMDE_REQUIRE_CONSTANT_RANGE(lane, 0, 3) {
simde_float16x4_private r = simde_float16x4_to_private(src);
r.values[lane] = *ptr;
return simde_float16x4_from_private(r);
}
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE) && defined(SIMDE_ARM_NEON_FP16)
#define simde_vld1_lane_f16(ptr, src, lane) vld1_lane_f16(ptr, src, lane)
#endif
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
#undef vld1_lane_f16
#define vld1_lane_f16(ptr, src, lane) simde_vld1_lane_f16((ptr), (src), (lane))
#endif
SIMDE_FUNCTION_ATTRIBUTES SIMDE_FUNCTION_ATTRIBUTES
simde_float32x2_t simde_vld1_lane_f32(simde_float32_t const *ptr, simde_float32x2_t src, simde_float32x2_t simde_vld1_lane_f32(simde_float32_t const *ptr, simde_float32x2_t src,
const int lane) const int lane)
...@@ -321,6 +338,22 @@ simde_uint64x2_t simde_vld1q_lane_u64(uint64_t const *ptr, simde_uint64x2_t src, ...@@ -321,6 +338,22 @@ simde_uint64x2_t simde_vld1q_lane_u64(uint64_t const *ptr, simde_uint64x2_t src,
#define vld1q_lane_u64(ptr, src, lane) simde_vld1q_lane_u64((ptr), (src), (lane)) #define vld1q_lane_u64(ptr, src, lane) simde_vld1q_lane_u64((ptr), (src), (lane))
#endif #endif
SIMDE_FUNCTION_ATTRIBUTES
simde_float16x8_t simde_vld1q_lane_f16(simde_float16_t const *ptr, simde_float16x8_t src,
const int lane)
SIMDE_REQUIRE_CONSTANT_RANGE(lane, 0, 7) {
simde_float16x8_private r = simde_float16x8_to_private(src);
r.values[lane] = *ptr;
return simde_float16x8_from_private(r);
}
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE) && defined(SIMDE_ARM_NEON_FP16)
#define simde_vld1q_lane_f16(ptr, src, lane) vld1q_lane_f16(ptr, src, lane)
#endif
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
#undef vld1q_lane_f16
#define vld1q_lane_f16(ptr, src, lane) simde_vld1q_lane_f16((ptr), (src), (lane))
#endif
SIMDE_FUNCTION_ATTRIBUTES SIMDE_FUNCTION_ATTRIBUTES
simde_float32x4_t simde_vld1q_lane_f32(simde_float32_t const *ptr, simde_float32x4_t src, simde_float32x4_t simde_vld1q_lane_f32(simde_float32_t const *ptr, simde_float32x4_t src,
const int lane) const int lane)
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
* 2020 Evan Nemerson <evan@nemerson.com> * 2020 Evan Nemerson <evan@nemerson.com>
* 2021 Zhi An Ng <zhin@google.com> (Copyright owned by Google, LLC) * 2021 Zhi An Ng <zhin@google.com> (Copyright owned by Google, LLC)
* 2021 Décio Luiz Gazzoni Filho <decio@decpp.net> * 2021 Décio Luiz Gazzoni Filho <decio@decpp.net>
* 2023 Yi-Yen Chung <eric681@andestech.com> (Copyright owned by Andes Technology)
*/ */
#if !defined(SIMDE_ARM_NEON_LD1_X2_H) #if !defined(SIMDE_ARM_NEON_LD1_X2_H)
...@@ -40,6 +41,29 @@ SIMDE_BEGIN_DECLS_ ...@@ -40,6 +41,29 @@ SIMDE_BEGIN_DECLS_
#if !defined(SIMDE_BUG_INTEL_857088) #if !defined(SIMDE_BUG_INTEL_857088)
SIMDE_FUNCTION_ATTRIBUTES
simde_float16x4x2_t
simde_vld1_f16_x2(simde_float16 const ptr[HEDLEY_ARRAY_PARAM(8)]) {
#if \
defined(SIMDE_ARM_NEON_A32V7_NATIVE) && defined(SIMDE_ARM_NEON_FP16) && \
(!defined(HEDLEY_GCC_VERSION) || (HEDLEY_GCC_VERSION_CHECK(8,0,0) && defined(SIMDE_ARM_NEON_A64V8_NATIVE))) && \
(!defined(__clang__) || (SIMDE_DETECT_CLANG_VERSION_CHECK(7,0,0) && defined(SIMDE_ARM_NEON_A64V8_NATIVE)))
return vld1_f16_x2(ptr);
#else
simde_float16x4_private a_[2];
for (size_t i = 0; i < 8; i++) {
a_[i / 4].values[i % 4] = ptr[i];
}
simde_float16x4x2_t s_ = { { simde_float16x4_from_private(a_[0]),
simde_float16x4_from_private(a_[1]) } };
return s_;
#endif
}
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
#undef vld1_f16_x2
#define vld1_f16_x2(a) simde_vld1_f16_x2((a))
#endif
SIMDE_FUNCTION_ATTRIBUTES SIMDE_FUNCTION_ATTRIBUTES
simde_float32x2x2_t simde_float32x2x2_t
simde_vld1_f32_x2(simde_float32 const ptr[HEDLEY_ARRAY_PARAM(4)]) { simde_vld1_f32_x2(simde_float32 const ptr[HEDLEY_ARRAY_PARAM(4)]) {
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
* Copyright: * Copyright:
* 2020 Evan Nemerson <evan@nemerson.com> * 2020 Evan Nemerson <evan@nemerson.com>
* 2021 Zhi An Ng <zhin@google.com> (Copyright owned by Google, LLC) * 2021 Zhi An Ng <zhin@google.com> (Copyright owned by Google, LLC)
* 2023 Yi-Yen Chung <eric681@andestech.com> (Copyright owned by Andes Technology)
*/ */
#if !defined(SIMDE_ARM_NEON_LD1_X3_H) #if !defined(SIMDE_ARM_NEON_LD1_X3_H)
...@@ -39,6 +40,30 @@ SIMDE_BEGIN_DECLS_ ...@@ -39,6 +40,30 @@ SIMDE_BEGIN_DECLS_
#if !defined(SIMDE_BUG_INTEL_857088) #if !defined(SIMDE_BUG_INTEL_857088)
SIMDE_FUNCTION_ATTRIBUTES
simde_float16x4x3_t
simde_vld1_f16_x3(simde_float16 const ptr[HEDLEY_ARRAY_PARAM(12)]) {
#if \
defined(SIMDE_ARM_NEON_A32V7_NATIVE) && defined(SIMDE_ARM_NEON_FP16) && \
(!defined(HEDLEY_GCC_VERSION) || (HEDLEY_GCC_VERSION_CHECK(8,0,0) && defined(SIMDE_ARM_NEON_A64V8_NATIVE))) && \
(!defined(__clang__) || (SIMDE_DETECT_CLANG_VERSION_CHECK(7,0,0) && defined(SIMDE_ARM_NEON_A64V8_NATIVE)))
return vld1_f16_x3(ptr);
#else
simde_float16x4_private a_[3];
for (size_t i = 0; i < 12; i++) {
a_[i / 4].values[i % 4] = ptr[i];
}
simde_float16x4x3_t s_ = { { simde_float16x4_from_private(a_[0]),
simde_float16x4_from_private(a_[1]),
simde_float16x4_from_private(a_[2]) } };
return s_;
#endif
}
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
#undef vld1_f16_x3
#define vld1_f16_x3(a) simde_vld1_f16_x3((a))
#endif
SIMDE_FUNCTION_ATTRIBUTES SIMDE_FUNCTION_ATTRIBUTES
simde_float32x2x3_t simde_float32x2x3_t
simde_vld1_f32_x3(simde_float32 const ptr[HEDLEY_ARRAY_PARAM(6)]) { simde_vld1_f32_x3(simde_float32 const ptr[HEDLEY_ARRAY_PARAM(6)]) {
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
* 2020 Evan Nemerson <evan@nemerson.com> * 2020 Evan Nemerson <evan@nemerson.com>
* 2021 Zhi An Ng <zhin@google.com> (Copyright owned by Google, LLC) * 2021 Zhi An Ng <zhin@google.com> (Copyright owned by Google, LLC)
* 2021 Décio Luiz Gazzoni Filho <decio@decpp.net> * 2021 Décio Luiz Gazzoni Filho <decio@decpp.net>
* 2023 Yi-Yen Chung <eric681@andestech.com> (Copyright owned by Andes Technology)
*/ */
#if !defined(SIMDE_ARM_NEON_LD1_X4_H) #if !defined(SIMDE_ARM_NEON_LD1_X4_H)
...@@ -40,6 +41,31 @@ SIMDE_BEGIN_DECLS_ ...@@ -40,6 +41,31 @@ SIMDE_BEGIN_DECLS_
#if !defined(SIMDE_BUG_INTEL_857088) #if !defined(SIMDE_BUG_INTEL_857088)
SIMDE_FUNCTION_ATTRIBUTES
simde_float16x4x4_t
simde_vld1_f16_x4(simde_float16 const ptr[HEDLEY_ARRAY_PARAM(16)]) {
#if \
defined(SIMDE_ARM_NEON_A32V7_NATIVE) && defined(SIMDE_ARM_NEON_FP16) && \
(!defined(HEDLEY_GCC_VERSION) || (HEDLEY_GCC_VERSION_CHECK(8,0,0) && defined(SIMDE_ARM_NEON_A64V8_NATIVE))) && \
(!defined(__clang__) || (SIMDE_DETECT_CLANG_VERSION_CHECK(7,0,0) && defined(SIMDE_ARM_NEON_A64V8_NATIVE)))
return vld1_f16_x4(ptr);
#else
simde_float16x4_private a_[4];
for (size_t i = 0; i < 16; i++) {
a_[i / 4].values[i % 4] = ptr[i];
}
simde_float16x4x4_t s_ = { { simde_float16x4_from_private(a_[0]),
simde_float16x4_from_private(a_[1]),
simde_float16x4_from_private(a_[2]),
simde_float16x4_from_private(a_[3]) } };
return s_;
#endif
}
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
#undef vld1_f16_x4
#define vld1_f16_x4(a) simde_vld1_f16_x4((a))
#endif
SIMDE_FUNCTION_ATTRIBUTES SIMDE_FUNCTION_ATTRIBUTES
simde_float32x2x4_t simde_float32x2x4_t
simde_vld1_f32_x4(simde_float32 const ptr[HEDLEY_ARRAY_PARAM(8)]) { simde_vld1_f32_x4(simde_float32 const ptr[HEDLEY_ARRAY_PARAM(8)]) {
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
* 2020 Evan Nemerson <evan@nemerson.com> * 2020 Evan Nemerson <evan@nemerson.com>
* 2021 Zhi An Ng <zhin@google.com> (Copyright owned by Google, LLC) * 2021 Zhi An Ng <zhin@google.com> (Copyright owned by Google, LLC)
* 2021 Décio Luiz Gazzoni Filho <decio@decpp.net> * 2021 Décio Luiz Gazzoni Filho <decio@decpp.net>
* 2023 Yi-Yen Chung <eric681@andestech.com> (Copyright owned by Andes Technology)
*/ */
#if !defined(SIMDE_ARM_NEON_LD1Q_X2_H) #if !defined(SIMDE_ARM_NEON_LD1Q_X2_H)
...@@ -40,6 +41,30 @@ SIMDE_BEGIN_DECLS_ ...@@ -40,6 +41,30 @@ SIMDE_BEGIN_DECLS_
#if !defined(SIMDE_BUG_INTEL_857088) #if !defined(SIMDE_BUG_INTEL_857088)
SIMDE_FUNCTION_ATTRIBUTES
simde_float16x8x2_t
simde_vld1q_f16_x2(simde_float16 const ptr[HEDLEY_ARRAY_PARAM(16)]) {
#if \
defined(SIMDE_ARM_NEON_A32V7_NATIVE) && defined(SIMDE_ARM_NEON_FP16) && \
(!defined(HEDLEY_GCC_VERSION) || (HEDLEY_GCC_VERSION_CHECK(8,0,0) && defined(SIMDE_ARM_NEON_A64V8_NATIVE))) && \
(!defined(__clang__) || (SIMDE_DETECT_CLANG_VERSION_CHECK(7,0,0) && defined(SIMDE_ARM_NEON_A64V8_NATIVE))) && \
defined(SIMDE_ARM_NEON_FP16)
return vld1q_f16_x2(ptr);
#else
simde_float16x8_private a_[2];
for (size_t i = 0; i < 16; i++) {
a_[i / 8].values[i % 8] = ptr[i];
}
simde_float16x8x2_t s_ = { { simde_float16x8_from_private(a_[0]),
simde_float16x8_from_private(a_[1]) } };
return s_;
#endif
}
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
#undef vld1q_f16_x2
#define vld1q_f16_x2(a) simde_vld1q_f16_x2((a))
#endif
SIMDE_FUNCTION_ATTRIBUTES SIMDE_FUNCTION_ATTRIBUTES
simde_float32x4x2_t simde_float32x4x2_t
simde_vld1q_f32_x2(simde_float32 const ptr[HEDLEY_ARRAY_PARAM(8)]) { simde_vld1q_f32_x2(simde_float32 const ptr[HEDLEY_ARRAY_PARAM(8)]) {
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
* Copyright: * Copyright:
* 2020 Evan Nemerson <evan@nemerson.com> * 2020 Evan Nemerson <evan@nemerson.com>
* 2021 Zhi An Ng <zhin@google.com> (Copyright owned by Google, LLC) * 2021 Zhi An Ng <zhin@google.com> (Copyright owned by Google, LLC)
* 2023 Yi-Yen Chung <eric681@andestech.com> (Copyright owned by Andes Technology)
*/ */
#if !defined(SIMDE_ARM_NEON_LD1Q_X3_H) #if !defined(SIMDE_ARM_NEON_LD1Q_X3_H)
...@@ -39,6 +40,30 @@ SIMDE_BEGIN_DECLS_ ...@@ -39,6 +40,30 @@ SIMDE_BEGIN_DECLS_
#if !defined(SIMDE_BUG_INTEL_857088) #if !defined(SIMDE_BUG_INTEL_857088)
SIMDE_FUNCTION_ATTRIBUTES
simde_float16x8x3_t
simde_vld1q_f16_x3(simde_float16 const ptr[HEDLEY_ARRAY_PARAM(24)]) {
#if \
defined(SIMDE_ARM_NEON_A32V7_NATIVE) && defined(SIMDE_ARM_NEON_FP16) && \
(!defined(HEDLEY_GCC_VERSION) || (HEDLEY_GCC_VERSION_CHECK(8,0,0) && defined(SIMDE_ARM_NEON_A64V8_NATIVE))) && \
(!defined(__clang__) || (SIMDE_DETECT_CLANG_VERSION_CHECK(7,0,0) && defined(SIMDE_ARM_NEON_A64V8_NATIVE)))
return vld1q_f16_x3(ptr);
#else
simde_float16x8_private a_[3];
for (size_t i = 0; i < 24; i++) {
a_[i / 8].values[i % 8] = ptr[i];
}
simde_float16x8x3_t s_ = { { simde_float16x8_from_private(a_[0]),
simde_float16x8_from_private(a_[1]),
simde_float16x8_from_private(a_[2]) } };
return s_;
#endif
}
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
#undef vld1q_f16_x3
#define vld1q_f16_x3(a) simde_vld1q_f16_x3((a))
#endif
SIMDE_FUNCTION_ATTRIBUTES SIMDE_FUNCTION_ATTRIBUTES
simde_float32x4x3_t simde_float32x4x3_t
simde_vld1q_f32_x3(simde_float32 const ptr[HEDLEY_ARRAY_PARAM(12)]) { simde_vld1q_f32_x3(simde_float32 const ptr[HEDLEY_ARRAY_PARAM(12)]) {
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
* 2020 Evan Nemerson <evan@nemerson.com> * 2020 Evan Nemerson <evan@nemerson.com>
* 2021 Zhi An Ng <zhin@google.com> (Copyright owned by Google, LLC) * 2021 Zhi An Ng <zhin@google.com> (Copyright owned by Google, LLC)
* 2021 Décio Luiz Gazzoni Filho <decio@decpp.net> * 2021 Décio Luiz Gazzoni Filho <decio@decpp.net>
* 2023 Yi-Yen Chung <eric681@andestech.com> (Copyright owned by Andes Technology)
*/ */
#if !defined(SIMDE_ARM_NEON_LD1Q_X4_H) #if !defined(SIMDE_ARM_NEON_LD1Q_X4_H)
...@@ -40,6 +41,31 @@ SIMDE_BEGIN_DECLS_ ...@@ -40,6 +41,31 @@ SIMDE_BEGIN_DECLS_
#if !defined(SIMDE_BUG_INTEL_857088) #if !defined(SIMDE_BUG_INTEL_857088)
SIMDE_FUNCTION_ATTRIBUTES
simde_float16x8x4_t
simde_vld1q_f16_x4(simde_float16 const ptr[HEDLEY_ARRAY_PARAM(32)]) {
#if \
defined(SIMDE_ARM_NEON_A32V7_NATIVE) && defined(SIMDE_ARM_NEON_FP16) && \
(!defined(HEDLEY_GCC_VERSION) || (HEDLEY_GCC_VERSION_CHECK(8,0,0) && defined(SIMDE_ARM_NEON_A64V8_NATIVE))) && \
(!defined(__clang__) || (SIMDE_DETECT_CLANG_VERSION_CHECK(7,0,0) && defined(SIMDE_ARM_NEON_A64V8_NATIVE)))
return vld1q_f16_x4(ptr);
#else
simde_float16x8_private a_[4];
for (size_t i = 0; i < 32; i++) {
a_[i / 8].values[i % 8] = ptr[i];
}
simde_float16x8x4_t s_ = { { simde_float16x8_from_private(a_[0]),
simde_float16x8_from_private(a_[1]),
simde_float16x8_from_private(a_[2]),
simde_float16x8_from_private(a_[3]) } };
return s_;
#endif
}
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
#undef vld1q_f16_x4
#define vld1q_f16_x4(a) simde_vld1q_f16_x4((a))
#endif
SIMDE_FUNCTION_ATTRIBUTES SIMDE_FUNCTION_ATTRIBUTES
simde_float32x4x4_t simde_float32x4x4_t
simde_vld1q_f32_x4(simde_float32 const ptr[HEDLEY_ARRAY_PARAM(16)]) { simde_vld1q_f32_x4(simde_float32 const ptr[HEDLEY_ARRAY_PARAM(16)]) {
......
...@@ -342,6 +342,33 @@ simde_vld2_u64(uint64_t const ptr[HEDLEY_ARRAY_PARAM(2)]) { ...@@ -342,6 +342,33 @@ simde_vld2_u64(uint64_t const ptr[HEDLEY_ARRAY_PARAM(2)]) {
#define vld2_u64(a) simde_vld2_u64((a)) #define vld2_u64(a) simde_vld2_u64((a))
#endif #endif
SIMDE_FUNCTION_ATTRIBUTES
simde_float16x4x2_t
simde_vld2_f16(simde_float16_t const ptr[HEDLEY_ARRAY_PARAM(8)]) {
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE) && defined(SIMDE_ARM_NEON_FP16)
return vld2_f16(ptr);
#else
simde_float16x4_private r_[2];
for (size_t i = 0 ; i < (sizeof(r_) / sizeof(r_[0])) ; i++) {
for (size_t j = 0 ; j < (sizeof(r_[0].values) / sizeof(r_[0].values[0])) ; j++) {
r_[i].values[j] = ptr[i + (j * (sizeof(r_) / sizeof(r_[0])))];
}
}
simde_float16x4x2_t r = { {
simde_float16x4_from_private(r_[0]),
simde_float16x4_from_private(r_[1]),
} };
return r;
#endif
}
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
#undef vld2_f16
#define vld2_f16(a) simde_vld2_f16((a))
#endif
SIMDE_FUNCTION_ATTRIBUTES SIMDE_FUNCTION_ATTRIBUTES
simde_float32x2x2_t simde_float32x2x2_t
simde_vld2_f32(simde_float32_t const ptr[HEDLEY_ARRAY_PARAM(4)]) { simde_vld2_f32(simde_float32_t const ptr[HEDLEY_ARRAY_PARAM(4)]) {
......
This diff is collapsed.
This diff is collapsed.
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
* Copyright: * Copyright:
* 2020 Evan Nemerson <evan@nemerson.com> * 2020 Evan Nemerson <evan@nemerson.com>
* 2020 Sean Maher <seanptmaher@gmail.com> * 2020 Sean Maher <seanptmaher@gmail.com>
* 2023 Yi-Yen Chung <eric681@andestech.com> (Copyright owned by Andes Technology)
*/ */
#if !defined(SIMDE_ARM_NEON_LD3_H) #if !defined(SIMDE_ARM_NEON_LD3_H)
...@@ -40,6 +41,34 @@ SIMDE_BEGIN_DECLS_ ...@@ -40,6 +41,34 @@ SIMDE_BEGIN_DECLS_
#if !defined(SIMDE_BUG_INTEL_857088) #if !defined(SIMDE_BUG_INTEL_857088)
SIMDE_FUNCTION_ATTRIBUTES
simde_float16x4x3_t
simde_vld3_f16(simde_float16 const *ptr) {
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE) && defined(SIMDE_ARM_NEON_FP16)
return vld3_f16(ptr);
#else
simde_float16x4_private r_[3];
for (size_t i = 0; i < (sizeof(r_) / sizeof(r_[0])); i++) {
for (size_t j = 0 ; j < (sizeof(r_[0].values) / sizeof(r_[0].values[0])) ; j++) {
r_[i].values[j] = ptr[i + (j * (sizeof(r_) / sizeof(r_[0])))];
}
}
simde_float16x4x3_t r = { {
simde_float16x4_from_private(r_[0]),
simde_float16x4_from_private(r_[1]),
simde_float16x4_from_private(r_[2])
} };
return r;
#endif
}
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
#undef vld3_f16
#define vld3_f16(a) simde_vld3_f16((a))
#endif
SIMDE_FUNCTION_ATTRIBUTES SIMDE_FUNCTION_ATTRIBUTES
simde_float32x2x3_t simde_float32x2x3_t
simde_vld3_f32(simde_float32 const *ptr) { simde_vld3_f32(simde_float32 const *ptr) {
......
This diff is collapsed.
This diff is collapsed.
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
* Copyright: * Copyright:
* 2020 Evan Nemerson <evan@nemerson.com> * 2020 Evan Nemerson <evan@nemerson.com>
* 2020 Sean Maher <seanptmaher@gmail.com> * 2020 Sean Maher <seanptmaher@gmail.com>
* 2023 Yi-Yen Chung <eric681@andestech.com> (Copyright owned by Andes Technology)
*/ */
#if !defined(SIMDE_ARM_NEON_LD4_H) #if !defined(SIMDE_ARM_NEON_LD4_H)
...@@ -39,6 +40,26 @@ SIMDE_BEGIN_DECLS_ ...@@ -39,6 +40,26 @@ SIMDE_BEGIN_DECLS_
#if !defined(SIMDE_BUG_INTEL_857088) #if !defined(SIMDE_BUG_INTEL_857088)
SIMDE_FUNCTION_ATTRIBUTES
simde_float16x4x4_t
simde_vld4_f16(simde_float16 const ptr[HEDLEY_ARRAY_PARAM(16)]) {
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE) && defined(SIMDE_ARM_NEON_FP16)
return vld4_f16(ptr);
#else
simde_float16x4_private a_[4];
for (size_t i = 0; i < (sizeof(simde_float16x4_t) / sizeof(*ptr)) * 4 ; i++) {
a_[i % 4].values[i / 4] = ptr[i];
}
simde_float16x4x4_t s_ = { { simde_float16x4_from_private(a_[0]), simde_float16x4_from_private(a_[1]),
simde_float16x4_from_private(a_[2]), simde_float16x4_from_private(a_[3]) } };
return (s_);
#endif
}
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
#undef vld4_f16
#define vld4_f16(a) simde_vld4_f16((a))
#endif
SIMDE_FUNCTION_ATTRIBUTES SIMDE_FUNCTION_ATTRIBUTES
simde_float32x2x4_t simde_float32x2x4_t
simde_vld4_f32(simde_float32 const ptr[HEDLEY_ARRAY_PARAM(8)]) { simde_vld4_f32(simde_float32 const ptr[HEDLEY_ARRAY_PARAM(8)]) {
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
* Copyright: * Copyright:
* 2020 Evan Nemerson <evan@nemerson.com> * 2020 Evan Nemerson <evan@nemerson.com>
* 2020 Sean Maher <seanptmaher@gmail.com> (Copyright owned by Google, LLC) * 2020 Sean Maher <seanptmaher@gmail.com> (Copyright owned by Google, LLC)
* 2023 Yi-Yen Chung <eric681@andestech.com> (Copyright owned by Andes Technology)
*/ */
#if !defined(SIMDE_ARM_NEON_QDMULH_H) #if !defined(SIMDE_ARM_NEON_QDMULH_H)
...@@ -89,6 +90,21 @@ simde_vqdmulh_s16(simde_int16x4_t a, simde_int16x4_t b) { ...@@ -89,6 +90,21 @@ simde_vqdmulh_s16(simde_int16x4_t a, simde_int16x4_t b) {
#define vqdmulh_s16(a, b) simde_vqdmulh_s16((a), (b)) #define vqdmulh_s16(a, b) simde_vqdmulh_s16((a), (b))
#endif #endif
SIMDE_FUNCTION_ATTRIBUTES
int16_t
simde_vqdmulhh_s16(int16_t a, int16_t b) {
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
return vqdmulhh_s16(a, b);
#else
int32_t tmp = simde_vqdmullh_s16(a, b);
return HEDLEY_STATIC_CAST(int16_t, tmp >> 16);
#endif
}
#if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
#undef vqdmulhh_s16
#define vqdmulhh_s16(a, b) simde_vqdmulhh_s16((a), (b))
#endif
SIMDE_FUNCTION_ATTRIBUTES SIMDE_FUNCTION_ATTRIBUTES
simde_int32x2_t simde_int32x2_t
simde_vqdmulh_s32(simde_int32x2_t a, simde_int32x2_t b) { simde_vqdmulh_s32(simde_int32x2_t a, simde_int32x2_t b) {
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -37,7 +37,7 @@ SIMDE_FUNCTION_ATTRIBUTES ...@@ -37,7 +37,7 @@ SIMDE_FUNCTION_ATTRIBUTES
simde_float16 simde_float16
simde_vsqrth_f16(simde_float16 a) { simde_vsqrth_f16(simde_float16 a) {
#if defined(SIMDE_ARM_NEON_A32V8_NATIVE) && defined(SIMDE_ARM_NEON_FP16) #if defined(SIMDE_ARM_NEON_A32V8_NATIVE) && defined(SIMDE_ARM_NEON_FP16)
return vsqrth_f16(a, b); return vsqrth_f16(a);
#elif defined(simde_math_sqrtf) #elif defined(simde_math_sqrtf)
simde_float32 af = simde_float16_to_float32(a); simde_float32 af = simde_float16_to_float32(a);
return simde_float16_from_float32(simde_math_sqrtf(af)); return simde_float16_from_float32(simde_math_sqrtf(af));
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment