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

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

Issue 222403002: ARM: Avoid VMSR instruction when converting to clamped uint8 (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Created 6 years, 8 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 double a; 222 double a;
223 double b; 223 double b;
224 double c; 224 double c;
225 double d; 225 double d;
226 double e; 226 double e;
227 double f; 227 double f;
228 double g; 228 double g;
229 double h; 229 double h;
230 int i; 230 int i;
231 double j; 231 double j;
232 unsigned int k;
232 double m; 233 double m;
233 double n; 234 double n;
234 float x; 235 float x;
235 float y; 236 float y;
236 } T; 237 } T;
237 T t; 238 T t;
238 239
239 // Create a function that accepts &t, and loads, manipulates, and stores 240 // Create a function that accepts &t, and loads, manipulates, and stores
240 // the doubles and floats. 241 // the doubles and floats.
241 Assembler assm(isolate, NULL, 0); 242 Assembler assm(isolate, NULL, 0);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 __ vcvt_s32_f64(s31, d4); 286 __ vcvt_s32_f64(s31, d4);
286 __ vstr(s31, r4, OFFSET_OF(T, i)); 287 __ vstr(s31, r4, OFFSET_OF(T, i));
287 288
288 // Convert from integer to floating point. 289 // Convert from integer to floating point.
289 __ mov(lr, Operand(42)); 290 __ mov(lr, Operand(42));
290 __ vmov(s31, lr); 291 __ vmov(s31, lr);
291 __ vcvt_f64_s32(d4, s31); 292 __ vcvt_f64_s32(d4, s31);
292 __ vstr(d4, r4, OFFSET_OF(T, f)); 293 __ vstr(d4, r4, OFFSET_OF(T, f));
293 294
294 // Convert from fixed point to floating point. 295 // Convert from fixed point to floating point.
295 __ mov(lr, Operand(1234)); 296 __ mov(lr, Operand(2468));
296 __ vmov(s8, lr); 297 __ vmov(s8, lr);
297 __ vcvt_f64_s32(d4, 1); 298 __ vcvt_f64_s32(d4, 2);
298 __ vstr(d4, r4, OFFSET_OF(T, j)); 299 __ vstr(d4, r4, OFFSET_OF(T, j));
299 300
301 // Convert from floating point to fixed point.
302 __ vmov(d4, 42.25);
303 __ vcvt_u32_f64(d4, 3);
304 __ vstr(d4, r4, OFFSET_OF(T, k));
305
300 // Test vabs. 306 // Test vabs.
301 __ vldr(d1, r4, OFFSET_OF(T, g)); 307 __ vldr(d1, r4, OFFSET_OF(T, g));
302 __ vabs(d0, d1); 308 __ vabs(d0, d1);
303 __ vstr(d0, r4, OFFSET_OF(T, g)); 309 __ vstr(d0, r4, OFFSET_OF(T, g));
304 __ vldr(d2, r4, OFFSET_OF(T, h)); 310 __ vldr(d2, r4, OFFSET_OF(T, h));
305 __ vabs(d0, d2); 311 __ vabs(d0, d2);
306 __ vstr(d0, r4, OFFSET_OF(T, h)); 312 __ vstr(d0, r4, OFFSET_OF(T, h));
307 313
308 // Test vneg. 314 // Test vneg.
309 __ vldr(d1, r4, OFFSET_OF(T, m)); 315 __ vldr(d1, r4, OFFSET_OF(T, m));
(...skipping 19 matching lines...) Expand all
329 t.a = 1.5; 335 t.a = 1.5;
330 t.b = 2.75; 336 t.b = 2.75;
331 t.c = 17.17; 337 t.c = 17.17;
332 t.d = 0.0; 338 t.d = 0.0;
333 t.e = 0.0; 339 t.e = 0.0;
334 t.f = 0.0; 340 t.f = 0.0;
335 t.g = -2718.2818; 341 t.g = -2718.2818;
336 t.h = 31415926.5; 342 t.h = 31415926.5;
337 t.i = 0; 343 t.i = 0;
338 t.j = 0; 344 t.j = 0;
345 t.k = 0;
339 t.m = -2718.2818; 346 t.m = -2718.2818;
340 t.n = 123.456; 347 t.n = 123.456;
341 t.x = 4.5; 348 t.x = 4.5;
342 t.y = 9.0; 349 t.y = 9.0;
343 Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0); 350 Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0);
344 USE(dummy); 351 USE(dummy);
345 CHECK_EQ(4.5, t.y); 352 CHECK_EQ(4.5, t.y);
346 CHECK_EQ(9.0, t.x); 353 CHECK_EQ(9.0, t.x);
347 CHECK_EQ(-123.456, t.n); 354 CHECK_EQ(-123.456, t.n);
348 CHECK_EQ(2718.2818, t.m); 355 CHECK_EQ(2718.2818, t.m);
349 CHECK_EQ(2, t.i); 356 CHECK_EQ(2, t.i);
350 CHECK_EQ(2718.2818, t.g); 357 CHECK_EQ(2718.2818, t.g);
351 CHECK_EQ(31415926.5, t.h); 358 CHECK_EQ(31415926.5, t.h);
352 CHECK_EQ(617.0, t.j); 359 CHECK_EQ(617.0, t.j);
360 CHECK_EQ(338, t.k);
353 CHECK_EQ(42.0, t.f); 361 CHECK_EQ(42.0, t.f);
354 CHECK_EQ(1.0, t.e); 362 CHECK_EQ(1.0, t.e);
355 CHECK_EQ(1.000000059604644775390625, t.d); 363 CHECK_EQ(1.000000059604644775390625, t.d);
356 CHECK_EQ(4.25, t.c); 364 CHECK_EQ(4.25, t.c);
357 CHECK_EQ(-4.1875, t.b); 365 CHECK_EQ(-4.1875, t.b);
358 CHECK_EQ(1.5, t.a); 366 CHECK_EQ(1.5, t.a);
359 } 367 }
360 } 368 }
361 369
362 370
(...skipping 1226 matching lines...) Expand 10 before | Expand all | Expand 10 after
1589 Handle<Code> code = isolate->factory()->NewCode(desc, 1597 Handle<Code> code = isolate->factory()->NewCode(desc,
1590 Code::ComputeFlags(Code::STUB), code_object); 1598 Code::ComputeFlags(Code::STUB), code_object);
1591 CHECK(code->IsCode()); 1599 CHECK(code->IsCode());
1592 F1 f = FUNCTION_CAST<F1>(code->entry()); 1600 F1 f = FUNCTION_CAST<F1>(code->entry());
1593 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 21, 0, 0, 0, 0)); 1601 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 21, 0, 0, 0, 0));
1594 ::printf("f() = %d\n", res); 1602 ::printf("f() = %d\n", res);
1595 CHECK_EQ(42, res); 1603 CHECK_EQ(42, res);
1596 } 1604 }
1597 1605
1598 #undef __ 1606 #undef __
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698