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 470839 b6653a9f24fc
parent 470838 c3d8e5732769
child 470840 357d9f00469d
push id9239
push userryanvm@gmail.com
push date2018-05-18 15:23 +0000
treeherdermozilla-beta@617990cee57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrhunt, RyanVM
bugs1453892
milestone61.0
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),