Replace -march= with -mfeature toggles.
This gives us parity with Chromium (https://crrev.com/c/5046492)
and is also more similar to the original implementation, which
enabled exactly these sets of flags.
Bug: b/310927123
Change-Id: Ie9261b01fc88ae4e365fb0b0fd6d33997cdde007
Reviewed-on: https://skia-review.googlesource.com/c/skcms/+/781517
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
diff --git a/BUILD.bazel b/BUILD.bazel
index eb82b60..3853a31 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -96,7 +96,10 @@
"src/skcms_public.h",
],
copts = select({
- "@platforms//cpu:x86_64": ["-march=haswell"],
+ "@platforms//cpu:x86_64": [
+ "-mavx2",
+ "-mf16c",
+ ],
"//conditions:default": [],
}),
# This header does not compile on its own and is meant to be included from skcms_Transform*.cc
@@ -114,7 +117,13 @@
"src/skcms_public.h",
],
copts = select({
- "@platforms//cpu:x86_64": ["-march=skylake-avx512"],
+ "@platforms//cpu:x86_64": [
+ "-mavx512f",
+ "-mavx512dq",
+ "-mavx512cd",
+ "-mavx512bw",
+ "-mavx512vl",
+ ],
"//conditions:default": [],
}),
# This header does not compile on its own and is meant to be included from skcms_Transform*.cc
diff --git a/ninja/clang.avx512 b/ninja/clang.avx512
index 246436b..7c26288 100644
--- a/ninja/clang.avx512
+++ b/ninja/clang.avx512
@@ -1,6 +1,6 @@
mode = .avx512
extra_cflags = -DSKCMS_FORCE_SKX
-target_flags = -march=skylake-avx512
+target_flags = -march=x86-64 -mavx512f -mavx512dq -mavx512cd -mavx512bw -mavx512vl
include ninja/clang
disabled = $no_skx
diff --git a/ninja/clang.hsw b/ninja/clang.hsw
index 92a6fb6..93a05a7 100644
--- a/ninja/clang.hsw
+++ b/ninja/clang.hsw
@@ -1,6 +1,6 @@
mode = .hsw
extra_cflags = -DSKCMS_FORCE_HSW
-target_flags = -march=haswell
+target_flags = -march=x86-64 -mavx2 -mf16c
include ninja/clang
disabled = $no_hsw
diff --git a/ninja/common b/ninja/common
index 05fed25..8ea1254 100644
--- a/ninja/common
+++ b/ninja/common
@@ -42,17 +42,18 @@
($no_hsw && $cxx -std=c++11 -g -Os $warnings_cc $cflags $extra_cflags $target_flags $
-DSKCMS_DISABLE_HSW -MD -MF $out.d -c $in -o $out) || $
$cxx -std=c++11 -g -Os $warnings_cc $cflags $extra_cflags $
- -march=haswell -MD -MF $out.d -c $in -o $out
+ -march=x86-64 -mavx2 -mf16c -MD -MF $out.d -c $in -o $out
depfile = $out.d
deps = gcc
description = compile $out
rule compile_cc_skx
- command = ($disabled && touch $out) || $
- ($no_skx && $cxx -std=c++11 -g -Os $warnings_cc $cflags $extra_cflags $target_flags $
- -DSKCMS_DISABLE_SKX -MD -MF $out.d -c $in -o $out) || $
- $cxx -std=c++11 -g -Os $warnings_cc $cflags $extra_cflags $
- -march=skylake-avx512 -MD -MF $out.d -c $in -o $out
+ command = ($disabled && touch $out) || $
+ ($no_skx && $cxx -std=c++11 -g -Os $warnings_cc $cflags $extra_cflags $target_flags $
+ -DSKCMS_DISABLE_SKX -MD -MF $out.d -c $in -o $out) || $
+ $cxx -std=c++11 -g -Os $warnings_cc $cflags $extra_cflags $
+ -march=x86-64 -mavx512f -mavx512dq -mavx512cd -mavx512bw -mavx512vl $
+ -MD -MF $out.d -c $in -o $out
depfile = $out.d
deps = gcc
description = compile $out