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

Side by Side Diff: test/cctest/test-assembler-ia32.cc

Issue 982007: Make the C++ tests run without SSE2 support. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | test/cctest/test-disasm-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry()); 160 F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry());
161 int res = f(10); 161 int res = f(10);
162 ::printf("f() = %d\n", res); 162 ::printf("f() = %d\n", res);
163 CHECK_EQ(3628800, res); 163 CHECK_EQ(3628800, res);
164 } 164 }
165 165
166 166
167 typedef int (*F3)(float x); 167 typedef int (*F3)(float x);
168 168
169 TEST(AssemblerIa323) { 169 TEST(AssemblerIa323) {
170 if (!CpuFeatures::IsSupported(SSE2)) return;
171
170 InitializeVM(); 172 InitializeVM();
171 v8::HandleScope scope; 173 v8::HandleScope scope;
172 174
173 v8::internal::byte buffer[256]; 175 v8::internal::byte buffer[256];
174 Assembler assm(buffer, sizeof buffer); 176 Assembler assm(buffer, sizeof buffer);
175 177
176 CHECK(CpuFeatures::IsSupported(SSE2)); 178 CHECK(CpuFeatures::IsSupported(SSE2));
177 { CpuFeatures::Scope fscope(SSE2); 179 { CpuFeatures::Scope fscope(SSE2);
178 __ cvttss2si(eax, Operand(esp, 4)); 180 __ cvttss2si(eax, Operand(esp, 4));
179 __ ret(0); 181 __ ret(0);
(...skipping 14 matching lines...) Expand all
194 F3 f = FUNCTION_CAST<F3>(code->entry()); 196 F3 f = FUNCTION_CAST<F3>(code->entry());
195 int res = f(static_cast<float>(-3.1415)); 197 int res = f(static_cast<float>(-3.1415));
196 ::printf("f() = %d\n", res); 198 ::printf("f() = %d\n", res);
197 CHECK_EQ(-3, res); 199 CHECK_EQ(-3, res);
198 } 200 }
199 201
200 202
201 typedef int (*F4)(double x); 203 typedef int (*F4)(double x);
202 204
203 TEST(AssemblerIa324) { 205 TEST(AssemblerIa324) {
206 if (!CpuFeatures::IsSupported(SSE2)) return;
207
204 InitializeVM(); 208 InitializeVM();
205 v8::HandleScope scope; 209 v8::HandleScope scope;
206 210
207 v8::internal::byte buffer[256]; 211 v8::internal::byte buffer[256];
208 Assembler assm(buffer, sizeof buffer); 212 Assembler assm(buffer, sizeof buffer);
209 213
210 CHECK(CpuFeatures::IsSupported(SSE2)); 214 CHECK(CpuFeatures::IsSupported(SSE2));
211 CpuFeatures::Scope fscope(SSE2); 215 CpuFeatures::Scope fscope(SSE2);
212 __ cvttsd2si(eax, Operand(esp, 4)); 216 __ cvttsd2si(eax, Operand(esp, 4));
213 __ ret(0); 217 __ ret(0);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 Handle<Object>(Heap::undefined_value()))); 255 Handle<Object>(Heap::undefined_value())));
252 F0 f = FUNCTION_CAST<F0>(code->entry()); 256 F0 f = FUNCTION_CAST<F0>(code->entry());
253 int res = f(); 257 int res = f();
254 CHECK_EQ(42, res); 258 CHECK_EQ(42, res);
255 } 259 }
256 260
257 261
258 typedef double (*F5)(double x, double y); 262 typedef double (*F5)(double x, double y);
259 263
260 TEST(AssemblerIa326) { 264 TEST(AssemblerIa326) {
265 if (!CpuFeatures::IsSupported(SSE2)) return;
266
261 InitializeVM(); 267 InitializeVM();
262 v8::HandleScope scope; 268 v8::HandleScope scope;
263 CHECK(CpuFeatures::IsSupported(SSE2)); 269 CHECK(CpuFeatures::IsSupported(SSE2));
264 CpuFeatures::Scope fscope(SSE2); 270 CpuFeatures::Scope fscope(SSE2);
265 v8::internal::byte buffer[256]; 271 v8::internal::byte buffer[256];
266 Assembler assm(buffer, sizeof buffer); 272 Assembler assm(buffer, sizeof buffer);
267 273
268 __ movdbl(xmm0, Operand(esp, 1 * kPointerSize)); 274 __ movdbl(xmm0, Operand(esp, 1 * kPointerSize));
269 __ movdbl(xmm1, Operand(esp, 3 * kPointerSize)); 275 __ movdbl(xmm1, Operand(esp, 3 * kPointerSize));
270 __ addsd(xmm0, xmm1); 276 __ addsd(xmm0, xmm1);
(...skipping 25 matching lines...) Expand all
296 F5 f = FUNCTION_CAST<F5>(code->entry()); 302 F5 f = FUNCTION_CAST<F5>(code->entry());
297 double res = f(2.2, 1.1); 303 double res = f(2.2, 1.1);
298 ::printf("f() = %f\n", res); 304 ::printf("f() = %f\n", res);
299 CHECK(2.29 < res && res < 2.31); 305 CHECK(2.29 < res && res < 2.31);
300 } 306 }
301 307
302 308
303 typedef double (*F6)(int x); 309 typedef double (*F6)(int x);
304 310
305 TEST(AssemblerIa328) { 311 TEST(AssemblerIa328) {
312 if (!CpuFeatures::IsSupported(SSE2)) return;
313
306 InitializeVM(); 314 InitializeVM();
307 v8::HandleScope scope; 315 v8::HandleScope scope;
308 CHECK(CpuFeatures::IsSupported(SSE2)); 316 CHECK(CpuFeatures::IsSupported(SSE2));
309 CpuFeatures::Scope fscope(SSE2); 317 CpuFeatures::Scope fscope(SSE2);
310 v8::internal::byte buffer[256]; 318 v8::internal::byte buffer[256];
311 Assembler assm(buffer, sizeof buffer); 319 Assembler assm(buffer, sizeof buffer);
312 __ mov(eax, Operand(esp, 4)); 320 __ mov(eax, Operand(esp, 4));
313 __ cvtsi2sd(xmm0, Operand(eax)); 321 __ cvtsi2sd(xmm0, Operand(eax));
314 // Copy xmm0 to st(0) using eight bytes of stack. 322 // Copy xmm0 to st(0) using eight bytes of stack.
315 __ sub(Operand(esp), Immediate(8)); 323 __ sub(Operand(esp), Immediate(8));
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 #endif 394 #endif
387 395
388 F7 f = FUNCTION_CAST<F7>(Code::cast(code)->entry()); 396 F7 f = FUNCTION_CAST<F7>(Code::cast(code)->entry());
389 CHECK_EQ(kLess, f(1.1, 2.2)); 397 CHECK_EQ(kLess, f(1.1, 2.2));
390 CHECK_EQ(kEqual, f(2.2, 2.2)); 398 CHECK_EQ(kEqual, f(2.2, 2.2));
391 CHECK_EQ(kGreater, f(3.3, 2.2)); 399 CHECK_EQ(kGreater, f(3.3, 2.2));
392 CHECK_EQ(kNaN, f(OS::nan_value(), 1.1)); 400 CHECK_EQ(kNaN, f(OS::nan_value(), 1.1));
393 } 401 }
394 402
395 #undef __ 403 #undef __
OLDNEW
« no previous file with comments | « no previous file | test/cctest/test-disasm-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698