diff --git a/interfaces/Crafter.Math-Common.cppm b/interfaces/Crafter.Math-Common.cppm index de17abc..4cef9f6 100644 --- a/interfaces/Crafter.Math-Common.cppm +++ b/interfaces/Crafter.Math-Common.cppm @@ -32,16 +32,22 @@ namespace Crafter { } } + #ifdef __x86_64 using VectorType = std::conditional_t, + #ifdef __AVX512FP16__ std::conditional_t<(Len * Packing > 16), __m512h, std::conditional_t<(Len * Packing > 8), __m256h, __m128h>>, + #else + void, + #endif std::conditional_t<(Len * Packing > 8), __m512, std::conditional_t<(Len * Packing > 4), __m256, __m128>> >; VectorType v; + #endif public: @@ -100,7 +106,7 @@ namespace Crafter { template ShuffleValues> static consteval std::array GetShuffleMaskEpi8() { std::array shuffleMask {{0}}; - if constexpr(std::same_as) { + if constexpr(sizeof(T) == 2) { for(std::uint8_t i2 = 0; i2 < Packing; i2++) { for(std::uint8_t i = 0; i < Len; i++) { shuffleMask[(i2*Len*sizeof(T))+(i*sizeof(T))] = ShuffleValues[i]*sizeof(T)+(i2*Len*sizeof(T)); @@ -213,6 +219,8 @@ namespace Crafter { return shuffleMask; } + #ifdef __x86_64 + #ifdef __AVX512FP16__ template ShuffleValues> static consteval std::uint8_t GetBlendMaskEpi16() requires (std::is_same_v){ std::uint8_t mask = 0; @@ -251,6 +259,7 @@ namespace Crafter { } return mask; } + #endif template ShuffleValues> static consteval std::uint8_t GetBlendMaskEpi32() requires (std::is_same_v){ @@ -290,6 +299,7 @@ namespace Crafter { } return mask; } + #endif static constexpr float two_over_pi = 0.6366197723675814f; static constexpr float pi_over_2_hi = 1.5707963267341256f; @@ -310,6 +320,7 @@ namespace Crafter { static constexpr float s7 = 0.0000027526372f; static constexpr float s9 = -0.0000000239013f; + #ifdef __x86_64 // --- 128-bit (SSE) helpers --- static constexpr void range_reduce_f32x4(__m128 ax, __m128& r, __m128& r2, __m128i& q) { __m128 fq = _mm_round_ps(_mm_mul_ps(ax, _mm_set1_ps(two_over_pi)), _MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC); @@ -590,5 +601,6 @@ namespace Crafter { out_sin = _mm512_xor_ps(out_sin, _mm512_castsi512_ps(_mm512_slli_epi32(sin_neg, 30))); out_sin = _mm512_xor_ps(out_sin, x_sign); } + #endif }; } \ No newline at end of file diff --git a/interfaces/Crafter.Math-Vector.cppm b/interfaces/Crafter.Math-Vector.cppm index e42b5ec..69316fd 100755 --- a/interfaces/Crafter.Math-Vector.cppm +++ b/interfaces/Crafter.Math-Vector.cppm @@ -464,9 +464,12 @@ struct std::formatter> : std::formatter& vec, format_context& ctx) const { std::string out = "{"; for(std::uint32_t i2 = 0; i2 < Len; i2++) { + #ifdef __x86_64 if constexpr(std::same_as) { out += std::format("{}", static_cast(vec.v[i2])); - } else { + } else + #endif + { out += std::format("{}", vec.v[i2]); } if (i2 + 1 < Len) out += ","; diff --git a/interfaces/Crafter.Math-VectorF32.cppm b/interfaces/Crafter.Math-VectorF32.cppm index 5258fe0..aad1d37 100755 --- a/interfaces/Crafter.Math-VectorF32.cppm +++ b/interfaces/Crafter.Math-VectorF32.cppm @@ -25,6 +25,7 @@ import std; import :Common; namespace Crafter { +#ifdef __x86_64 export template struct VectorF32 : public VectorBase { template @@ -1382,9 +1383,10 @@ namespace Crafter { return row1; } }; +#endif } - +#ifdef __x86_64 export template struct std::formatter> : std::formatter { constexpr auto format(const Crafter::VectorF32& obj, format_context& ctx) const { @@ -1401,4 +1403,5 @@ struct std::formatter> : std::formatter::format(out, ctx); } -}; \ No newline at end of file +}; +#endif \ No newline at end of file