Ian Rogers | d582fa4 | 2014-11-05 23:46:43 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2014 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #include "instruction_set_features_x86.h" |
| 18 | |
| 19 | #include <fstream> |
| 20 | #include <sstream> |
| 21 | |
Andreas Gampe | 46ee31b | 2016-12-14 10:11:49 -0800 | [diff] [blame] | 22 | #include "android-base/stringprintf.h" |
Andreas Gampe | 9186ced | 2016-12-12 14:28:21 -0800 | [diff] [blame] | 23 | #include "android-base/strings.h" |
| 24 | |
Ian Rogers | d582fa4 | 2014-11-05 23:46:43 -0800 | [diff] [blame] | 25 | #include "arch/x86_64/instruction_set_features_x86_64.h" |
Andreas Gampe | 46ee31b | 2016-12-14 10:11:49 -0800 | [diff] [blame] | 26 | #include "base/logging.h" |
Ian Rogers | d582fa4 | 2014-11-05 23:46:43 -0800 | [diff] [blame] | 27 | |
| 28 | namespace art { |
| 29 | |
Andreas Gampe | 46ee31b | 2016-12-14 10:11:49 -0800 | [diff] [blame] | 30 | using android::base::StringPrintf; |
| 31 | |
Andreas Gampe | 24a05f4 | 2015-04-03 13:46:54 -0700 | [diff] [blame] | 32 | // Feature-support arrays. |
| 33 | |
| 34 | static constexpr const char* x86_known_variants[] = { |
| 35 | "atom", |
Luis Hector Chavez | b8bff09 | 2017-06-09 12:33:04 -0700 | [diff] [blame] | 36 | "sandybridge", |
Andreas Gampe | 24a05f4 | 2015-04-03 13:46:54 -0700 | [diff] [blame] | 37 | "silvermont", |
| 38 | }; |
| 39 | |
| 40 | static constexpr const char* x86_variants_with_ssse3[] = { |
| 41 | "atom", |
Luis Hector Chavez | b8bff09 | 2017-06-09 12:33:04 -0700 | [diff] [blame] | 42 | "sandybridge", |
Andreas Gampe | 24a05f4 | 2015-04-03 13:46:54 -0700 | [diff] [blame] | 43 | "silvermont", |
| 44 | }; |
| 45 | |
| 46 | static constexpr const char* x86_variants_with_sse4_1[] = { |
Luis Hector Chavez | b8bff09 | 2017-06-09 12:33:04 -0700 | [diff] [blame] | 47 | "sandybridge", |
Andreas Gampe | 24a05f4 | 2015-04-03 13:46:54 -0700 | [diff] [blame] | 48 | "silvermont", |
| 49 | }; |
| 50 | |
| 51 | static constexpr const char* x86_variants_with_sse4_2[] = { |
Luis Hector Chavez | b8bff09 | 2017-06-09 12:33:04 -0700 | [diff] [blame] | 52 | "sandybridge", |
Andreas Gampe | 24a05f4 | 2015-04-03 13:46:54 -0700 | [diff] [blame] | 53 | "silvermont", |
| 54 | }; |
| 55 | |
Aart Bik | 3f67e69 | 2016-01-15 14:35:12 -0800 | [diff] [blame] | 56 | static constexpr const char* x86_variants_with_popcnt[] = { |
Luis Hector Chavez | b8bff09 | 2017-06-09 12:33:04 -0700 | [diff] [blame] | 57 | "sandybridge", |
Aart Bik | 3f67e69 | 2016-01-15 14:35:12 -0800 | [diff] [blame] | 58 | "silvermont", |
| 59 | }; |
| 60 | |
Andreas Gampe | 0415b4e | 2015-01-06 15:17:07 -0800 | [diff] [blame] | 61 | X86FeaturesUniquePtr X86InstructionSetFeatures::Create(bool x86_64, |
Andreas Gampe | 0415b4e | 2015-01-06 15:17:07 -0800 | [diff] [blame] | 62 | bool has_SSSE3, |
| 63 | bool has_SSE4_1, |
| 64 | bool has_SSE4_2, |
| 65 | bool has_AVX, |
| 66 | bool has_AVX2, |
| 67 | bool has_POPCNT) { |
| 68 | if (x86_64) { |
Serban Constantinescu | b595b40 | 2016-09-23 11:06:03 +0100 | [diff] [blame] | 69 | return X86FeaturesUniquePtr(new X86_64InstructionSetFeatures(has_SSSE3, |
Andreas Gampe | 0415b4e | 2015-01-06 15:17:07 -0800 | [diff] [blame] | 70 | has_SSE4_1, |
| 71 | has_SSE4_2, |
| 72 | has_AVX, |
| 73 | has_AVX2, |
| 74 | has_POPCNT)); |
| 75 | } else { |
Serban Constantinescu | b595b40 | 2016-09-23 11:06:03 +0100 | [diff] [blame] | 76 | return X86FeaturesUniquePtr(new X86InstructionSetFeatures(has_SSSE3, |
Andreas Gampe | 0415b4e | 2015-01-06 15:17:07 -0800 | [diff] [blame] | 77 | has_SSE4_1, |
| 78 | has_SSE4_2, |
| 79 | has_AVX, |
| 80 | has_AVX2, |
| 81 | has_POPCNT)); |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | X86FeaturesUniquePtr X86InstructionSetFeatures::FromVariant( |
Andreas Gampe | ca71458 | 2015-04-03 19:41:34 -0700 | [diff] [blame] | 86 | const std::string& variant, std::string* error_msg ATTRIBUTE_UNUSED, |
Ian Rogers | d582fa4 | 2014-11-05 23:46:43 -0800 | [diff] [blame] | 87 | bool x86_64) { |
Ian Rogers | d582fa4 | 2014-11-05 23:46:43 -0800 | [diff] [blame] | 88 | bool has_SSSE3 = FindVariantInArray(x86_variants_with_ssse3, arraysize(x86_variants_with_ssse3), |
| 89 | variant); |
Andreas Gampe | 24a05f4 | 2015-04-03 13:46:54 -0700 | [diff] [blame] | 90 | bool has_SSE4_1 = FindVariantInArray(x86_variants_with_sse4_1, |
| 91 | arraysize(x86_variants_with_sse4_1), |
| 92 | variant); |
| 93 | bool has_SSE4_2 = FindVariantInArray(x86_variants_with_sse4_2, |
| 94 | arraysize(x86_variants_with_sse4_2), |
| 95 | variant); |
Ian Rogers | d582fa4 | 2014-11-05 23:46:43 -0800 | [diff] [blame] | 96 | bool has_AVX = false; |
| 97 | bool has_AVX2 = false; |
Andreas Gampe | 24a05f4 | 2015-04-03 13:46:54 -0700 | [diff] [blame] | 98 | |
Aart Bik | 3f67e69 | 2016-01-15 14:35:12 -0800 | [diff] [blame] | 99 | bool has_POPCNT = FindVariantInArray(x86_variants_with_popcnt, |
| 100 | arraysize(x86_variants_with_popcnt), |
| 101 | variant); |
| 102 | |
| 103 | // Verify that variant is known. |
Andreas Gampe | 24a05f4 | 2015-04-03 13:46:54 -0700 | [diff] [blame] | 104 | bool known_variant = FindVariantInArray(x86_known_variants, arraysize(x86_known_variants), |
| 105 | variant); |
Ian Rogers | d582fa4 | 2014-11-05 23:46:43 -0800 | [diff] [blame] | 106 | if (!known_variant && variant != "default") { |
Ian Rogers | d582fa4 | 2014-11-05 23:46:43 -0800 | [diff] [blame] | 107 | LOG(WARNING) << "Unexpected CPU variant for X86 using defaults: " << variant; |
| 108 | } |
| 109 | |
Serban Constantinescu | b595b40 | 2016-09-23 11:06:03 +0100 | [diff] [blame] | 110 | return Create(x86_64, has_SSSE3, has_SSE4_1, has_SSE4_2, has_AVX, has_AVX2, has_POPCNT); |
Ian Rogers | d582fa4 | 2014-11-05 23:46:43 -0800 | [diff] [blame] | 111 | } |
| 112 | |
Andreas Gampe | 0415b4e | 2015-01-06 15:17:07 -0800 | [diff] [blame] | 113 | X86FeaturesUniquePtr X86InstructionSetFeatures::FromBitmap(uint32_t bitmap, bool x86_64) { |
Ian Rogers | d582fa4 | 2014-11-05 23:46:43 -0800 | [diff] [blame] | 114 | bool has_SSSE3 = (bitmap & kSsse3Bitfield) != 0; |
| 115 | bool has_SSE4_1 = (bitmap & kSse4_1Bitfield) != 0; |
| 116 | bool has_SSE4_2 = (bitmap & kSse4_2Bitfield) != 0; |
| 117 | bool has_AVX = (bitmap & kAvxBitfield) != 0; |
| 118 | bool has_AVX2 = (bitmap & kAvxBitfield) != 0; |
Aart Bik | 3f67e69 | 2016-01-15 14:35:12 -0800 | [diff] [blame] | 119 | bool has_POPCNT = (bitmap & kPopCntBitfield) != 0; |
Serban Constantinescu | b595b40 | 2016-09-23 11:06:03 +0100 | [diff] [blame] | 120 | return Create(x86_64, has_SSSE3, has_SSE4_1, has_SSE4_2, has_AVX, has_AVX2, has_POPCNT); |
Ian Rogers | d582fa4 | 2014-11-05 23:46:43 -0800 | [diff] [blame] | 121 | } |
| 122 | |
Andreas Gampe | 0415b4e | 2015-01-06 15:17:07 -0800 | [diff] [blame] | 123 | X86FeaturesUniquePtr X86InstructionSetFeatures::FromCppDefines(bool x86_64) { |
Ian Rogers | d582fa4 | 2014-11-05 23:46:43 -0800 | [diff] [blame] | 124 | #ifndef __SSSE3__ |
| 125 | const bool has_SSSE3 = false; |
| 126 | #else |
| 127 | const bool has_SSSE3 = true; |
| 128 | #endif |
| 129 | |
| 130 | #ifndef __SSE4_1__ |
| 131 | const bool has_SSE4_1 = false; |
| 132 | #else |
| 133 | const bool has_SSE4_1 = true; |
| 134 | #endif |
| 135 | |
| 136 | #ifndef __SSE4_2__ |
| 137 | const bool has_SSE4_2 = false; |
| 138 | #else |
| 139 | const bool has_SSE4_2 = true; |
| 140 | #endif |
| 141 | |
| 142 | #ifndef __AVX__ |
| 143 | const bool has_AVX = false; |
| 144 | #else |
| 145 | const bool has_AVX = true; |
| 146 | #endif |
| 147 | |
| 148 | #ifndef __AVX2__ |
| 149 | const bool has_AVX2 = false; |
| 150 | #else |
| 151 | const bool has_AVX2 = true; |
| 152 | #endif |
| 153 | |
Aart Bik | 715d06b | 2016-01-21 15:52:58 -0800 | [diff] [blame] | 154 | #ifndef __POPCNT__ |
Aart Bik | 3f67e69 | 2016-01-15 14:35:12 -0800 | [diff] [blame] | 155 | const bool has_POPCNT = false; |
Aart Bik | 715d06b | 2016-01-21 15:52:58 -0800 | [diff] [blame] | 156 | #else |
| 157 | const bool has_POPCNT = true; |
| 158 | #endif |
Aart Bik | 3f67e69 | 2016-01-15 14:35:12 -0800 | [diff] [blame] | 159 | |
Serban Constantinescu | b595b40 | 2016-09-23 11:06:03 +0100 | [diff] [blame] | 160 | return Create(x86_64, has_SSSE3, has_SSE4_1, has_SSE4_2, has_AVX, has_AVX2, has_POPCNT); |
Ian Rogers | d582fa4 | 2014-11-05 23:46:43 -0800 | [diff] [blame] | 161 | } |
| 162 | |
Andreas Gampe | 0415b4e | 2015-01-06 15:17:07 -0800 | [diff] [blame] | 163 | X86FeaturesUniquePtr X86InstructionSetFeatures::FromCpuInfo(bool x86_64) { |
Ian Rogers | d582fa4 | 2014-11-05 23:46:43 -0800 | [diff] [blame] | 164 | // Look in /proc/cpuinfo for features we need. Only use this when we can guarantee that |
| 165 | // the kernel puts the appropriate feature flags in here. Sometimes it doesn't. |
Ian Rogers | d582fa4 | 2014-11-05 23:46:43 -0800 | [diff] [blame] | 166 | bool has_SSSE3 = false; |
| 167 | bool has_SSE4_1 = false; |
| 168 | bool has_SSE4_2 = false; |
| 169 | bool has_AVX = false; |
| 170 | bool has_AVX2 = false; |
Aart Bik | 3f67e69 | 2016-01-15 14:35:12 -0800 | [diff] [blame] | 171 | bool has_POPCNT = false; |
Ian Rogers | d582fa4 | 2014-11-05 23:46:43 -0800 | [diff] [blame] | 172 | |
| 173 | std::ifstream in("/proc/cpuinfo"); |
| 174 | if (!in.fail()) { |
| 175 | while (!in.eof()) { |
| 176 | std::string line; |
| 177 | std::getline(in, line); |
| 178 | if (!in.eof()) { |
| 179 | LOG(INFO) << "cpuinfo line: " << line; |
| 180 | if (line.find("flags") != std::string::npos) { |
| 181 | LOG(INFO) << "found flags"; |
| 182 | if (line.find("ssse3") != std::string::npos) { |
| 183 | has_SSSE3 = true; |
| 184 | } |
| 185 | if (line.find("sse4_1") != std::string::npos) { |
| 186 | has_SSE4_1 = true; |
| 187 | } |
| 188 | if (line.find("sse4_2") != std::string::npos) { |
| 189 | has_SSE4_2 = true; |
| 190 | } |
| 191 | if (line.find("avx") != std::string::npos) { |
| 192 | has_AVX = true; |
| 193 | } |
| 194 | if (line.find("avx2") != std::string::npos) { |
| 195 | has_AVX2 = true; |
| 196 | } |
Aart Bik | 3f67e69 | 2016-01-15 14:35:12 -0800 | [diff] [blame] | 197 | if (line.find("popcnt") != std::string::npos) { |
| 198 | has_POPCNT = true; |
| 199 | } |
Ian Rogers | d582fa4 | 2014-11-05 23:46:43 -0800 | [diff] [blame] | 200 | } |
| 201 | } |
| 202 | } |
| 203 | in.close(); |
| 204 | } else { |
| 205 | LOG(ERROR) << "Failed to open /proc/cpuinfo"; |
| 206 | } |
Serban Constantinescu | b595b40 | 2016-09-23 11:06:03 +0100 | [diff] [blame] | 207 | return Create(x86_64, has_SSSE3, has_SSE4_1, has_SSE4_2, has_AVX, has_AVX2, has_POPCNT); |
Ian Rogers | d582fa4 | 2014-11-05 23:46:43 -0800 | [diff] [blame] | 208 | } |
| 209 | |
Andreas Gampe | 0415b4e | 2015-01-06 15:17:07 -0800 | [diff] [blame] | 210 | X86FeaturesUniquePtr X86InstructionSetFeatures::FromHwcap(bool x86_64) { |
Ian Rogers | d582fa4 | 2014-11-05 23:46:43 -0800 | [diff] [blame] | 211 | UNIMPLEMENTED(WARNING); |
| 212 | return FromCppDefines(x86_64); |
| 213 | } |
| 214 | |
Andreas Gampe | 0415b4e | 2015-01-06 15:17:07 -0800 | [diff] [blame] | 215 | X86FeaturesUniquePtr X86InstructionSetFeatures::FromAssembly(bool x86_64) { |
Ian Rogers | d582fa4 | 2014-11-05 23:46:43 -0800 | [diff] [blame] | 216 | UNIMPLEMENTED(WARNING); |
| 217 | return FromCppDefines(x86_64); |
| 218 | } |
| 219 | |
| 220 | bool X86InstructionSetFeatures::Equals(const InstructionSetFeatures* other) const { |
| 221 | if (GetInstructionSet() != other->GetInstructionSet()) { |
| 222 | return false; |
| 223 | } |
| 224 | const X86InstructionSetFeatures* other_as_x86 = other->AsX86InstructionSetFeatures(); |
Serban Constantinescu | b595b40 | 2016-09-23 11:06:03 +0100 | [diff] [blame] | 225 | return (has_SSSE3_ == other_as_x86->has_SSSE3_) && |
Ian Rogers | d582fa4 | 2014-11-05 23:46:43 -0800 | [diff] [blame] | 226 | (has_SSE4_1_ == other_as_x86->has_SSE4_1_) && |
| 227 | (has_SSE4_2_ == other_as_x86->has_SSE4_2_) && |
| 228 | (has_AVX_ == other_as_x86->has_AVX_) && |
Mark P Mendell | 17077d8 | 2015-12-16 19:15:59 +0000 | [diff] [blame] | 229 | (has_AVX2_ == other_as_x86->has_AVX2_) && |
Aart Bik | 3f67e69 | 2016-01-15 14:35:12 -0800 | [diff] [blame] | 230 | (has_POPCNT_ == other_as_x86->has_POPCNT_); |
Ian Rogers | d582fa4 | 2014-11-05 23:46:43 -0800 | [diff] [blame] | 231 | } |
| 232 | |
Aart Bik | 5354af9 | 2017-07-19 11:13:27 -0700 | [diff] [blame] | 233 | bool X86InstructionSetFeatures::HasAtLeast(const InstructionSetFeatures* other) const { |
| 234 | if (GetInstructionSet() != other->GetInstructionSet()) { |
| 235 | return false; |
| 236 | } |
| 237 | const X86InstructionSetFeatures* other_as_x86 = other->AsX86InstructionSetFeatures(); |
| 238 | return (has_SSSE3_ || !other_as_x86->has_SSSE3_) && |
| 239 | (has_SSE4_1_ || !other_as_x86->has_SSE4_1_) && |
| 240 | (has_SSE4_2_ || !other_as_x86->has_SSE4_2_) && |
| 241 | (has_AVX_ || !other_as_x86->has_AVX_) && |
| 242 | (has_AVX2_ || !other_as_x86->has_AVX2_) && |
| 243 | (has_POPCNT_ || !other_as_x86->has_POPCNT_); |
| 244 | } |
| 245 | |
Ian Rogers | d582fa4 | 2014-11-05 23:46:43 -0800 | [diff] [blame] | 246 | uint32_t X86InstructionSetFeatures::AsBitmap() const { |
Serban Constantinescu | b595b40 | 2016-09-23 11:06:03 +0100 | [diff] [blame] | 247 | return (has_SSSE3_ ? kSsse3Bitfield : 0) | |
Ian Rogers | d582fa4 | 2014-11-05 23:46:43 -0800 | [diff] [blame] | 248 | (has_SSE4_1_ ? kSse4_1Bitfield : 0) | |
| 249 | (has_SSE4_2_ ? kSse4_2Bitfield : 0) | |
| 250 | (has_AVX_ ? kAvxBitfield : 0) | |
Mark P Mendell | 17077d8 | 2015-12-16 19:15:59 +0000 | [diff] [blame] | 251 | (has_AVX2_ ? kAvx2Bitfield : 0) | |
Aart Bik | 3f67e69 | 2016-01-15 14:35:12 -0800 | [diff] [blame] | 252 | (has_POPCNT_ ? kPopCntBitfield : 0); |
Ian Rogers | d582fa4 | 2014-11-05 23:46:43 -0800 | [diff] [blame] | 253 | } |
| 254 | |
| 255 | std::string X86InstructionSetFeatures::GetFeatureString() const { |
| 256 | std::string result; |
Ian Rogers | d582fa4 | 2014-11-05 23:46:43 -0800 | [diff] [blame] | 257 | if (has_SSSE3_) { |
Serban Constantinescu | b595b40 | 2016-09-23 11:06:03 +0100 | [diff] [blame] | 258 | result += "ssse3"; |
Ian Rogers | d582fa4 | 2014-11-05 23:46:43 -0800 | [diff] [blame] | 259 | } else { |
Serban Constantinescu | b595b40 | 2016-09-23 11:06:03 +0100 | [diff] [blame] | 260 | result += "-ssse3"; |
Ian Rogers | d582fa4 | 2014-11-05 23:46:43 -0800 | [diff] [blame] | 261 | } |
| 262 | if (has_SSE4_1_) { |
| 263 | result += ",sse4.1"; |
| 264 | } else { |
| 265 | result += ",-sse4.1"; |
| 266 | } |
| 267 | if (has_SSE4_2_) { |
| 268 | result += ",sse4.2"; |
| 269 | } else { |
| 270 | result += ",-sse4.2"; |
| 271 | } |
| 272 | if (has_AVX_) { |
| 273 | result += ",avx"; |
| 274 | } else { |
| 275 | result += ",-avx"; |
| 276 | } |
| 277 | if (has_AVX2_) { |
| 278 | result += ",avx2"; |
| 279 | } else { |
| 280 | result += ",-avx2"; |
| 281 | } |
Aart Bik | 3f67e69 | 2016-01-15 14:35:12 -0800 | [diff] [blame] | 282 | if (has_POPCNT_) { |
| 283 | result += ",popcnt"; |
| 284 | } else { |
| 285 | result += ",-popcnt"; |
| 286 | } |
Ian Rogers | d582fa4 | 2014-11-05 23:46:43 -0800 | [diff] [blame] | 287 | return result; |
| 288 | } |
| 289 | |
Andreas Gampe | 0415b4e | 2015-01-06 15:17:07 -0800 | [diff] [blame] | 290 | std::unique_ptr<const InstructionSetFeatures> X86InstructionSetFeatures::AddFeaturesFromSplitString( |
Serban Constantinescu | b595b40 | 2016-09-23 11:06:03 +0100 | [diff] [blame] | 291 | const std::vector<std::string>& features, bool x86_64, |
Ian Rogers | d582fa4 | 2014-11-05 23:46:43 -0800 | [diff] [blame] | 292 | std::string* error_msg) const { |
| 293 | bool has_SSSE3 = has_SSSE3_; |
| 294 | bool has_SSE4_1 = has_SSE4_1_; |
| 295 | bool has_SSE4_2 = has_SSE4_2_; |
| 296 | bool has_AVX = has_AVX_; |
| 297 | bool has_AVX2 = has_AVX2_; |
Aart Bik | 3f67e69 | 2016-01-15 14:35:12 -0800 | [diff] [blame] | 298 | bool has_POPCNT = has_POPCNT_; |
Ian Rogers | d582fa4 | 2014-11-05 23:46:43 -0800 | [diff] [blame] | 299 | for (auto i = features.begin(); i != features.end(); i++) { |
Andreas Gampe | 9186ced | 2016-12-12 14:28:21 -0800 | [diff] [blame] | 300 | std::string feature = android::base::Trim(*i); |
Ian Rogers | d582fa4 | 2014-11-05 23:46:43 -0800 | [diff] [blame] | 301 | if (feature == "ssse3") { |
| 302 | has_SSSE3 = true; |
| 303 | } else if (feature == "-ssse3") { |
| 304 | has_SSSE3 = false; |
| 305 | } else if (feature == "sse4.1") { |
| 306 | has_SSE4_1 = true; |
| 307 | } else if (feature == "-sse4.1") { |
| 308 | has_SSE4_1 = false; |
| 309 | } else if (feature == "sse4.2") { |
| 310 | has_SSE4_2 = true; |
| 311 | } else if (feature == "-sse4.2") { |
| 312 | has_SSE4_2 = false; |
| 313 | } else if (feature == "avx") { |
| 314 | has_AVX = true; |
| 315 | } else if (feature == "-avx") { |
| 316 | has_AVX = false; |
| 317 | } else if (feature == "avx2") { |
| 318 | has_AVX2 = true; |
| 319 | } else if (feature == "-avx2") { |
| 320 | has_AVX2 = false; |
Aart Bik | 3f67e69 | 2016-01-15 14:35:12 -0800 | [diff] [blame] | 321 | } else if (feature == "popcnt") { |
| 322 | has_POPCNT = true; |
| 323 | } else if (feature == "-popcnt") { |
| 324 | has_POPCNT = false; |
Ian Rogers | d582fa4 | 2014-11-05 23:46:43 -0800 | [diff] [blame] | 325 | } else { |
| 326 | *error_msg = StringPrintf("Unknown instruction set feature: '%s'", feature.c_str()); |
| 327 | return nullptr; |
| 328 | } |
| 329 | } |
Serban Constantinescu | b595b40 | 2016-09-23 11:06:03 +0100 | [diff] [blame] | 330 | return Create(x86_64, has_SSSE3, has_SSE4_1, has_SSE4_2, has_AVX, has_AVX2, has_POPCNT); |
Ian Rogers | d582fa4 | 2014-11-05 23:46:43 -0800 | [diff] [blame] | 331 | } |
| 332 | |
| 333 | } // namespace art |