Skip to content

Commit

Permalink
simde_float16: prefer __fp16 if available
Browse files Browse the repository at this point in the history
Fixes: #1104
  • Loading branch information
mr-c committed Nov 9, 2023
1 parent c877fe5 commit aba26f6
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 3 deletions.
5 changes: 5 additions & 0 deletions simde/arm/neon/cadd_rot270.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ HEDLEY_DIAGNOSTIC_PUSH
SIMDE_DISABLE_UNWANTED_DIAGNOSTICS
SIMDE_BEGIN_DECLS_

#if defined(__clang__) && SIMDE_FLOAT16_API == SIMDE_FLOAT16_API_FP16
SIMDE_DIAGNOSTIC_DISABLE_DOUBLE_PROMOTION_
_Pragma("clang diagnostic ignored \"-Wimplicit-float-conversion\"")
#endif

SIMDE_FUNCTION_ATTRIBUTES
simde_float16x4_t simde_vcadd_rot270_f16(simde_float16x4_t a, simde_float16x4_t b)
{
Expand Down
5 changes: 5 additions & 0 deletions simde/arm/neon/cadd_rot90.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ HEDLEY_DIAGNOSTIC_PUSH
SIMDE_DISABLE_UNWANTED_DIAGNOSTICS
SIMDE_BEGIN_DECLS_

#if defined(__clang__) && SIMDE_FLOAT16_API == SIMDE_FLOAT16_API_FP16
SIMDE_DIAGNOSTIC_DISABLE_DOUBLE_PROMOTION_
_Pragma("clang diagnostic ignored \"-Wimplicit-float-conversion\"")
#endif

SIMDE_FUNCTION_ATTRIBUTES
simde_float16x4_t simde_vcadd_rot90_f16(simde_float16x4_t a, simde_float16x4_t b)
{
Expand Down
6 changes: 3 additions & 3 deletions simde/simde-f16.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ SIMDE_BEGIN_DECLS_
* any ideas on how to improve it. If you do, patches are definitely
* welcome. */
#if !defined(SIMDE_FLOAT16_API)
#if !defined(__EMSCRIPTEN__) && !(defined(__clang__) && defined(SIMDE_ARCH_POWER)) && \
#if defined(__ARM_FP16_FORMAT_IEEE) && (defined(SIMDE_ARM_NEON_FP16) || defined(__ARM_FP16_ARGS))
#define SIMDE_FLOAT16_API SIMDE_FLOAT16_API_FP16
#elif !defined(__EMSCRIPTEN__) && !(defined(__clang__) && defined(SIMDE_ARCH_POWER)) && \
!(defined(HEDLEY_MSVC_VERSION) && defined(__clang__)) && \
!(defined(__clang__) && defined(SIMDE_ARCH_RISCV64)) && ( \
defined(SIMDE_X86_AVX512FP16_NATIVE) || \
Expand All @@ -79,8 +81,6 @@ SIMDE_BEGIN_DECLS_
* clang will define the constants even if _Float16 is not
* supported. Ideas welcome. */
#define SIMDE_FLOAT16_API SIMDE_FLOAT16_API_FLOAT16
#elif defined(__ARM_FP16_FORMAT_IEEE) && (defined(SIMDE_ARM_NEON_FP16) || defined(__ARM_FP16_ARGS))
#define SIMDE_FLOAT16_API SIMDE_FLOAT16_API_FP16
#elif defined(__FLT16_MIN__) && \
(defined(__clang__) && \
(!defined(SIMDE_ARCH_AARCH64) || SIMDE_DETECT_CLANG_VERSION_CHECK(7,0,0)) \
Expand Down
4 changes: 4 additions & 0 deletions simde/x86/avx512/cmp.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ HEDLEY_DIAGNOSTIC_PUSH
SIMDE_DISABLE_UNWANTED_DIAGNOSTICS
SIMDE_BEGIN_DECLS_

#if defined(__clang__) && SIMDE_FLOAT16_API == SIMDE_FLOAT16_API_FP16
SIMDE_DIAGNOSTIC_DISABLE_DOUBLE_PROMOTION_
#endif

SIMDE_HUGE_FUNCTION_ATTRIBUTES
simde__mmask64
simde_mm512_cmp_epi8_mask (simde__m512i a, simde__m512i b, const int imm8)
Expand Down
4 changes: 4 additions & 0 deletions simde/x86/avx512/reduce.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ HEDLEY_DIAGNOSTIC_PUSH
SIMDE_DISABLE_UNWANTED_DIAGNOSTICS
SIMDE_BEGIN_DECLS_

#if defined(__clang__) && SIMDE_FLOAT16_API == SIMDE_FLOAT16_API_FP16
SIMDE_DIAGNOSTIC_DISABLE_DOUBLE_PROMOTION_
#endif

SIMDE_FUNCTION_ATTRIBUTES
simde_float16
simde_mm512_reduce_max_ph(simde__m512h a) {
Expand Down

0 comments on commit aba26f6

Please sign in to comment.