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

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

Issue 391051: Allow a platform to indicate that some CPU features are always... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 1 month 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
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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 166
167 typedef int (*F3)(float x); 167 typedef int (*F3)(float x);
168 168
169 TEST(AssemblerIa323) { 169 TEST(AssemblerIa323) {
170 InitializeVM(); 170 InitializeVM();
171 v8::HandleScope scope; 171 v8::HandleScope scope;
172 172
173 v8::internal::byte buffer[256]; 173 v8::internal::byte buffer[256];
174 Assembler assm(buffer, sizeof buffer); 174 Assembler assm(buffer, sizeof buffer);
175 175
176 CHECK(CpuFeatures::IsSupported(CpuFeatures::SSE2)); 176 CHECK(CpuFeatures::IsSupported(SSE2));
177 { CpuFeatures::Scope fscope(CpuFeatures::SSE2); 177 { CpuFeatures::Scope fscope(SSE2);
178 __ cvttss2si(eax, Operand(esp, 4)); 178 __ cvttss2si(eax, Operand(esp, 4));
179 __ ret(0); 179 __ ret(0);
180 } 180 }
181 181
182 CodeDesc desc; 182 CodeDesc desc;
183 assm.GetCode(&desc); 183 assm.GetCode(&desc);
184 Code* code = 184 Code* code =
185 Code::cast(Heap::CreateCode(desc, 185 Code::cast(Heap::CreateCode(desc,
186 NULL, 186 NULL,
187 Code::ComputeFlags(Code::STUB), 187 Code::ComputeFlags(Code::STUB),
(...skipping 12 matching lines...) Expand all
200 200
201 typedef int (*F4)(double x); 201 typedef int (*F4)(double x);
202 202
203 TEST(AssemblerIa324) { 203 TEST(AssemblerIa324) {
204 InitializeVM(); 204 InitializeVM();
205 v8::HandleScope scope; 205 v8::HandleScope scope;
206 206
207 v8::internal::byte buffer[256]; 207 v8::internal::byte buffer[256];
208 Assembler assm(buffer, sizeof buffer); 208 Assembler assm(buffer, sizeof buffer);
209 209
210 CHECK(CpuFeatures::IsSupported(CpuFeatures::SSE2)); 210 CHECK(CpuFeatures::IsSupported(SSE2));
211 CpuFeatures::Scope fscope(CpuFeatures::SSE2); 211 CpuFeatures::Scope fscope(SSE2);
212 __ cvttsd2si(eax, Operand(esp, 4)); 212 __ cvttsd2si(eax, Operand(esp, 4));
213 __ ret(0); 213 __ ret(0);
214 214
215 CodeDesc desc; 215 CodeDesc desc;
216 assm.GetCode(&desc); 216 assm.GetCode(&desc);
217 Code* code = 217 Code* code =
218 Code::cast(Heap::CreateCode(desc, 218 Code::cast(Heap::CreateCode(desc,
219 NULL, 219 NULL,
220 Code::ComputeFlags(Code::STUB), 220 Code::ComputeFlags(Code::STUB),
221 Handle<Object>(Heap::undefined_value()))); 221 Handle<Object>(Heap::undefined_value())));
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 int res = f(); 253 int res = f();
254 CHECK_EQ(42, res); 254 CHECK_EQ(42, res);
255 } 255 }
256 256
257 257
258 typedef double (*F5)(double x, double y); 258 typedef double (*F5)(double x, double y);
259 259
260 TEST(AssemblerIa326) { 260 TEST(AssemblerIa326) {
261 InitializeVM(); 261 InitializeVM();
262 v8::HandleScope scope; 262 v8::HandleScope scope;
263 CHECK(CpuFeatures::IsSupported(CpuFeatures::SSE2)); 263 CHECK(CpuFeatures::IsSupported(SSE2));
264 CpuFeatures::Scope fscope(CpuFeatures::SSE2); 264 CpuFeatures::Scope fscope(SSE2);
265 v8::internal::byte buffer[256]; 265 v8::internal::byte buffer[256];
266 Assembler assm(buffer, sizeof buffer); 266 Assembler assm(buffer, sizeof buffer);
267 267
268 __ movdbl(xmm0, Operand(esp, 1 * kPointerSize)); 268 __ movdbl(xmm0, Operand(esp, 1 * kPointerSize));
269 __ movdbl(xmm1, Operand(esp, 3 * kPointerSize)); 269 __ movdbl(xmm1, Operand(esp, 3 * kPointerSize));
270 __ addsd(xmm0, xmm1); 270 __ addsd(xmm0, xmm1);
271 __ mulsd(xmm0, xmm1); 271 __ mulsd(xmm0, xmm1);
272 __ subsd(xmm0, xmm1); 272 __ subsd(xmm0, xmm1);
273 __ divsd(xmm0, xmm1); 273 __ divsd(xmm0, xmm1);
274 // Copy xmm0 to st(0) using eight bytes of stack. 274 // Copy xmm0 to st(0) using eight bytes of stack.
(...skipping 23 matching lines...) Expand all
298 ::printf("f() = %f\n", res); 298 ::printf("f() = %f\n", res);
299 CHECK(2.29 < res && res < 2.31); 299 CHECK(2.29 < res && res < 2.31);
300 } 300 }
301 301
302 302
303 typedef double (*F6)(int x); 303 typedef double (*F6)(int x);
304 304
305 TEST(AssemblerIa328) { 305 TEST(AssemblerIa328) {
306 InitializeVM(); 306 InitializeVM();
307 v8::HandleScope scope; 307 v8::HandleScope scope;
308 CHECK(CpuFeatures::IsSupported(CpuFeatures::SSE2)); 308 CHECK(CpuFeatures::IsSupported(SSE2));
309 CpuFeatures::Scope fscope(CpuFeatures::SSE2); 309 CpuFeatures::Scope fscope(SSE2);
310 v8::internal::byte buffer[256]; 310 v8::internal::byte buffer[256];
311 Assembler assm(buffer, sizeof buffer); 311 Assembler assm(buffer, sizeof buffer);
312 __ mov(eax, Operand(esp, 4)); 312 __ mov(eax, Operand(esp, 4));
313 __ cvtsi2sd(xmm0, Operand(eax)); 313 __ cvtsi2sd(xmm0, Operand(eax));
314 // Copy xmm0 to st(0) using eight bytes of stack. 314 // Copy xmm0 to st(0) using eight bytes of stack.
315 __ sub(Operand(esp), Immediate(8)); 315 __ sub(Operand(esp), Immediate(8));
316 __ movdbl(Operand(esp, 0), xmm0); 316 __ movdbl(Operand(esp, 0), xmm0);
317 __ fld_d(Operand(esp, 0)); 317 __ fld_d(Operand(esp, 0));
318 __ add(Operand(esp), Immediate(8)); 318 __ add(Operand(esp), Immediate(8));
319 __ ret(0); 319 __ ret(0);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 #endif 386 #endif
387 387
388 F7 f = FUNCTION_CAST<F7>(Code::cast(code)->entry()); 388 F7 f = FUNCTION_CAST<F7>(Code::cast(code)->entry());
389 CHECK_EQ(kLess, f(1.1, 2.2)); 389 CHECK_EQ(kLess, f(1.1, 2.2));
390 CHECK_EQ(kEqual, f(2.2, 2.2)); 390 CHECK_EQ(kEqual, f(2.2, 2.2));
391 CHECK_EQ(kGreater, f(3.3, 2.2)); 391 CHECK_EQ(kGreater, f(3.3, 2.2));
392 CHECK_EQ(kNaN, f(OS::nan_value(), 1.1)); 392 CHECK_EQ(kNaN, f(OS::nan_value(), 1.1));
393 } 393 }
394 394
395 #undef __ 395 #undef __
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698