Make the C++ tests run without SSE2 support.
authorsgjesse@chromium.org <sgjesse@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 17 Mar 2010 10:28:44 +0000 (10:28 +0000)
committersgjesse@chromium.org <sgjesse@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 17 Mar 2010 10:28:44 +0000 (10:28 +0000)
Review URL: http://codereview.chromium.org/982007

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4158 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

test/cctest/test-assembler-ia32.cc
test/cctest/test-disasm-ia32.cc

index 76eb6bb3ffc75171aa587135ed5b139d086cbc2b..e499c6fa8520daaa0712f2ddc86e859752c9a28e 100644 (file)
@@ -167,6 +167,8 @@ TEST(AssemblerIa322) {
 typedef int (*F3)(float x);
 
 TEST(AssemblerIa323) {
+  if (!CpuFeatures::IsSupported(SSE2)) return;
+
   InitializeVM();
   v8::HandleScope scope;
 
@@ -201,6 +203,8 @@ TEST(AssemblerIa323) {
 typedef int (*F4)(double x);
 
 TEST(AssemblerIa324) {
+  if (!CpuFeatures::IsSupported(SSE2)) return;
+
   InitializeVM();
   v8::HandleScope scope;
 
@@ -258,6 +262,8 @@ TEST(AssemblerIa325) {
 typedef double (*F5)(double x, double y);
 
 TEST(AssemblerIa326) {
+  if (!CpuFeatures::IsSupported(SSE2)) return;
+
   InitializeVM();
   v8::HandleScope scope;
   CHECK(CpuFeatures::IsSupported(SSE2));
@@ -303,6 +309,8 @@ TEST(AssemblerIa326) {
 typedef double (*F6)(int x);
 
 TEST(AssemblerIa328) {
+  if (!CpuFeatures::IsSupported(SSE2)) return;
+
   InitializeVM();
   v8::HandleScope scope;
   CHECK(CpuFeatures::IsSupported(SSE2));
index 5a64f0fdfd25b6e82a550e54db42ab6f63dd53eb..02e64b488eb5ca91ddeb4f6e7ae09912c0d69865 100644 (file)
@@ -361,45 +361,47 @@ TEST(DisasmIa320) {
   __ fwait();
   __ nop();
   {
-    CHECK(CpuFeatures::IsSupported(SSE2));
-    CpuFeatures::Scope fscope(SSE2);
-    __ cvttss2si(edx, Operand(ebx, ecx, times_4, 10000));
-    __ cvtsi2sd(xmm1, Operand(ebx, ecx, times_4, 10000));
-    __ addsd(xmm1, xmm0);
-    __ mulsd(xmm1, xmm0);
-    __ subsd(xmm1, xmm0);
-    __ divsd(xmm1, xmm0);
-    __ movdbl(xmm1, Operand(ebx, ecx, times_4, 10000));
-    __ movdbl(Operand(ebx, ecx, times_4, 10000), xmm1);
-    __ comisd(xmm0, xmm1);
-
-    // 128 bit move instructions.
-    __ movdqa(xmm0, Operand(ebx, ecx, times_4, 10000));
-    __ movdqa(Operand(ebx, ecx, times_4, 10000), xmm0);
-    __ movdqu(xmm0, Operand(ebx, ecx, times_4, 10000));
-    __ movdqu(Operand(ebx, ecx, times_4, 10000), xmm0);
+    if (CpuFeatures::IsSupported(SSE2)) {
+      CpuFeatures::Scope fscope(SSE2);
+      __ cvttss2si(edx, Operand(ebx, ecx, times_4, 10000));
+      __ cvtsi2sd(xmm1, Operand(ebx, ecx, times_4, 10000));
+      __ addsd(xmm1, xmm0);
+      __ mulsd(xmm1, xmm0);
+      __ subsd(xmm1, xmm0);
+      __ divsd(xmm1, xmm0);
+      __ movdbl(xmm1, Operand(ebx, ecx, times_4, 10000));
+      __ movdbl(Operand(ebx, ecx, times_4, 10000), xmm1);
+      __ comisd(xmm0, xmm1);
+
+      // 128 bit move instructions.
+      __ movdqa(xmm0, Operand(ebx, ecx, times_4, 10000));
+      __ movdqa(Operand(ebx, ecx, times_4, 10000), xmm0);
+      __ movdqu(xmm0, Operand(ebx, ecx, times_4, 10000));
+      __ movdqu(Operand(ebx, ecx, times_4, 10000), xmm0);
+    }
   }
 
   // cmov.
   {
-    CHECK(CpuFeatures::IsSupported(CMOV));
-    CpuFeatures::Scope use_cmov(CMOV);
-    __ cmov(overflow, eax, Operand(eax, 0));
-    __ cmov(no_overflow, eax, Operand(eax, 1));
-    __ cmov(below, eax, Operand(eax, 2));
-    __ cmov(above_equal, eax, Operand(eax, 3));
-    __ cmov(equal, eax, Operand(ebx, 0));
-    __ cmov(not_equal, eax, Operand(ebx, 1));
-    __ cmov(below_equal, eax, Operand(ebx, 2));
-    __ cmov(above, eax, Operand(ebx, 3));
-    __ cmov(sign, eax, Operand(ecx, 0));
-    __ cmov(not_sign, eax, Operand(ecx, 1));
-    __ cmov(parity_even, eax, Operand(ecx, 2));
-    __ cmov(parity_odd, eax, Operand(ecx, 3));
-    __ cmov(less, eax, Operand(edx, 0));
-    __ cmov(greater_equal, eax, Operand(edx, 1));
-    __ cmov(less_equal, eax, Operand(edx, 2));
-    __ cmov(greater, eax, Operand(edx, 3));
+    if (CpuFeatures::IsSupported(CMOV)) {
+      CpuFeatures::Scope use_cmov(CMOV);
+      __ cmov(overflow, eax, Operand(eax, 0));
+      __ cmov(no_overflow, eax, Operand(eax, 1));
+      __ cmov(below, eax, Operand(eax, 2));
+      __ cmov(above_equal, eax, Operand(eax, 3));
+      __ cmov(equal, eax, Operand(ebx, 0));
+      __ cmov(not_equal, eax, Operand(ebx, 1));
+      __ cmov(below_equal, eax, Operand(ebx, 2));
+      __ cmov(above, eax, Operand(ebx, 3));
+      __ cmov(sign, eax, Operand(ecx, 0));
+      __ cmov(not_sign, eax, Operand(ecx, 1));
+      __ cmov(parity_even, eax, Operand(ecx, 2));
+      __ cmov(parity_odd, eax, Operand(ecx, 3));
+      __ cmov(less, eax, Operand(edx, 0));
+      __ cmov(greater_equal, eax, Operand(edx, 1));
+      __ cmov(less_equal, eax, Operand(edx, 2));
+      __ cmov(greater, eax, Operand(edx, 3));
+    }
   }
 
   __ ret(0);