Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- From 291efc39eb7d939c1cd9ce5f964ce5dafd8d9bca Mon Sep 17 00:00:00 2001
- From: sorg <xxx@xxx.com>
- Date: Wed, 6 May 2015 20:58:08 +0800
- Subject: [PATCH] Zenfone2 art compiler compatibility.
- ---
- compiler/common_compiler_test.cc | 16 +++++++++
- dex2oat/dex2oat.cc | 18 ++++++++++
- runtime/instruction_set.cc | 29 ++++++++++++++-
- runtime/instruction_set.h | 72 ++++++++++++++++++++++++++++++++++++++
- 4 files changed, 134 insertions(+), 1 deletion(-)
- diff --git a/compiler/common_compiler_test.cc b/compiler/common_compiler_test.cc
- index 86167ec..2b28731 100644
- --- a/compiler/common_compiler_test.cc
- +++ b/compiler/common_compiler_test.cc
- @@ -131,6 +131,22 @@ static InstructionSetFeatures ParseFeatureList(std::string str) {
- } else if (feature == "nodiv") {
- // Turn off support for divide instruction.
- result.SetHasDivideInstruction(false);
- + } else if (feature == "ssse3") {
- + result.SetHasSSSE3();
- + } else if (feature == "sse4_1") {
- + result.SetHasSSE4_1();
- + } else if (feature == "sse4_2") {
- + result.SetHasSSE4_2();
- + } else if (feature == "avx") {
- + result.SetHasAVX();
- + } else if (feature == "avx2") {
- + result.SetHasAVX2();
- + } else if (feature == "aes_in") {
- + result.SetHasAES_IN();
- + } else if (feature == "popcnt") {
- + result.SetHasPOPCNT();
- + } else if (feature == "movbe") {
- + result.SetHasMOVBE();
- } else {
- LOG(FATAL) << "Unknown instruction set feature: '" << feature << "'";
- }
- diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc
- index 14d454b..b1622d6 100644
- --- a/dex2oat/dex2oat.cc
- +++ b/dex2oat/dex2oat.cc
- @@ -768,6 +768,22 @@ static InstructionSetFeatures ParseFeatureList(std::string str) {
- } else if (feature == "nolpae") {
- // Turn off support for Large Physical Address Extension.
- result.SetHasLpae(false);
- + } else if (feature == "ssse3") {
- + result.SetHasSSSE3();
- + } else if (feature == "sse4_1") {
- + result.SetHasSSE4_1();
- + } else if (feature == "sse4_2") {
- + result.SetHasSSE4_2();
- + } else if (feature == "avx") {
- + result.SetHasAVX();
- + } else if (feature == "avx2") {
- + result.SetHasAVX2();
- + } else if (feature == "aes_in") {
- + result.SetHasAES_IN();
- + } else if (feature == "popcnt") {
- + result.SetHasPOPCNT();
- + } else if (feature == "movbe") {
- + result.SetHasMOVBE();
- } else {
- Usage("Unknown instruction set feature: '%s'", feature.c_str());
- }
- @@ -1196,6 +1212,8 @@ static int dex2oat(int argc, char** argv) {
- compiler_filter = CompilerOptions::kBalanced;
- } else if (strcmp(compiler_filter_string, "speed") == 0) {
- compiler_filter = CompilerOptions::kSpeed;
- + } else if (strcmp(compiler_filter_string, "O2") == 0) {
- + compiler_filter = CompilerOptions::kSpeed;
- } else if (strcmp(compiler_filter_string, "everything") == 0) {
- compiler_filter = CompilerOptions::kEverything;
- } else {
- diff --git a/runtime/instruction_set.cc b/runtime/instruction_set.cc
- index 644e055..1c01060 100644
- --- a/runtime/instruction_set.cc
- +++ b/runtime/instruction_set.cc
- @@ -119,9 +119,36 @@ size_t GetStackOverflowReservedBytes(InstructionSet isa) {
- std::string InstructionSetFeatures::GetFeatureString() const {
- std::string result;
- - if ((mask_ & kHwDiv) != 0) {
- + if (HasDivideInstruction()) {
- result += "div";
- }
- + if (HasLpae()) {
- + result += "lpae";
- + }
- + if (HasSSSE3()) {
- + result += "ssse3";
- + }
- + if (HasSSE4_1()) {
- + result += "sse4_1";
- + }
- + if (HasSSE4_2()) {
- + result += "sse4_2";
- + }
- + if (HasAVX()) {
- + result += "avx";
- + }
- + if (HasAVX2()) {
- + result += "avx2";
- + }
- + if (HasAES_IN()) {
- + result += "aes_in";
- + }
- + if (HasPOPCNT()) {
- + result += "popcnt";
- + }
- + if (HasMOVBE()) {
- + result += "movbe";
- + }
- if (result.size() == 0) {
- result = "none";
- }
- diff --git a/runtime/instruction_set.h b/runtime/instruction_set.h
- index ae8eeac..ea8855b 100644
- --- a/runtime/instruction_set.h
- +++ b/runtime/instruction_set.h
- @@ -176,6 +176,14 @@ size_t GetStackOverflowReservedBytes(InstructionSet isa);
- enum InstructionFeatures {
- kHwDiv = 0x1, // Supports hardware divide.
- kHwLpae = 0x2, // Supports Large Physical Address Extension.
- + kSSSE3 = 0x4,
- + kSSE4_1 = 0xc,
- + kSSE4_2 = 0x1c,
- + kAVX = 0x3c,
- + kAVX2 = 0x7c,
- + kAES_IN = 0x80,
- + kPOPCNT = 0x100,
- + kMOVBE = 0x200,
- };
- // This is a bitmask of supported features per architecture.
- @@ -202,6 +210,70 @@ class PACKED(4) InstructionSetFeatures {
- mask_ = (mask_ & ~kHwLpae) | (v ? kHwLpae : 0);
- }
- + bool HasSSSE3() const {
- + return (mask_ & 0x7C) == kSSSE3;
- + }
- +
- + void SetHasSSSE3() {
- + mask_ |= kSSSE3;
- + }
- +
- + bool HasSSE4_1() const {
- + return (mask_ & 0x7C) == kSSE4_1;
- + }
- +
- + void SetHasSSE4_1() {
- + mask_ |= kSSE4_1;
- + }
- +
- + bool HasSSE4_2() const {
- + return (mask_ & 0x7C) == kSSE4_2;
- + }
- +
- + void SetHasSSE4_2() {
- + mask_ |= kSSE4_2;
- + }
- +
- + bool HasAVX() const {
- + return (mask_ & 0x7C) == kAVX;
- + }
- +
- + void SetHasAVX() {
- + mask_ |= kAVX;
- + }
- +
- + bool HasAVX2() const {
- + return (mask_ & 0x7C) == kAVX2;
- + }
- +
- + void SetHasAVX2() {
- + mask_ |= kAVX2;
- + }
- +
- + bool HasAES_IN() const {
- + return (mask_ & kAES_IN) != 0;
- + }
- +
- + void SetHasAES_IN() {
- + mask_ |= kAES_IN;
- + }
- +
- + bool HasPOPCNT() const {
- + return (mask_ & kPOPCNT) != 0;
- + }
- +
- + void SetHasPOPCNT() {
- + mask_ |= kPOPCNT;
- + }
- +
- + bool HasMOVBE() const {
- + return (mask_ & kMOVBE) != 0;
- + }
- +
- + void SetHasMOVBE() {
- + mask_ |= kMOVBE;
- + }
- +
- std::string GetFeatureString() const;
- // Other features in here.
- --
- 1.7.9.5
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement