Skip to content

Commit

Permalink
[Fix] Fix the bugs in the initial review.
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Yi-Yen Chung committed Oct 23, 2023
1 parent 4b1f792 commit 54c342b
Show file tree
Hide file tree
Showing 34 changed files with 377 additions and 334 deletions.
1 change: 0 additions & 1 deletion simde/arm/neon/add.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
*
* Copyright:
* 2020 Evan Nemerson <[email protected]>
* 2023 Yi-Yen Chung <[email protected]> (Copyright owned by Andes Technology)
*/

#if !defined(SIMDE_ARM_NEON_ADD_H)
Expand Down
1 change: 0 additions & 1 deletion simde/arm/neon/bsl.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
* Copyright:
* 2020 Evan Nemerson <[email protected]>
* 2020 Sean Maher <[email protected]> (Copyright owned by Google, LLC)
* 2023 Yi-Yen Chung <[email protected]> (Copyright owned by Andes Technology)
*/

#if !defined(SIMDE_ARM_NEON_BSL_H)
Expand Down
2 changes: 1 addition & 1 deletion simde/arm/neon/ceq.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* SOFTWARE.
*
* Copyright:
* 2023 Yi-Yen Chung <eric681@andestech.com> (Copyright owned by Andes Technology)
* 2020 Evan Nemerson <evan@nemerson.com>
*/

#if !defined(SIMDE_ARM_NEON_CEQ_H)
Expand Down
1 change: 0 additions & 1 deletion simde/arm/neon/ceqz.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
* Copyright:
* 2020 Evan Nemerson <[email protected]>
* 2020 Sean Maher <[email protected]> (Copyright owned by Google, LLC)
* 2023 Yi-Yen Chung <[email protected]> (Copyright owned by Andes Technology)
*/

#if !defined(SIMDE_ARM_NEON_CEQZ_H)
Expand Down
1 change: 0 additions & 1 deletion simde/arm/neon/cmla.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
*
* Copyright:
* 2021 Atharva Nimbalkar <[email protected]>
* 2023 Yi-Yen Chung <[email protected]> (Copyright owned by Andes Technology)
*/

#if !defined(SIMDE_ARM_NEON_CMLA_H)
Expand Down
1 change: 0 additions & 1 deletion simde/arm/neon/cmla_rot180.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
*
* Copyright:
* 2021 Atharva Nimbalkar <[email protected]>
* 2023 Yi-Yen Chung <[email protected]> (Copyright owned by Andes Technology)
*/

#if !defined(SIMDE_ARM_NEON_CMLA_ROT180_H)
Expand Down
1 change: 0 additions & 1 deletion simde/arm/neon/cmla_rot270.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
*
* Copyright:
* 2021 Atharva Nimbalkar <[email protected]>
* 2023 Yi-Yen Chung <[email protected]> (Copyright owned by Andes Technology)
*/

#if !defined(SIMDE_ARM_NEON_CMLA_ROT270_H)
Expand Down
1 change: 0 additions & 1 deletion simde/arm/neon/cmla_rot90.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
*
* Copyright:
* 2021 Atharva Nimbalkar <[email protected]>
* 2023 Yi-Yen Chung <[email protected]> (Copyright owned by Andes Technology)
*/

#if !defined(SIMDE_ARM_NEON_CMLA_ROT90_H)
Expand Down
2 changes: 1 addition & 1 deletion simde/arm/neon/cnt.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* SOFTWARE.
*
* Copyright:
* 2023 Yi-Yen Chung <eric681@andestech.com> (Copyright owned by Andes Technology)
* 2020 Evan Nemerson <evan@nemerson.com>
*/

#if !defined(SIMDE_ARM_NEON_CNT_H)
Expand Down
74 changes: 46 additions & 28 deletions simde/arm/neon/cvt.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ simde_vcvth_s16_f16(simde_float16 a) {
return INT16_MIN;
} else if (HEDLEY_UNLIKELY(af >= HEDLEY_STATIC_CAST(simde_float32, INT16_MAX))) {
return INT16_MAX;
} else if (HEDLEY_UNLIKELY(simde_math_isnanf(af))) {
} else if (HEDLEY_UNLIKELY(simde_isnanhf(a))) {
return 0;
} else {
return HEDLEY_STATIC_CAST(int16_t, af);
Expand All @@ -179,7 +179,7 @@ simde_vcvth_u16_f16(simde_float16 a) {
return 0;
} else if (HEDLEY_UNLIKELY(af >= HEDLEY_STATIC_CAST(simde_float32, UINT16_MAX))) {
return UINT16_MAX;
} else if (simde_math_isnanf(af)) {
} else if (simde_isnanhf(a)) {
return 0;
} else {
return HEDLEY_STATIC_CAST(uint16_t, af);
Expand All @@ -205,7 +205,7 @@ simde_vcvth_s32_f16(simde_float16 a) {
return INT32_MIN;
} else if (HEDLEY_UNLIKELY(af >= HEDLEY_STATIC_CAST(simde_float32, INT32_MAX))) {
return INT32_MAX;
} else if (HEDLEY_UNLIKELY(simde_math_isnan(af))) {
} else if (HEDLEY_UNLIKELY(simde_isnanhf(a))) {
return 0;
} else {
return HEDLEY_STATIC_CAST(int32_t, af);
Expand All @@ -227,11 +227,11 @@ simde_vcvth_u32_f16(simde_float16 a) {
simde_float16_to_float32(a));
#else
simde_float32 af = simde_float16_to_float32(a);
if (HEDLEY_UNLIKELY(af <= HEDLEY_STATIC_CAST(simde_float32, 0.0))) {
if (HEDLEY_UNLIKELY(af <= SIMDE_FLOAT32_C(0.0))) {
return 0;
} else if (HEDLEY_UNLIKELY(af >= HEDLEY_STATIC_CAST(simde_float32, UINT32_MAX))) {
return UINT32_MAX;
} else if (HEDLEY_UNLIKELY(simde_math_isnanf(af))) {
} else if (HEDLEY_UNLIKELY(simde_isnanhf(a))) {
return 0;
} else {
return HEDLEY_STATIC_CAST(uint32_t, af);
Expand All @@ -257,7 +257,7 @@ simde_vcvth_s64_f16(simde_float16 a) {
return INT64_MIN;
} else if (HEDLEY_UNLIKELY(af >= HEDLEY_STATIC_CAST(simde_float32, INT64_MAX))) {
return INT64_MAX;
} else if (HEDLEY_UNLIKELY(simde_math_isnanf(af))) {
} else if (HEDLEY_UNLIKELY(simde_isnanhf(a))) {
return 0;
} else {
return HEDLEY_STATIC_CAST(int64_t, af);
Expand All @@ -279,11 +279,11 @@ simde_vcvth_u64_f16(simde_float16 a) {
simde_float16_to_float32(a));
#else
simde_float32 af = simde_float16_to_float32(a);
if (HEDLEY_UNLIKELY(af <= HEDLEY_STATIC_CAST(simde_float32, 0.0))) {
if (HEDLEY_UNLIKELY(af <= SIMDE_FLOAT32_C(0.0))) {
return 0;
} else if (HEDLEY_UNLIKELY(af >= HEDLEY_STATIC_CAST(simde_float32, UINT64_MAX))) {
return UINT64_MAX;
} else if (HEDLEY_UNLIKELY(simde_math_isnanf(af))) {
} else if (HEDLEY_UNLIKELY(simde_isnanhf(a))) {
return 0;
} else {
return HEDLEY_STATIC_CAST(uint64_t, af);
Expand Down Expand Up @@ -1388,13 +1388,16 @@ int16_t
simde_vcvtah_s16_f16(simde_float16 a) {
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE) && defined(SIMDE_ARM_NEON_FP16)
return vcvtah_s16_f16(a);
#elif defined(SIMDE_FAST_CONVERSION_RANGE)
return HEDLEY_STATIC_CAST(int16_t,
simde_math_roundf(simde_float16_to_float32(a)));
#else
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))) {
return INT16_MIN;
} else if (HEDLEY_UNLIKELY(af > HEDLEY_STATIC_CAST(simde_float32, INT16_MAX))) {
} else if (HEDLEY_UNLIKELY(af >= HEDLEY_STATIC_CAST(simde_float32, INT16_MAX))) {
return INT16_MAX;
} else if (HEDLEY_UNLIKELY(simde_math_isnanf(af))) {
} else if (HEDLEY_UNLIKELY(simde_isnanhf(a))) {
return 0;
} else {
return HEDLEY_STATIC_CAST(int16_t, simde_math_roundf(af));
Expand All @@ -1411,13 +1414,16 @@ uint16_t
simde_vcvtah_u16_f16(simde_float16 a) {
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE) && !defined(SIMDE_BUG_CLANG_46844) && defined(SIMDE_ARM_NEON_FP16)
return vcvtah_u16_f16(a);
#elif defined(SIMDE_FAST_CONVERSION_RANGE)
return HEDLEY_STATIC_CAST(uint16_t,
simde_math_roundf(simde_float16_to_float32(a)));
#else
simde_float32 af = simde_float16_to_float32(a);
if (HEDLEY_UNLIKELY(af < HEDLEY_STATIC_CAST(simde_float32, 0.0))) {
if (HEDLEY_UNLIKELY(af <= SIMDE_FLOAT32_C(0.0))) {
return 0;
} else if (HEDLEY_UNLIKELY(af > HEDLEY_STATIC_CAST(simde_float32, UINT16_MAX))) {
} else if (HEDLEY_UNLIKELY(af >= HEDLEY_STATIC_CAST(simde_float32, UINT16_MAX))) {
return UINT16_MAX;
} else if (HEDLEY_UNLIKELY(simde_math_isnanf(af))) {
} else if (HEDLEY_UNLIKELY(simde_isnanhf(a))) {
return 0;
} else {
return HEDLEY_STATIC_CAST(uint16_t, simde_math_roundf(af));
Expand All @@ -1434,13 +1440,16 @@ int32_t
simde_vcvtah_s32_f16(simde_float16 a) {
#if defined(SIMDE_ARM_NEON_A32V8_NATIVE) && defined(SIMDE_ARM_NEON_FP16)
return vcvtah_s32_f16(a);
#elif defined(SIMDE_FAST_CONVERSION_RANGE)
return HEDLEY_STATIC_CAST(int32_t,
simde_math_roundf(simde_float16_to_float32(a)));
#else
simde_float32 af = simde_float16_to_float32(a);
if (HEDLEY_UNLIKELY(af < HEDLEY_STATIC_CAST(simde_float32, INT32_MIN))) {
if (HEDLEY_UNLIKELY(af <= HEDLEY_STATIC_CAST(simde_float32, INT32_MIN))) {
return INT32_MIN;
} else if (HEDLEY_UNLIKELY(af > HEDLEY_STATIC_CAST(simde_float32, INT32_MAX))) {
} else if (HEDLEY_UNLIKELY(af >= HEDLEY_STATIC_CAST(simde_float32, INT32_MAX))) {
return INT32_MAX;
} else if (HEDLEY_UNLIKELY(simde_math_isnanf(af))) {
} else if (HEDLEY_UNLIKELY(simde_isnanhf(a))) {
return 0;
} else {
return HEDLEY_STATIC_CAST(int32_t, simde_math_roundf(af));
Expand All @@ -1457,13 +1466,16 @@ uint32_t
simde_vcvtah_u32_f16(simde_float16 a) {
#if defined(SIMDE_ARM_NEON_A32V8_NATIVE) && !defined(SIMDE_BUG_CLANG_46844) && defined(SIMDE_ARM_NEON_FP16)
return vcvtah_u32_f16(a);
#elif defined(SIMDE_FAST_CONVERSION_RANGE)
return HEDLEY_STATIC_CAST(uint32_t,
simde_math_roundf(simde_float16_to_float32(a)));
#else
simde_float32 af = simde_float16_to_float32(a);
if (HEDLEY_UNLIKELY(af < HEDLEY_STATIC_CAST(simde_float32, 0.0))) {
if (HEDLEY_UNLIKELY(af <= SIMDE_FLOAT32_C(0.0))) {
return 0;
} else if (HEDLEY_UNLIKELY(af > HEDLEY_STATIC_CAST(simde_float32, UINT32_MAX))) {
} else if (HEDLEY_UNLIKELY(af >= HEDLEY_STATIC_CAST(simde_float32, UINT32_MAX))) {
return UINT32_MAX;
} else if (HEDLEY_UNLIKELY(simde_math_isnanf(af))) {
} else if (HEDLEY_UNLIKELY(simde_isnanhf(a))) {
return 0;
} else {
return HEDLEY_STATIC_CAST(uint32_t, simde_math_roundf(af));
Expand All @@ -1480,13 +1492,16 @@ int64_t
simde_vcvtah_s64_f16(simde_float16 a) {
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE) && defined(SIMDE_ARM_NEON_FP16)
return vcvtah_s64_f16(a);
#elif defined(SIMDE_FAST_CONVERSION_RANGE)
return HEDLEY_STATIC_CAST(int64_t,
simde_math_roundf(simde_float16_to_float32(a)));
#else
simde_float32 af = simde_float16_to_float32(a);
if (HEDLEY_UNLIKELY(af < HEDLEY_STATIC_CAST(simde_float32, INT64_MIN))) {
if (HEDLEY_UNLIKELY(af <= HEDLEY_STATIC_CAST(simde_float32, INT64_MIN))) {
return INT64_MIN;
} else if (HEDLEY_UNLIKELY(af > HEDLEY_STATIC_CAST(simde_float32, INT64_MAX))) {
} else if (HEDLEY_UNLIKELY(af >= HEDLEY_STATIC_CAST(simde_float32, INT64_MAX))) {
return INT64_MAX;
} else if (HEDLEY_UNLIKELY(simde_math_isnanf(af))) {
} else if (HEDLEY_UNLIKELY(simde_isnanhf(a))) {
return 0;
} else {
return HEDLEY_STATIC_CAST(int64_t, simde_math_roundf(af));
Expand All @@ -1503,13 +1518,16 @@ uint64_t
simde_vcvtah_u64_f16(simde_float16 a) {
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE) && !defined(SIMDE_BUG_CLANG_46844) && defined(SIMDE_ARM_NEON_FP16)
return vcvtah_u64_f16(a);
#elif defined(SIMDE_FAST_CONVERSION_RANGE)
return HEDLEY_STATIC_CAST(uint64_t,
simde_math_roundf(simde_float16_to_float32(a)));
#else
simde_float32 af = simde_float16_to_float32(a);
if (HEDLEY_UNLIKELY(af < HEDLEY_STATIC_CAST(simde_float32, 0.0))) {
if (HEDLEY_UNLIKELY(af <= SIMDE_FLOAT32_C(0.0))) {
return 0;
} else if (HEDLEY_UNLIKELY(af > HEDLEY_STATIC_CAST(simde_float32, UINT64_MAX))) {
} else if (HEDLEY_UNLIKELY(af >= HEDLEY_STATIC_CAST(simde_float32, UINT64_MAX))) {
return UINT64_MAX;
} else if (HEDLEY_UNLIKELY(simde_math_isnanf(af))) {
} else if (HEDLEY_UNLIKELY(simde_isnanhf(a))) {
return 0;
} else {
return HEDLEY_STATIC_CAST(uint64_t, simde_math_roundf(af));
Expand Down Expand Up @@ -1577,9 +1595,9 @@ simde_vcvtas_s32_f32(simde_float32 a) {
#elif defined(SIMDE_FAST_CONVERSION_RANGE)
return HEDLEY_STATIC_CAST(int32_t, simde_math_roundf(a));
#else
if (HEDLEY_UNLIKELY(a < HEDLEY_STATIC_CAST(simde_float32, INT32_MIN))) {
if (HEDLEY_UNLIKELY(a <= HEDLEY_STATIC_CAST(simde_float32, INT32_MIN))) {
return INT32_MIN;
} else if (HEDLEY_UNLIKELY(a > HEDLEY_STATIC_CAST(simde_float32, INT32_MAX))) {
} else if (HEDLEY_UNLIKELY(a >= HEDLEY_STATIC_CAST(simde_float32, INT32_MAX))) {
return INT32_MAX;
} else if (HEDLEY_UNLIKELY(simde_math_isnanf(a))) {
return 0;
Expand Down
30 changes: 15 additions & 15 deletions simde/arm/neon/cvtm.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ simde_vcvtmh_s64_f16(simde_float16 a) {
return INT64_MIN;
} else if (HEDLEY_UNLIKELY(af >= HEDLEY_STATIC_CAST(simde_float32, INT64_MAX))) {
return INT64_MAX;
} else if (HEDLEY_UNLIKELY(simde_math_isnanf(af))) {
} else if (HEDLEY_UNLIKELY(simde_isnanhf(a))) {
return 0;
} else {
return HEDLEY_STATIC_CAST(int64_t, simde_math_floorf(af));
Expand All @@ -76,7 +76,7 @@ simde_vcvtmh_s32_f16(simde_float16 a) {
return INT32_MIN;
} else if (HEDLEY_UNLIKELY(af >= HEDLEY_STATIC_CAST(simde_float32, INT32_MAX))) {
return INT32_MAX;
} else if (HEDLEY_UNLIKELY(simde_math_isnanf(af))) {
} else if (HEDLEY_UNLIKELY(simde_isnanhf(a))) {
return 0;
} else {
return HEDLEY_STATIC_CAST(int32_t, simde_math_floorf(af));
Expand All @@ -103,7 +103,7 @@ simde_vcvtmh_s16_f16(simde_float16 a) {
return INT16_MIN;
} else if (HEDLEY_UNLIKELY(af >= HEDLEY_STATIC_CAST(simde_float32, INT16_MAX))) {
return INT16_MAX;
} else if (HEDLEY_UNLIKELY(simde_math_isnanf(af))) {
} else if (HEDLEY_UNLIKELY(simde_isnanhf(a))) {
return 0;
} else {
return HEDLEY_STATIC_CAST(int16_t, simde_math_floorf(af));
Expand All @@ -126,11 +126,11 @@ simde_vcvtmh_u64_f16(simde_float16 a) {
simde_float16_to_float32(a)));
#else
simde_float32 af = simde_float16_to_float32(a);
if (HEDLEY_UNLIKELY(af <= HEDLEY_STATIC_CAST(simde_float32, 0.0))) {
if (HEDLEY_UNLIKELY(af <= SIMDE_FLOAT32_C(0.0))) {
return 0;
} else if (HEDLEY_UNLIKELY(af >= HEDLEY_STATIC_CAST(simde_float32, UINT64_MAX))) {
return UINT64_MAX;
} else if (HEDLEY_UNLIKELY(simde_math_isnanf(af))) {
} else if (HEDLEY_UNLIKELY(simde_isnanhf(a))) {
return 0;
} else {
return HEDLEY_STATIC_CAST(uint64_t, simde_math_floorf(af));
Expand All @@ -153,11 +153,11 @@ simde_vcvtmh_u32_f16(simde_float16 a) {
simde_float16_to_float32(a)));
#else
simde_float32 af = simde_float16_to_float32(a);
if (HEDLEY_UNLIKELY(af <= HEDLEY_STATIC_CAST(simde_float32, 0.0))) {
if (HEDLEY_UNLIKELY(af <= SIMDE_FLOAT32_C(0.0))) {
return 0;
} else if (HEDLEY_UNLIKELY(af >= HEDLEY_STATIC_CAST(simde_float32, UINT32_MAX))) {
return UINT32_MAX;
} else if (HEDLEY_UNLIKELY(simde_math_isnanf(af))) {
} else if (HEDLEY_UNLIKELY(simde_isnanhf(a))) {
return 0;
} else {
return HEDLEY_STATIC_CAST(uint32_t, simde_math_floorf(af));
Expand All @@ -180,11 +180,11 @@ simde_vcvtmh_u16_f16(simde_float16 a) {
simde_float16_to_float32(a)));
#else
simde_float32 af = simde_float16_to_float32(a);
if (HEDLEY_UNLIKELY(af <= HEDLEY_STATIC_CAST(simde_float32, 0.0))) {
if (HEDLEY_UNLIKELY(af <= SIMDE_FLOAT32_C(0.0))) {
return 0;
} else if (HEDLEY_UNLIKELY(af >= HEDLEY_STATIC_CAST(simde_float32, UINT16_MAX))) {
return UINT16_MAX;
} else if (HEDLEY_UNLIKELY(simde_math_isnanf(af))) {
} else if (HEDLEY_UNLIKELY(simde_isnanhf(a))) {
return 0;
} else {
return HEDLEY_STATIC_CAST(uint16_t, simde_math_floorf(af));
Expand All @@ -204,9 +204,9 @@ simde_vcvtms_s32_f32(simde_float32 a) {
#elif defined(SIMDE_FAST_CONVERSION_RANGE)
return HEDLEY_STATIC_CAST(int32_t, simde_math_floorf(a));
#else
if (HEDLEY_UNLIKELY(a < HEDLEY_STATIC_CAST(simde_float32, INT32_MIN))) {
if (HEDLEY_UNLIKELY(a <= HEDLEY_STATIC_CAST(simde_float32, INT32_MIN))) {
return INT32_MIN;
} else if (HEDLEY_UNLIKELY(a > HEDLEY_STATIC_CAST(simde_float32, INT32_MAX))) {
} else if (HEDLEY_UNLIKELY(a >= HEDLEY_STATIC_CAST(simde_float32, INT32_MAX))) {
return INT32_MAX;
} else if (HEDLEY_UNLIKELY(simde_math_isnanf(a))) {
return 0;
Expand All @@ -228,9 +228,9 @@ simde_vcvtms_u32_f32(simde_float32 a) {
#elif defined(SIMDE_FAST_CONVERSION_RANGE)
return HEDLEY_STATIC_CAST(uint32_t, simde_math_floorf(a));
#else
if (HEDLEY_UNLIKELY(a < SIMDE_FLOAT32_C(0.0))) {
if (HEDLEY_UNLIKELY(a <= SIMDE_FLOAT32_C(0.0))) {
return 0;
} else if (HEDLEY_UNLIKELY(a > HEDLEY_STATIC_CAST(simde_float32, UINT32_MAX))) {
} else if (HEDLEY_UNLIKELY(a >= HEDLEY_STATIC_CAST(simde_float32, UINT32_MAX))) {
return UINT32_MAX;
} else if (HEDLEY_UNLIKELY(simde_math_isnanf(a))) {
return 0;
Expand All @@ -252,9 +252,9 @@ simde_vcvtmd_s64_f64(simde_float64 a) {
#elif defined(SIMDE_FAST_CONVERSION_RANGE)
return HEDLEY_STATIC_CAST(int64_t, simde_math_floor(a));
#else
if (HEDLEY_UNLIKELY(a < HEDLEY_STATIC_CAST(simde_float64, INT64_MIN))) {
if (HEDLEY_UNLIKELY(a <= HEDLEY_STATIC_CAST(simde_float64, 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;
} else if (simde_math_isnan(a)) {
return 0;
Expand Down
Loading

0 comments on commit 54c342b

Please sign in to comment.