Skip to content

Commit f210c70

Browse files
committed
e2k: Allow natively and correctly implemented XOP and FMA functions
1 parent 8b0b8fa commit f210c70

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

simde/simde-arch.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,8 @@
189189
#if defined(__LCC__)
190190
#define SIMDE_SKIP_EXTENDED_E2K_VECTOR_OPS
191191
#define SIMDE_BUG_LCC_WARNING_ON_SHIFTS
192+
#define SIMDE_BUG_LCC_XOP_MISSING
193+
#define SIMDE_BUG_LCC_FMA_WRONG_RESULT
192194
#endif
193195

194196
/* HP/PA / PA-RISC
@@ -267,7 +269,7 @@
267269
# if defined(__SSE4_2__)
268270
# define SIMDE_ARCH_X86_SSE4_2 1
269271
# endif
270-
# if defined(__XOP__) && !defined(__LCC__) /* LCC incorrectly defines __XOP__ */
272+
# if defined(__XOP__)
271273
# define SIMDE_ARCH_X86_XOP 1
272274
# endif
273275
# if defined(__AVX__)
@@ -285,7 +287,7 @@
285287
# if defined(__AVX2__)
286288
# define SIMDE_ARCH_X86_AVX2 1
287289
# endif
288-
# if defined(__FMA__) && !defined(__LCC__) /* LCC incorrectly defines __FMA__ */
290+
# if defined(__FMA__)
289291
# define SIMDE_ARCH_X86_FMA 1
290292
# if !defined(SIMDE_ARCH_X86_AVX)
291293
# define SIMDE_ARCH_X86_AVX 1

simde/x86/fma.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ simde_mm256_fmadd_ps (simde__m256 a, simde__m256 b, simde__m256 c) {
156156
SIMDE_FUNCTION_ATTRIBUTES
157157
simde__m128d
158158
simde_mm_fmadd_sd (simde__m128d a, simde__m128d b, simde__m128d c) {
159-
#if defined(SIMDE_X86_FMA_NATIVE)
159+
#if defined(SIMDE_X86_FMA_NATIVE) && !defined(SIMDE_BUG_LCC_FMA_WRONG_RESULT)
160160
return _mm_fmadd_sd(a, b, c);
161161
#else
162162
return simde_mm_add_sd(simde_mm_mul_sd(a, b), c);
@@ -170,7 +170,7 @@ simde_mm_fmadd_sd (simde__m128d a, simde__m128d b, simde__m128d c) {
170170
SIMDE_FUNCTION_ATTRIBUTES
171171
simde__m128
172172
simde_mm_fmadd_ss (simde__m128 a, simde__m128 b, simde__m128 c) {
173-
#if defined(SIMDE_X86_FMA_NATIVE)
173+
#if defined(SIMDE_X86_FMA_NATIVE) && !defined(SIMDE_BUG_LCC_FMA_WRONG_RESULT)
174174
return _mm_fmadd_ss(a, b, c);
175175
#else
176176
return simde_mm_add_ss(simde_mm_mul_ss(a, b), c);
@@ -296,7 +296,7 @@ simde_mm256_fmsub_ps (simde__m256 a, simde__m256 b, simde__m256 c) {
296296
SIMDE_FUNCTION_ATTRIBUTES
297297
simde__m128d
298298
simde_mm_fmsub_sd (simde__m128d a, simde__m128d b, simde__m128d c) {
299-
#if defined(SIMDE_X86_FMA_NATIVE)
299+
#if defined(SIMDE_X86_FMA_NATIVE) && !defined(SIMDE_BUG_LCC_FMA_WRONG_RESULT)
300300
return _mm_fmsub_sd(a, b, c);
301301
#else
302302
return simde_mm_sub_sd(simde_mm_mul_sd(a, b), c);
@@ -310,7 +310,7 @@ simde_mm_fmsub_sd (simde__m128d a, simde__m128d b, simde__m128d c) {
310310
SIMDE_FUNCTION_ATTRIBUTES
311311
simde__m128
312312
simde_mm_fmsub_ss (simde__m128 a, simde__m128 b, simde__m128 c) {
313-
#if defined(SIMDE_X86_FMA_NATIVE)
313+
#if defined(SIMDE_X86_FMA_NATIVE) && !defined(SIMDE_BUG_LCC_FMA_WRONG_RESULT)
314314
return _mm_fmsub_ss(a, b, c);
315315
#else
316316
return simde_mm_sub_ss(simde_mm_mul_ss(a, b), c);
@@ -528,7 +528,7 @@ simde_mm256_fnmadd_ps (simde__m256 a, simde__m256 b, simde__m256 c) {
528528
SIMDE_FUNCTION_ATTRIBUTES
529529
simde__m128d
530530
simde_mm_fnmadd_sd (simde__m128d a, simde__m128d b, simde__m128d c) {
531-
#if defined(SIMDE_X86_FMA_NATIVE)
531+
#if defined(SIMDE_X86_FMA_NATIVE) && !defined(SIMDE_BUG_LCC_FMA_WRONG_RESULT)
532532
return _mm_fnmadd_sd(a, b, c);
533533
#else
534534
simde__m128d_private
@@ -551,7 +551,7 @@ simde_mm_fnmadd_sd (simde__m128d a, simde__m128d b, simde__m128d c) {
551551
SIMDE_FUNCTION_ATTRIBUTES
552552
simde__m128
553553
simde_mm_fnmadd_ss (simde__m128 a, simde__m128 b, simde__m128 c) {
554-
#if defined(SIMDE_X86_FMA_NATIVE)
554+
#if defined(SIMDE_X86_FMA_NATIVE) && !defined(SIMDE_BUG_LCC_FMA_WRONG_RESULT)
555555
return _mm_fnmadd_ss(a, b, c);
556556
#else
557557
simde__m128_private
@@ -674,7 +674,7 @@ simde_mm256_fnmsub_ps (simde__m256 a, simde__m256 b, simde__m256 c) {
674674
SIMDE_FUNCTION_ATTRIBUTES
675675
simde__m128d
676676
simde_mm_fnmsub_sd (simde__m128d a, simde__m128d b, simde__m128d c) {
677-
#if defined(SIMDE_X86_FMA_NATIVE)
677+
#if defined(SIMDE_X86_FMA_NATIVE) && !defined(SIMDE_BUG_LCC_FMA_WRONG_RESULT)
678678
return _mm_fnmsub_sd(a, b, c);
679679
#else
680680
simde__m128d_private
@@ -697,7 +697,7 @@ simde_mm_fnmsub_sd (simde__m128d a, simde__m128d b, simde__m128d c) {
697697
SIMDE_FUNCTION_ATTRIBUTES
698698
simde__m128
699699
simde_mm_fnmsub_ss (simde__m128 a, simde__m128 b, simde__m128 c) {
700-
#if defined(SIMDE_X86_FMA_NATIVE)
700+
#if defined(SIMDE_X86_FMA_NATIVE) && !defined(SIMDE_BUG_LCC_FMA_WRONG_RESULT)
701701
return _mm_fnmsub_ss(a, b, c);
702702
#else
703703
simde__m128_private

simde/x86/xop.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ simde_mm_cmov_si128 (simde__m128i a, simde__m128i b, simde__m128i c) {
7878
SIMDE_FUNCTION_ATTRIBUTES
7979
simde__m256i
8080
simde_mm256_cmov_si256 (simde__m256i a, simde__m256i b, simde__m256i c) {
81-
#if defined(SIMDE_X86_XOP_NATIVE) && defined(SIMDE_X86_AVX_NATIVE) && !defined(SIMDE_BUG_GCC_98521)
81+
#if defined(SIMDE_X86_XOP_NATIVE) && defined(SIMDE_X86_AVX_NATIVE) && !defined(SIMDE_BUG_GCC_98521) && !defined(SIMDE_BUG_LCC_XOP_MISSING)
8282
return _mm256_cmov_si256(a, b, c);
8383
#elif defined(SIMDE_X86_AVX512VL_NATIVE)
8484
return _mm256_ternarylogic_epi32(a, b, c, 0xe4);

0 commit comments

Comments
 (0)