diff --git a/include/private/SkVx.h b/include/private/SkVx.h index f6fa8d5237..2b325e8c71 100644 --- a/include/private/SkVx.h +++ b/include/private/SkVx.h @@ -558,9 +558,6 @@ SIN Vec lrint(const Vec& x) { lrint(x.hi)); } -// TODO: new-style platform specializations for rcp() / rsqrt()? -SIN Vec rcp(const Vec& x) { return 1/x; } -SIN Vec rsqrt(const Vec& x) { return rcp(sqrt(x)); } SIN Vec fract(const Vec& x) { return x - floor(x); } // The default logic for to_half/from_half is borrowed from skcms, @@ -673,37 +670,6 @@ SIN Vec approx_scale(const Vec& x, const Vec& y } #endif -#if !defined(SKNX_NO_SIMD) - - // Platform-specific specializations and overloads can now drop in here. - - #if defined(__AVX__) - SI Vec<8,float> rsqrt(const Vec<8,float>& x) { - return bit_pun>(_mm256_rsqrt_ps(bit_pun<__m256>(x))); - } - SI Vec<8,float> rcp(const Vec<8,float>& x) { - return bit_pun>(_mm256_rcp_ps(bit_pun<__m256>(x))); - } - #endif - - #if defined(__SSE__) - SI Vec<4,float> rsqrt(const Vec<4,float>& x) { - return bit_pun>(_mm_rsqrt_ps(bit_pun<__m128>(x))); - } - SI Vec<4,float> rcp(const Vec<4,float>& x) { - return bit_pun>(_mm_rcp_ps(bit_pun<__m128>(x))); - } - - SI Vec<2,float> rsqrt(const Vec<2,float>& x) { - return shuffle<0,1>(rsqrt(shuffle<0,1,0,1>(x))); - } - SI Vec<2,float> rcp(const Vec<2,float>& x) { - return shuffle<0,1>( rcp(shuffle<0,1,0,1>(x))); - } - #endif - -#endif // !defined(SKNX_NO_SIMD) - } // namespace skvx #undef SINTU diff --git a/tests/SkVxTest.cpp b/tests/SkVxTest.cpp index 3a07e023e1..60b815a484 100644 --- a/tests/SkVxTest.cpp +++ b/tests/SkVxTest.cpp @@ -29,24 +29,6 @@ using long2 = skvx::Vec<2,int64_t>; using long4 = skvx::Vec<4,int64_t>; using long8 = skvx::Vec<8,int64_t>; -// These are unused, and just here so I can look at the disassembly. -float2 Sqrt(float2 x) { return sqrt(x); } -float4 Sqrt(float4 x) { return sqrt(x); } -float8 Sqrt(float8 x) { return sqrt(x); } - -float4 RSqrt(float4 x) { return rsqrt(x); } -float4 Rcp(float4 x) { return rcp(x); } -float4 Ceil(float4 x) { return ceil(x); } -float4 Floor(float4 x) { return floor(x); } -float4 Trunc(float4 x) { return trunc(x); } -float4 Round(float4 x) { return round(x); } -float4 Abs(float4 x) { return abs(x); } - -float4 Min(float4 x, float4 y) { return min(x,y); } -float4 Max(float4 x, float4 y) { return max(x,y); } - -float4 IfThenElse(int4 c, float4 t, float4 e) { return if_then_else(c,t,e); } - DEF_TEST(SkVx, r) { static_assert(sizeof(float2) == 8, ""); static_assert(sizeof(float4) == 16, ""); @@ -106,12 +88,7 @@ DEF_TEST(SkVx, r) { // TODO(mtklein): these tests could be made less loose. REPORTER_ASSERT(r, all( sqrt(float4{2,3,4,5}) < float4{2,2,3,3})); - REPORTER_ASSERT(r, all( rcp(float4{2,3,4,5}) < float4{1.0f,0.5f,0.5f,0.3f})); - REPORTER_ASSERT(r, all(rsqrt(float4{2,3,4,5}) < float4{1.0f,1.0f,1.0f,0.5f})); - REPORTER_ASSERT(r, all( sqrt(float2{2,3}) < float2{2,2})); - REPORTER_ASSERT(r, all( rcp(float2{2,3}) < float2{1.0f,0.5f})); - REPORTER_ASSERT(r, all(rsqrt(float2{2,3}) < float2{1.0f,1.0f})); REPORTER_ASSERT(r, all(skvx::cast(float4{-1.5f,0.5f,1.0f,1.5f}) == int4{-1,0,1,1}));