Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(361)

Side by Side Diff: test/unittests/base/cpu-unittest.cc

Issue 878063002: [x86] Disable AVX unless the operating system explicitly claims to support it. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix compilation. Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/x64/assembler-x64.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/base/cpu.h" 5 #include "src/base/cpu.h"
6 #include "testing/gtest/include/gtest/gtest.h" 6 #include "testing/gtest/include/gtest/gtest.h"
7 7
8 namespace v8 { 8 namespace v8 {
9 namespace base { 9 namespace base {
10 10
11 TEST(CPUTest, FeatureImplications) { 11 TEST(CPUTest, FeatureImplications) {
12 CPU cpu; 12 CPU cpu;
13 13
14 // ia32 and x64 features 14 // ia32 and x64 features
15 EXPECT_TRUE(!cpu.has_sse() || cpu.has_mmx()); 15 EXPECT_TRUE(!cpu.has_sse() || cpu.has_mmx());
16 EXPECT_TRUE(!cpu.has_sse2() || cpu.has_sse()); 16 EXPECT_TRUE(!cpu.has_sse2() || cpu.has_sse());
17 EXPECT_TRUE(!cpu.has_sse3() || cpu.has_sse2()); 17 EXPECT_TRUE(!cpu.has_sse3() || cpu.has_sse2());
18 EXPECT_TRUE(!cpu.has_ssse3() || cpu.has_sse3()); 18 EXPECT_TRUE(!cpu.has_ssse3() || cpu.has_sse3());
19 EXPECT_TRUE(!cpu.has_sse41() || cpu.has_sse3()); 19 EXPECT_TRUE(!cpu.has_sse41() || cpu.has_sse3());
20 EXPECT_TRUE(!cpu.has_sse42() || cpu.has_sse41()); 20 EXPECT_TRUE(!cpu.has_sse42() || cpu.has_sse41());
21 EXPECT_TRUE(!cpu.has_avx() || cpu.has_sse2());
22 EXPECT_TRUE(!cpu.has_fma3() || cpu.has_avx());
21 23
22 // arm features 24 // arm features
23 EXPECT_TRUE(!cpu.has_vfp3_d32() || cpu.has_vfp3()); 25 EXPECT_TRUE(!cpu.has_vfp3_d32() || cpu.has_vfp3());
24 } 26 }
25 27
26 28
27 TEST(CPUTest, RequiredFeatures) { 29 TEST(CPUTest, RequiredFeatures) {
28 CPU cpu; 30 CPU cpu;
29 31
30 #if V8_HOST_ARCH_ARM 32 #if V8_HOST_ARCH_ARM
31 EXPECT_TRUE(cpu.has_fpu()); 33 EXPECT_TRUE(cpu.has_fpu());
32 #endif 34 #endif
33 35
34 #if V8_HOST_ARCH_IA32 36 #if V8_HOST_ARCH_IA32
35 EXPECT_TRUE(cpu.has_fpu()); 37 EXPECT_TRUE(cpu.has_fpu());
36 EXPECT_TRUE(cpu.has_sahf()); 38 EXPECT_TRUE(cpu.has_sahf());
37 #endif 39 #endif
38 40
39 #if V8_HOST_ARCH_X64 41 #if V8_HOST_ARCH_X64
40 EXPECT_TRUE(cpu.has_fpu()); 42 EXPECT_TRUE(cpu.has_fpu());
41 EXPECT_TRUE(cpu.has_cmov()); 43 EXPECT_TRUE(cpu.has_cmov());
42 EXPECT_TRUE(cpu.has_mmx()); 44 EXPECT_TRUE(cpu.has_mmx());
43 EXPECT_TRUE(cpu.has_sse()); 45 EXPECT_TRUE(cpu.has_sse());
44 EXPECT_TRUE(cpu.has_sse2()); 46 EXPECT_TRUE(cpu.has_sse2());
45 #endif 47 #endif
46 } 48 }
47 49
48 } // namespace base 50 } // namespace base
49 } // namespace v8 51 } // namespace v8
OLDNEW
« no previous file with comments | « src/x64/assembler-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698