Bug 1453892 - Only use SkJumper's arm64 half-float optimizations with clang. r=rhunt, a=RyanVM
authorLee Salzman <lsalzman@mozilla.com>
Wed, 16 May 2018 12:26:47 -0400
changeset 802180 b9217b454fd561088932c3a2472649499f785587
parent 802179 3324a15087629b01a8fea2ae2b30708333a05a92
child 802181 26f17ded038f8fefd7e2b09000b22f0ca960796d
push id111850
push userbmo:tom@mozilla.com
push dateThu, 31 May 2018 16:41:37 +0000
reviewersrhunt, RyanVM
bugs1453892
milestone60.0.2
Bug 1453892 - Only use SkJumper's arm64 half-float optimizations with clang. r=rhunt, a=RyanVM MozReview-Commit-ID: H4ahP6jVdqC
gfx/skia/skia/src/jumper/SkJumper_stages.cpp
--- a/gfx/skia/skia/src/jumper/SkJumper_stages.cpp
+++ b/gfx/skia/skia/src/jumper/SkJumper_stages.cpp
@@ -661,17 +661,17 @@ SI F approx_pow2(F x) {
 }
 
 SI F approx_powf(F x, F y) {
     return if_then_else(x == 0, 0
                               , approx_pow2(approx_log2(x) * y));
 }
 
 SI F from_half(U16 h) {
-#if defined(__aarch64__) && !defined(SK_BUILD_FOR_GOOGLE3)  // Temporary workaround for some Google3 builds.
+#if defined(JUMPER_IS_NEON) && defined(__aarch64__) && !defined(SK_BUILD_FOR_GOOGLE3)  // Temporary workaround for some Google3 builds.
     return vcvt_f32_f16(h);
 
 #elif defined(JUMPER_IS_HSW) || defined(JUMPER_IS_AVX512)
     return _mm256_cvtph_ps(h);
 
 #else
     // Remember, a half is 1-5-10 (sign-exponent-mantissa) with 15 exponent bias.
     U32 sem = expand(h),
@@ -681,17 +681,17 @@ SI F from_half(U16 h) {
     // Convert to 1-8-23 float with 127 bias, flushing denorm halfs (including zero) to zero.
     auto denorm = (I32)em < 0x0400;      // I32 comparison is often quicker, and always safe here.
     return if_then_else(denorm, F(0)
                               , bit_cast<F>( (s<<16) + (em<<13) + ((127-15)<<23) ));
 #endif
 }
 
 SI U16 to_half(F f) {
-#if defined(__aarch64__) && !defined(SK_BUILD_FOR_GOOGLE3)  // Temporary workaround for some Google3 builds.
+#if defined(JUMPER_IS_NEON) && defined(__aarch64__) && !defined(SK_BUILD_FOR_GOOGLE3)  // Temporary workaround for some Google3 builds.
     return vcvt_f16_f32(f);
 
 #elif defined(JUMPER_IS_HSW) || defined(JUMPER_IS_AVX512)
     return _mm256_cvtps_ph(f, _MM_FROUND_CUR_DIRECTION);
 
 #else
     // Remember, a float is 1-8-23 (sign-exponent-mantissa) with 127 exponent bias.
     U32 sem = bit_cast<U32>(f),