diff options
author | Alex Naidis <alex.naidis@linux.com> | 2017-04-05 20:08:41 +0200 |
---|---|---|
committer | Christopher Ferris <cferris@google.com> | 2017-04-06 14:35:44 -0700 |
commit | 5df73d02ce2ccf373029ba082d5a1fac82dfa33e (patch) | |
tree | 6bdd52111bf1d5677b8941d7e83671bf8bd4d528 | |
parent | f3d98fbb597ea092907355c8b15290b63606ed73 (diff) | |
download | build_soong-5df73d02ce2ccf373029ba082d5a1fac82dfa33e.tar.gz build_soong-5df73d02ce2ccf373029ba082d5a1fac82dfa33e.tar.bz2 build_soong-5df73d02ce2ccf373029ba082d5a1fac82dfa33e.zip |
Make use of specific Kryo targeting in Clang
Clang supports specific CPU targeting and optimization
for Kryo.
This switches us to using the specific Kryo targeting
when Clang is used. For other compilers, we fallback
to cortex-a57 targeting.
Also, move the replaceFirst function to a shared location.
Bug: 36728278
Test: Built and booted sailfish, ran bionic unit tests and art tests.
Test: Disassembled libc.so before this change and after and looked at
Test: the differences. Mostly the results were the order of instructions
Test: changing.
Test: Verified with the clang person (srhines) that our clang has this support
Test: and that it appears to be mostly instruction scheduling changes.
Change-Id: I4ee73d8bcc1e4f5eccb162c18937811fe199b16f
Signed-off-by: Alex Naidis <alex.naidis@linux.com>
-rw-r--r-- | cc/config/arm64_device.go | 7 | ||||
-rw-r--r-- | cc/config/arm_device.go | 8 | ||||
-rw-r--r-- | cc/config/global.go | 8 |
3 files changed, 13 insertions, 10 deletions
diff --git a/cc/config/arm64_device.go b/cc/config/arm64_device.go index 60245d0c..f387ddfb 100644 --- a/cc/config/arm64_device.go +++ b/cc/config/arm64_device.go @@ -77,8 +77,8 @@ var ( "-mcpu=cortex-a53", }, "kryo": []string{ - // Use the cortex-a57 cpu since no compiler supports - // Kryo as a CPU target yet. + // Use the cortex-a57 cpu since some compilers + // don't support a Kryo specific target yet. "-mcpu=cortex-a57", }, } @@ -97,6 +97,9 @@ func init() { "kryo", "denver64") + // Clang supports specific Kryo targeting + replaceFirst(arm64ClangCpuVariantCflags["kryo"], "-mcpu=cortex-a57", "-mcpu=kryo") + pctx.StaticVariable("arm64GccVersion", arm64GccVersion) pctx.SourcePathVariable("Arm64GccRoot", diff --git a/cc/config/arm_device.go b/cc/config/arm_device.go index b02c3901..d144c037 100644 --- a/cc/config/arm_device.go +++ b/cc/config/arm_device.go @@ -167,14 +167,6 @@ func init() { "kryo", "denver") - replaceFirst := func(slice []string, from, to string) { - if slice[0] != from { - panic(fmt.Errorf("Expected %q, found %q", from, to)) - } - - slice[0] = to - } - replaceFirst(armClangCpuVariantCflags["krait"], "-mcpu=cortex-a15", "-mcpu=krait") armClangCpuVariantCflags["krait"] = append(armClangCpuVariantCflags["krait"], "-mfpu=neon-vfpv4") diff --git a/cc/config/global.go b/cc/config/global.go index 50c7c987..272a4b69 100644 --- a/cc/config/global.go +++ b/cc/config/global.go @@ -15,6 +15,7 @@ package config import ( + "fmt" "strings" "android/soong/android" @@ -176,3 +177,10 @@ func bionicHeaders(bionicArch, kernelArch string) string { func VndkLibraries() []string { return []string{} } + +func replaceFirst(slice []string, from, to string) { + if slice[0] != from { + panic(fmt.Errorf("Expected %q, found %q", from, to)) + } + slice[0] = to +} |