Revision cc4ba6a9 target-sh4/op_helper.c
b/target-sh4/op_helper.c | ||
---|---|---|
366 | 366 |
return arg1; |
367 | 367 |
} |
368 | 368 |
|
369 |
static inline void set_t(void) |
|
370 |
{ |
|
371 |
env->sr |= SR_T; |
|
372 |
} |
|
373 |
|
|
374 |
static inline void clr_t(void) |
|
375 |
{ |
|
376 |
env->sr &= ~SR_T; |
|
377 |
} |
|
378 |
|
|
369 | 379 |
void helper_ld_fpscr(uint32_t val) |
370 | 380 |
{ |
371 | 381 |
env->fpscr = val & 0x003fffff; |
... | ... | |
374 | 384 |
else |
375 | 385 |
set_float_rounding_mode(float_round_nearest_even, &env->fp_status); |
376 | 386 |
} |
387 |
|
|
388 |
uint32_t helper_fabs_FT(uint32_t t0) |
|
389 |
{ |
|
390 |
float32 ret = float32_abs(*(float32*)&t0); |
|
391 |
return *(uint32_t*)(&ret); |
|
392 |
} |
|
393 |
|
|
394 |
uint64_t helper_fabs_DT(uint64_t t0) |
|
395 |
{ |
|
396 |
float64 ret = float64_abs(*(float64*)&t0); |
|
397 |
return *(uint64_t*)(&ret); |
|
398 |
} |
|
399 |
|
|
400 |
uint32_t helper_fadd_FT(uint32_t t0, uint32_t t1) |
|
401 |
{ |
|
402 |
float32 ret = float32_add(*(float32*)&t0, *(float32*)&t1, &env->fp_status); |
|
403 |
return *(uint32_t*)(&ret); |
|
404 |
} |
|
405 |
|
|
406 |
uint64_t helper_fadd_DT(uint64_t t0, uint64_t t1) |
|
407 |
{ |
|
408 |
float64 ret = float64_add(*(float64*)&t0, *(float64*)&t1, &env->fp_status); |
|
409 |
return *(uint64_t*)(&ret); |
|
410 |
} |
|
411 |
|
|
412 |
void helper_fcmp_eq_FT(uint32_t t0, uint32_t t1) |
|
413 |
{ |
|
414 |
if (float32_compare(*(float32*)&t0, *(float32*)&t1, &env->fp_status) == 0) |
|
415 |
set_t(); |
|
416 |
else |
|
417 |
clr_t(); |
|
418 |
} |
|
419 |
|
|
420 |
void helper_fcmp_eq_DT(uint64_t t0, uint64_t t1) |
|
421 |
{ |
|
422 |
if (float64_compare(*(float64*)&t0, *(float64*)&t1, &env->fp_status) == 0) |
|
423 |
set_t(); |
|
424 |
else |
|
425 |
clr_t(); |
|
426 |
} |
|
427 |
|
|
428 |
void helper_fcmp_gt_FT(uint32_t t0, uint32_t t1) |
|
429 |
{ |
|
430 |
if (float32_compare(*(float32*)&t0, *(float32*)&t1, &env->fp_status) == 1) |
|
431 |
set_t(); |
|
432 |
else |
|
433 |
clr_t(); |
|
434 |
} |
|
435 |
|
|
436 |
void helper_fcmp_gt_DT(uint64_t t0, uint64_t t1) |
|
437 |
{ |
|
438 |
if (float64_compare(*(float64*)&t0, *(float64*)&t1, &env->fp_status) == 1) |
|
439 |
set_t(); |
|
440 |
else |
|
441 |
clr_t(); |
|
442 |
} |
|
443 |
|
|
444 |
uint64_t helper_fcnvsd_FT_DT(uint32_t t0) |
|
445 |
{ |
|
446 |
float64 ret = float32_to_float64(*(float32*)&t0, &env->fp_status); |
|
447 |
return *(uint64_t*)(&ret); |
|
448 |
} |
|
449 |
|
|
450 |
uint32_t helper_fcnvds_DT_FT(uint64_t t0) |
|
451 |
{ |
|
452 |
float32 ret = float64_to_float32(*(float64*)&t0, &env->fp_status); |
|
453 |
return *(uint32_t*)(&ret); |
|
454 |
} |
|
455 |
|
|
456 |
uint32_t helper_fdiv_FT(uint32_t t0, uint32_t t1) |
|
457 |
{ |
|
458 |
float32 ret = float32_div(*(float32*)&t0, *(float32*)&t1, &env->fp_status); |
|
459 |
return *(uint32_t*)(&ret); |
|
460 |
} |
|
461 |
|
|
462 |
uint64_t helper_fdiv_DT(uint64_t t0, uint64_t t1) |
|
463 |
{ |
|
464 |
float64 ret = float64_div(*(float64*)&t0, *(float64*)&t1, &env->fp_status); |
|
465 |
return *(uint64_t*)(&ret); |
|
466 |
} |
|
467 |
|
|
468 |
uint32_t helper_float_FT(uint32_t t0) |
|
469 |
{ |
|
470 |
float32 ret = int32_to_float32(t0, &env->fp_status); |
|
471 |
return *(uint32_t*)(&ret); |
|
472 |
} |
|
473 |
|
|
474 |
uint64_t helper_float_DT(uint32_t t0) |
|
475 |
{ |
|
476 |
float64 ret = int32_to_float64(t0, &env->fp_status); |
|
477 |
return *(uint64_t*)(&ret); |
|
478 |
} |
|
479 |
|
|
480 |
uint32_t helper_fmul_FT(uint32_t t0, uint32_t t1) |
|
481 |
{ |
|
482 |
float32 ret = float32_mul(*(float32*)&t0, *(float32*)&t1, &env->fp_status); |
|
483 |
return *(uint32_t*)(&ret); |
|
484 |
} |
|
485 |
|
|
486 |
uint64_t helper_fmul_DT(uint64_t t0, uint64_t t1) |
|
487 |
{ |
|
488 |
float64 ret = float64_mul(*(float64*)&t0, *(float64*)&t1, &env->fp_status); |
|
489 |
return *(uint64_t*)(&ret); |
|
490 |
} |
|
491 |
|
|
492 |
uint32_t helper_fsqrt_FT(uint32_t t0) |
|
493 |
{ |
|
494 |
float32 ret = float32_sqrt(*(float32*)&t0, &env->fp_status); |
|
495 |
return *(uint32_t*)(&ret); |
|
496 |
} |
|
497 |
|
|
498 |
uint64_t helper_fsqrt_DT(uint64_t t0) |
|
499 |
{ |
|
500 |
float64 ret = float64_sqrt(*(float64*)&t0, &env->fp_status); |
|
501 |
return *(uint64_t*)(&ret); |
|
502 |
} |
|
503 |
|
|
504 |
uint32_t helper_fsub_FT(uint32_t t0, uint32_t t1) |
|
505 |
{ |
|
506 |
float32 ret = float32_sub(*(float32*)&t0, *(float32*)&t1, &env->fp_status); |
|
507 |
return *(uint32_t*)(&ret); |
|
508 |
} |
|
509 |
|
|
510 |
uint64_t helper_fsub_DT(uint64_t t0, uint64_t t1) |
|
511 |
{ |
|
512 |
float64 ret = float64_sub(*(float64*)&t0, *(float64*)&t1, &env->fp_status); |
|
513 |
return *(uint64_t*)(&ret); |
|
514 |
} |
|
515 |
|
|
516 |
uint32_t helper_ftrc_FT(uint32_t t0) |
|
517 |
{ |
|
518 |
return float32_to_int32_round_to_zero(*(float32*)&t0, &env->fp_status); |
|
519 |
} |
|
520 |
|
|
521 |
uint32_t helper_ftrc_DT(uint64_t t0) |
|
522 |
{ |
|
523 |
return float64_to_int32_round_to_zero(*(float64*)&t0, &env->fp_status); |
|
524 |
} |
Also available in: Unified diff