Focus disabled optimizations on just BGRAConvolve2D, and only 32-bit.
Last CL accidentally disabled autovectorization on 64-bit builds too.
This fixes that.
BUG=skia:2575
R=rmistry@google.com, mtklein@google.com
Author: mtklein@chromium.org
Review URL: https://codereview.chromium.org/353823005
diff --git a/gyp/core.gyp b/gyp/core.gyp
index 1ffcc7b..64cc79b 100644
--- a/gyp/core.gyp
+++ b/gyp/core.gyp
@@ -31,11 +31,6 @@
],
'msvs_disabled_warnings': [4244, 4267,4345, 4390, 4554, 4800],
'conditions': [
- [ 'skia_arch_type == "x86"', {
- # GCC autovectorization makes some GMs flaky on 32-bit release builds.
- # skbug.com/2575. This bug is likely somewhere here in src/core.
- 'cflags': [ '-fno-tree-vectorize' ]
- }],
[ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "chromeos"]', {
'link_settings': {
'libraries': [
diff --git a/src/core/SkConvolver.cpp b/src/core/SkConvolver.cpp
index 0e97fac..298600e 100644
--- a/src/core/SkConvolver.cpp
+++ b/src/core/SkConvolver.cpp
@@ -330,6 +330,11 @@
return &fFilterValues[filter.fDataLocation];
}
+// There's a bug somewhere in here with GCC autovectorization (-ftree-vectorize) on 32 bit builds.
+// Dropping to -O2 disables -ftree-vectorize. http://skbug.com/2575
+#if defined(__i386) && SK_HAS_ATTRIBUTE(optimize)
+ __attribute__((optimize("O2")))
+#endif
void BGRAConvolve2D(const unsigned char* sourceData,
int sourceByteRowStride,
bool sourceHasAlpha,