Revert of Sk4f: add floor() (patchset #3 id:40001 of https://codereview.chromium.org/1685773002/ )

Reason for revert:
build break must be this, right?

Original issue's description:
> Sk4f: add floor()
>
> BUG=skia:
> GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1685773002
> CQ_EXTRA_TRYBOTS=client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot
>
> Committed: https://skia.googlesource.com/skia/+/86c6c4935171a1d2d6a9ffbff37ec6dac1326614

TBR=herb@google.com,mtklein@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review URL: https://codereview.chromium.org/1679343004
This commit is contained in:
mtklein 2016-02-09 15:10:56 -08:00 committed by Commit bot
parent 46cb6d6b82
commit c023210893
5 changed files with 1 additions and 59 deletions

View File

@ -40,22 +40,6 @@ DEF_BENCH(return new Sk4fRoundtripBench<uint8_t>;)
DEF_BENCH(return new Sk4fRoundtripBench<uint16_t>;)
DEF_BENCH(return new Sk4fRoundtripBench<int>;)
struct Sk4fFloorBench : public Benchmark {
Sk4fFloorBench() {}
const char* onGetName() override { return "Sk4f_floor"; }
bool isSuitableFor(Backend backend) override { return backend == kNonRendering_Backend; }
void onDraw(int loops, SkCanvas* canvas) override {
Sk4f fs(1,2,3,4);
while (loops --> 0) {
fs = fs.floor();
}
fs.store((float*)blackhole);
}
};
DEF_BENCH(return new Sk4fFloorBench;)
struct Sk4fGradientBench : public Benchmark {
const char* onGetName() override { return "Sk4f_gradient"; }
bool isSuitableFor(Backend backend) override { return backend == kNonRendering_Backend; }

View File

@ -50,7 +50,7 @@ public:
#undef OP
#define OP(op) SkNx op() const { return {fLo.op(), fHi.op()}; }
OP(abs) OP(floor)
OP(abs)
OP(sqrt) OP(rsqrt0) OP(rsqrt1) OP(rsqrt2)
OP(invert) OP(approxInvert)
#undef OP
@ -124,7 +124,6 @@ public:
static SkNx Max(const SkNx& a, const SkNx& b) { return SkTMax(a.fVal, b.fVal); }
SkNx abs() const { return SkTAbs(fVal); }
SkNx floor() const { return Floor(fVal); }
SkNx sqrt () const { return Sqrt(fVal); }
SkNx rsqrt0() const { return this->sqrt().invert(); }
@ -146,8 +145,6 @@ public:
SkNx thenElse(const SkNx& t, const SkNx& e) const { return fVal != 0 ? t : e; }
protected:
static double Floor(double val) { return ::floor (val); }
static float Floor(float val) { return ::floorf(val); }
static double Sqrt(double val) { return ::sqrt (val); }
static float Sqrt(float val) { return ::sqrtf(val); }

View File

@ -10,17 +10,6 @@
#define SKNX_IS_FAST
// ARMv8 has vrndmq_f32 to floor 4 floats. Here we emulate it:
// - round by adding (1<<23) with our sign, then subtracting it;
// - if that rounded value is bigger than our input, subtract 1.
static inline float32x4_t armv7_vrndmq_f32(float32x4_t v) {
auto sign = vandq_u32((uint32x4_t)v, vdupq_n_u32(1<<31));
auto bias = (float32x4_t)(vorrq_u32((uint32x4_t)vdupq_n_f32(1<<23), sign));
auto rounded = vsubq_f32(vaddq_f32(v, bias), bias);
auto too_big = vcgtq_f32(rounded, v);
return vsubq_f32(rounded, (float32x4_t)vandq_u32(too_big, (uint32x4_t)vdupq_n_f32(1)));
}
// Well, this is absurd. The shifts require compile-time constant arguments.
#define SHIFT8(op, v, bits) switch(bits) { \
@ -172,14 +161,6 @@ public:
static SkNx Max(const SkNx& l, const SkNx& r) { return vmaxq_f32(l.fVec, r.fVec); }
SkNx abs() const { return vabsq_f32(fVec); }
SkNx floor() const {
#if defined(SK_CPU_ARM64)
return vrndmq_f32(fVec);
#else
return armv7_vrndmq_f32(fVec);
#endif
}
SkNx rsqrt0() const { return vrsqrteq_f32(fVec); }
SkNx rsqrt1() const {

View File

@ -13,17 +13,6 @@
#define SKNX_IS_FAST
// SSE 4.1 has _mm_floor_ps to floor 4 floats. We emulate it:
// - round by adding (1<<23) with our sign, then subtracting it;
// - if that rounded value is bigger than our input, subtract 1.
static inline __m128 sse2_mm_floor_ps(__m128 v) {
__m128 sign = _mm_and_ps(v, _mm_set1_ps(-0.0f));
__m128 bias = _mm_or_ps(sign, _mm_set1_ps(1<<23));
__m128 rounded = _mm_sub_ps(_mm_add_ps(v, bias), bias);
__m128 too_big = _mm_cmpgt_ps(rounded, v);
return _mm_sub_ps(rounded, _mm_and_ps(too_big, _mm_set1_ps(1.0f)));
}
template <>
class SkNx<2, float> {
public:
@ -103,7 +92,6 @@ public:
static SkNx Max(const SkNx& l, const SkNx& r) { return _mm_max_ps(l.fVec, r.fVec); }
SkNx abs() const { return _mm_andnot_ps(_mm_set1_ps(-0.0f), fVec); }
SkNx floor() const { return sse2_mm_floor_ps(fVec); }
SkNx sqrt () const { return _mm_sqrt_ps (fVec); }
SkNx rsqrt0() const { return _mm_rsqrt_ps(fVec); }

View File

@ -215,14 +215,6 @@ DEF_TEST(SkNx_abs, r) {
REPORTER_ASSERT(r, fs.kth<3>() == 4.0f);
}
DEF_TEST(SkNx_floor, r) {
auto fs = Sk4f(0.4f, -0.4f, 0.6f, -0.6f).floor();
REPORTER_ASSERT(r, fs.kth<0>() == 0.0f);
REPORTER_ASSERT(r, fs.kth<1>() == -1.0f);
REPORTER_ASSERT(r, fs.kth<2>() == 0.0f);
REPORTER_ASSERT(r, fs.kth<3>() == -1.0f);
}
DEF_TEST(SkNx_shuffle, r) {
Sk4f f4(0,10,20,30);