| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 Loading... |
| 222 InitializeVM(); | 222 InitializeVM(); |
| 223 v8::HandleScope scope; | 223 v8::HandleScope scope; |
| 224 | 224 |
| 225 typedef struct { | 225 typedef struct { |
| 226 double a; | 226 double a; |
| 227 double b; | 227 double b; |
| 228 double c; | 228 double c; |
| 229 double d; | 229 double d; |
| 230 double e; | 230 double e; |
| 231 double f; | 231 double f; |
| 232 double g; |
| 233 double h; |
| 232 int i; | 234 int i; |
| 233 float x; | 235 float x; |
| 234 float y; | 236 float y; |
| 235 } T; | 237 } T; |
| 236 T t; | 238 T t; |
| 237 | 239 |
| 238 // Create a function that accepts &t, and loads, manipulates, and stores | 240 // Create a function that accepts &t, and loads, manipulates, and stores |
| 239 // the doubles and floats. | 241 // the doubles and floats. |
| 240 Assembler assm(NULL, 0); | 242 Assembler assm(NULL, 0); |
| 241 Label L, C; | 243 Label L, C; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 // Convert from floating point to integer. | 281 // Convert from floating point to integer. |
| 280 __ vmov(d4, 2.0); | 282 __ vmov(d4, 2.0); |
| 281 __ vcvt_s32_f64(s31, d4); | 283 __ vcvt_s32_f64(s31, d4); |
| 282 __ vstr(s31, r4, OFFSET_OF(T, i)); | 284 __ vstr(s31, r4, OFFSET_OF(T, i)); |
| 283 | 285 |
| 284 // Convert from integer to floating point. | 286 // Convert from integer to floating point. |
| 285 __ mov(lr, Operand(42)); | 287 __ mov(lr, Operand(42)); |
| 286 __ vmov(s31, lr); | 288 __ vmov(s31, lr); |
| 287 __ vcvt_f64_s32(d4, s31); | 289 __ vcvt_f64_s32(d4, s31); |
| 288 __ vstr(d4, r4, OFFSET_OF(T, f)); | 290 __ vstr(d4, r4, OFFSET_OF(T, f)); |
| 291 |
| 292 // Test vabs. |
| 293 __ vldr(d1, r4, OFFSET_OF(T, g)); |
| 294 __ vabs(d0, d1); |
| 295 __ vstr(d0, r4, OFFSET_OF(T, g)); |
| 296 __ vldr(d2, r4, OFFSET_OF(T, h)); |
| 297 __ vabs(d0, d2); |
| 298 __ vstr(d0, r4, OFFSET_OF(T, h)); |
| 299 |
| 289 __ ldm(ia_w, sp, r4.bit() | fp.bit() | pc.bit()); | 300 __ ldm(ia_w, sp, r4.bit() | fp.bit() | pc.bit()); |
| 290 | 301 |
| 291 CodeDesc desc; | 302 CodeDesc desc; |
| 292 assm.GetCode(&desc); | 303 assm.GetCode(&desc); |
| 293 Object* code = Heap::CreateCode( | 304 Object* code = Heap::CreateCode( |
| 294 desc, | 305 desc, |
| 295 Code::ComputeFlags(Code::STUB), | 306 Code::ComputeFlags(Code::STUB), |
| 296 Handle<Object>(Heap::undefined_value()))->ToObjectChecked(); | 307 Handle<Object>(Heap::undefined_value()))->ToObjectChecked(); |
| 297 CHECK(code->IsCode()); | 308 CHECK(code->IsCode()); |
| 298 #ifdef DEBUG | 309 #ifdef DEBUG |
| 299 Code::cast(code)->Print(); | 310 Code::cast(code)->Print(); |
| 300 #endif | 311 #endif |
| 301 F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry()); | 312 F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry()); |
| 302 t.a = 1.5; | 313 t.a = 1.5; |
| 303 t.b = 2.75; | 314 t.b = 2.75; |
| 304 t.c = 17.17; | 315 t.c = 17.17; |
| 305 t.d = 0.0; | 316 t.d = 0.0; |
| 306 t.e = 0.0; | 317 t.e = 0.0; |
| 307 t.f = 0.0; | 318 t.f = 0.0; |
| 319 t.g = -2718.2818; |
| 320 t.h = 31415926.5; |
| 308 t.i = 0; | 321 t.i = 0; |
| 309 t.x = 4.5; | 322 t.x = 4.5; |
| 310 t.y = 9.0; | 323 t.y = 9.0; |
| 311 Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0); | 324 Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0); |
| 312 USE(dummy); | 325 USE(dummy); |
| 313 CHECK_EQ(4.5, t.y); | 326 CHECK_EQ(4.5, t.y); |
| 314 CHECK_EQ(9.0, t.x); | 327 CHECK_EQ(9.0, t.x); |
| 315 CHECK_EQ(2, t.i); | 328 CHECK_EQ(2, t.i); |
| 329 CHECK_EQ(2718.2818, t.g); |
| 330 CHECK_EQ(31415926.5, t.h); |
| 316 CHECK_EQ(42.0, t.f); | 331 CHECK_EQ(42.0, t.f); |
| 317 CHECK_EQ(1.0, t.e); | 332 CHECK_EQ(1.0, t.e); |
| 318 CHECK_EQ(1.000000059604644775390625, t.d); | 333 CHECK_EQ(1.000000059604644775390625, t.d); |
| 319 CHECK_EQ(4.25, t.c); | 334 CHECK_EQ(4.25, t.c); |
| 320 CHECK_EQ(4.25, t.b); | 335 CHECK_EQ(4.25, t.b); |
| 321 CHECK_EQ(1.5, t.a); | 336 CHECK_EQ(1.5, t.a); |
| 322 } | 337 } |
| 323 } | 338 } |
| 324 | 339 |
| 325 | 340 |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 TestRoundingMode(RM, 0.5, 0); | 470 TestRoundingMode(RM, 0.5, 0); |
| 456 TestRoundingMode(RM, -0.5, -1); | 471 TestRoundingMode(RM, -0.5, -1); |
| 457 TestRoundingMode(RM, 123.7, 123); | 472 TestRoundingMode(RM, 123.7, 123); |
| 458 TestRoundingMode(RM, -123.7, -124); | 473 TestRoundingMode(RM, -123.7, -124); |
| 459 TestRoundingMode(RM, 123456.2, 123456); | 474 TestRoundingMode(RM, 123456.2, 123456); |
| 460 TestRoundingMode(RM, -123456.2, -123457); | 475 TestRoundingMode(RM, -123456.2, -123457); |
| 461 } | 476 } |
| 462 } | 477 } |
| 463 | 478 |
| 464 #undef __ | 479 #undef __ |
| OLD | NEW |