Roll skia/third_party/skcms 5ac66b04c9e3..b116880ba8e8 (1 commits)

https://skia.googlesource.com/skcms.git/+log/5ac66b04c9e3..b116880ba8e8

2018-08-31 mtklein@google.com Get -Wreserved-id-macro clean


The AutoRoll server is located here: https://autoroll.skia.org/r/skcms-skia-autoroll

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+/master/autoroll/README.md

If the roll is causing failures, please contact the current sheriff, who should
be CC'd on the roll, and stop the roller if necessary.



CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_trusty_blink_rel
TBR=stephana@google.com

Change-Id: I50f828d8444a7c8cdcb97c57cbb4cc52158ed203
Reviewed-on: https://skia-review.googlesource.com/150826
Reviewed-by: skcms-skia-autoroll <skcms-skia-autoroll@skia-buildbots.google.com.iam.gserviceaccount.com>
Commit-Queue: skcms-skia-autoroll <skcms-skia-autoroll@skia-buildbots.google.com.iam.gserviceaccount.com>
diff --git a/third_party/skcms/skcms.cc b/third_party/skcms/skcms.cc
index 0e93a4c..9d4ea58 100644
--- a/third_party/skcms/skcms.cc
+++ b/third_party/skcms/skcms.cc
@@ -1893,39 +1893,15 @@
         using  U8 = Vec<N,uint8_t>;
 
         #define ATTR __attribute__((target("avx2,f16c")))
-
-        // We check these guards to see if we have support for these features.
-        // They're likely _not_ defined here in our baseline build config.
-        #ifndef __AVX__
-            #define __AVX__ 1
-            #define UNDEF_AVX
-        #endif
-        #ifndef __F16C__
-            #define __F16C__ 1
-            #define UNDEF_F16C
-        #endif
-        #ifndef __AVX2__
-            #define __AVX2__ 1
-            #define UNDEF_AVX2
-        #endif
+        #define USING_AVX
+        #define USING_AVX_F16C
+        #define USING_AVX2
 
         #include "src/Transform_inl.h"
 
         #undef N
         #undef ATTR
-
-        #ifdef UNDEF_AVX
-            #undef __AVX__
-            #undef UNDEF_AVX
-        #endif
-        #ifdef UNDEF_F16C
-            #undef __F16C__
-            #undef UNDEF_F16C
-        #endif
-        #ifdef UNDEF_AVX2
-            #undef __AVX2__
-            #undef UNDEF_AVX2
-        #endif
+        // src/Transform_inl.h will undefine USING_* for us.
     }
 
     #define TEST_FOR_HSW
diff --git a/third_party/skcms/src/Transform_inl.h b/third_party/skcms/src/Transform_inl.h
index bdf7b5f..effc44a 100644
--- a/third_party/skcms/src/Transform_inl.h
+++ b/third_party/skcms/src/Transform_inl.h
@@ -31,15 +31,27 @@
                        F1 = 1.0f;
 #endif
 
+// Instead of checking __AVX__ below, we'll check USING_AVX.
+// This lets skcms.cc set USING_AVX to force us in even if the compiler's not set that way.
+// Same deal for __F16C__ and __AVX2__ ~~~> USING_AVX_F16C, USING_AVX2.
+
+#if !defined(USING_AVX)      && N == 8 && defined(__AVX__)
+    #define  USING_AVX
+#endif
+#if !defined(USING_AVX_F16C) && defined(USING_AVX) && defined(__F16C__)
+    #define  USING AVX_F16C
+#endif
+#if !defined(USING_AVX2)     && defined(USING_AVX) && defined(__AVX2__)
+    #define  USING_AVX2
+#endif
+
+// Similar to the AVX+ features, we define USING_NEON and USING_NEON_F16C.
+// This is more for organizational clarity... skcms.cc doesn't force these.
 #if N == 4 && defined(__ARM_NEON)
     #define USING_NEON
     #if __ARM_FP & 2
         #define USING_NEON_F16C
     #endif
-#elif N == 8 && defined(__AVX__)
-    #if defined(__F16C__)
-        #define USING_AVX_F16C
-    #endif
 #endif
 
 // These -Wvector-conversion warnings seem to trigger in very bogus situations,
@@ -191,7 +203,7 @@
     return vrndmq_f32(x);
 #elif defined(__AVX512F__)
     return _mm512_floor_ps(x);
-#elif defined(__AVX__)
+#elif defined(USING_AVX)
     return __builtin_ia32_roundps256(x, 0x01/*_MM_FROUND_FLOOR*/);
 #elif defined(__SSE4_1__)
     return _mm_floor_ps(x);
@@ -353,7 +365,7 @@
     return v;
 }
 
-#if !defined(__AVX2__)
+#if !defined(USING_AVX2)
     // Helpers for gather_24/48(), loading the ix'th 24/48-bit value from p, and 1/2 extra bytes.
     SI ATTR uint32_t load_24_32(const uint8_t* p, int ix) {
         return load<uint32_t>(p + 3*ix);
@@ -373,7 +385,7 @@
     U32 v = load_24_32(p,ix);
 #elif N == 4
     U32 v = { load_24_32(p,ix[0]), load_24_32(p,ix[1]), load_24_32(p,ix[2]), load_24_32(p,ix[3]) };
-#elif N == 8 && !defined(__AVX2__)
+#elif N == 8 && !defined(USING_AVX2)
     U32 v = { load_24_32(p,ix[0]), load_24_32(p,ix[1]), load_24_32(p,ix[2]), load_24_32(p,ix[3]),
               load_24_32(p,ix[4]), load_24_32(p,ix[5]), load_24_32(p,ix[6]), load_24_32(p,ix[7]) };
 #elif N == 8
@@ -409,7 +421,7 @@
         *v = U64{
             load_48_64(p,ix[0]), load_48_64(p,ix[1]), load_48_64(p,ix[2]), load_48_64(p,ix[3]),
         };
-    #elif N == 8 && !defined(__AVX2__)
+    #elif N == 8 && !defined(USING_AVX2)
         *v = U64{
             load_48_64(p,ix[0]), load_48_64(p,ix[1]), load_48_64(p,ix[2]), load_48_64(p,ix[3]),
             load_48_64(p,ix[4]), load_48_64(p,ix[5]), load_48_64(p,ix[6]), load_48_64(p,ix[7]),
@@ -1126,15 +1138,19 @@
 }
 
 // Clean up any #defines we may have set so that we can be #included again.
+#if defined(USING_AVX)
+    #undef  USING_AVX
+#endif
+#if defined(USING_AVX_F16C)
+    #undef  USING_AVX_F16C
+#endif
+#if defined(USING_AVX2)
+    #undef  USING_AVX2
+#endif
 
 #if defined(USING_NEON)
     #undef  USING_NEON
 #endif
-
 #if defined(USING_NEON_F16C)
     #undef  USING_NEON_F16C
 #endif
-
-#if defined(USING_AVX_F16C)
-    #undef  USING_AVX_F16C
-#endif
diff --git a/third_party/skcms/version.sha1 b/third_party/skcms/version.sha1
index 0faae36..6d798eb 100755
--- a/third_party/skcms/version.sha1
+++ b/third_party/skcms/version.sha1
@@ -1 +1 @@
-5ac66b04c9e399a58cd1dbf1a5969d570fb754df
\ No newline at end of file
+b116880ba8e81535e955f00edc7fec5f485e507d
\ No newline at end of file