Mercurial > hg > CbC > CbC_gcc
comparison gcc/config/rs6000/ppu_intrinsics.h @ 55:77e2b8dfacca gcc-4.4.5
update it from 4.4.3 to 4.5.0
author | ryoma <e075725@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 12 Feb 2010 23:39:51 +0900 |
parents | a06113de4d67 |
children | 04ced10e8804 |
comparison
equal
deleted
inserted
replaced
52:c156f1bd5cd9 | 55:77e2b8dfacca |
---|---|
383 ((result & 0x20000000) >> 29); }) | 383 ((result & 0x20000000) >> 29); }) |
384 #endif /* __powerpc64__ */ | 384 #endif /* __powerpc64__ */ |
385 | 385 |
386 #define __mffs() __extension__ \ | 386 #define __mffs() __extension__ \ |
387 ({double result; \ | 387 ({double result; \ |
388 __asm__ volatile ("mffs %0" : "=f" (result)); \ | 388 __asm__ volatile ("mffs %0" : "=d" (result)); \ |
389 result; }) | 389 result; }) |
390 | 390 |
391 #define __mtfsf(mask,value) \ | 391 #define __mtfsf(mask,value) \ |
392 __asm__ volatile ("mtfsf %0,%1" : : "n" (mask), "f" ((double) (value))) | 392 __asm__ volatile ("mtfsf %0,%1" : : "n" (mask), "d" ((double) (value))) |
393 | 393 |
394 #define __mtfsfi(bits,field) \ | 394 #define __mtfsfi(bits,field) \ |
395 __asm__ volatile ("mtfsfi %0,%1" : : "n" (bits), "n" (field)) | 395 __asm__ volatile ("mtfsfi %0,%1" : : "n" (bits), "n" (field)) |
396 | 396 |
397 #define __mtfsb0(bit) __asm__ volatile ("mtfsb0 %0" : : "n" (bit)) | 397 #define __mtfsb0(bit) __asm__ volatile ("mtfsb0 %0" : : "n" (bit)) |
398 #define __mtfsb1(bit) __asm__ volatile ("mtfsb1 %0" : : "n" (bit)) | 398 #define __mtfsb1(bit) __asm__ volatile ("mtfsb1 %0" : : "n" (bit)) |
399 | 399 |
400 #define __setflm(v) __extension__ \ | 400 #define __setflm(v) __extension__ \ |
401 ({double result; \ | 401 ({double result; \ |
402 __asm__ volatile ("mffs %0\n\tmtfsf 255,%1" \ | 402 __asm__ volatile ("mffs %0\n\tmtfsf 255,%1" \ |
403 : "=&f" (result) \ | 403 : "=&d" (result) \ |
404 : "f" ((double) (v))); \ | 404 : "d" ((double) (v))); \ |
405 result; }) | 405 result; }) |
406 | 406 |
407 /* __builtin_fabs may perform unnecessary rounding. */ | 407 /* __builtin_fabs may perform unnecessary rounding. */ |
408 | 408 |
409 /* Rename __fabs and __fabsf to work around internal prototypes defined | 409 /* Rename __fabs and __fabsf to work around internal prototypes defined |
414 static __inline__ double __fabs(double x) __attribute__((always_inline)); | 414 static __inline__ double __fabs(double x) __attribute__((always_inline)); |
415 static __inline__ double | 415 static __inline__ double |
416 __fabs(double x) | 416 __fabs(double x) |
417 { | 417 { |
418 double r; | 418 double r; |
419 __asm__("fabs %0,%1" : "=d"(r) : "d"(x)); | |
420 return r; | |
421 } | |
422 | |
423 static __inline__ float __fabsf(float x) __attribute__((always_inline)); | |
424 static __inline__ float | |
425 __fabsf(float x) | |
426 { | |
427 float r; | |
419 __asm__("fabs %0,%1" : "=f"(r) : "f"(x)); | 428 __asm__("fabs %0,%1" : "=f"(r) : "f"(x)); |
420 return r; | 429 return r; |
421 } | 430 } |
422 | 431 |
423 static __inline__ float __fabsf(float x) __attribute__((always_inline)); | |
424 static __inline__ float | |
425 __fabsf(float x) | |
426 { | |
427 float r; | |
428 __asm__("fabs %0,%1" : "=f"(r) : "f"(x)); | |
429 return r; | |
430 } | |
431 | |
432 static __inline__ double __fnabs(double x) __attribute__((always_inline)); | 432 static __inline__ double __fnabs(double x) __attribute__((always_inline)); |
433 static __inline__ double | 433 static __inline__ double |
434 __fnabs(double x) | 434 __fnabs(double x) |
435 { | 435 { |
436 double r; | 436 double r; |
437 __asm__("fnabs %0,%1" : "=d"(r) : "d"(x)); | |
438 return r; | |
439 } | |
440 | |
441 static __inline__ float __fnabsf(float x) __attribute__((always_inline)); | |
442 static __inline__ float | |
443 __fnabsf(float x) | |
444 { | |
445 float r; | |
437 __asm__("fnabs %0,%1" : "=f"(r) : "f"(x)); | 446 __asm__("fnabs %0,%1" : "=f"(r) : "f"(x)); |
438 return r; | 447 return r; |
439 } | 448 } |
440 | 449 |
441 static __inline__ float __fnabsf(float x) __attribute__((always_inline)); | |
442 static __inline__ float | |
443 __fnabsf(float x) | |
444 { | |
445 float r; | |
446 __asm__("fnabs %0,%1" : "=f"(r) : "f"(x)); | |
447 return r; | |
448 } | |
449 | |
450 static __inline__ double __fmadd(double x, double y, double z) | 450 static __inline__ double __fmadd(double x, double y, double z) |
451 __attribute__((always_inline)); | 451 __attribute__((always_inline)); |
452 static __inline__ double | 452 static __inline__ double |
453 __fmadd(double x, double y, double z) | 453 __fmadd(double x, double y, double z) |
454 { | 454 { |
455 double r; | 455 double r; |
456 __asm__("fmadd %0,%1,%2,%3" : "=f"(r) : "f"(x),"f"(y),"f"(z)); | 456 __asm__("fmadd %0,%1,%2,%3" : "=d"(r) : "d"(x),"d"(y),"d"(z)); |
457 return r; | 457 return r; |
458 } | 458 } |
459 | 459 |
460 static __inline__ double __fmsub(double x, double y, double z) | 460 static __inline__ double __fmsub(double x, double y, double z) |
461 __attribute__((always_inline)); | 461 __attribute__((always_inline)); |
462 static __inline__ double | 462 static __inline__ double |
463 __fmsub(double x, double y, double z) | 463 __fmsub(double x, double y, double z) |
464 { | 464 { |
465 double r; | 465 double r; |
466 __asm__("fmsub %0,%1,%2,%3" : "=f"(r) : "f"(x),"f"(y),"f"(z)); | 466 __asm__("fmsub %0,%1,%2,%3" : "=d"(r) : "d"(x),"d"(y),"d"(z)); |
467 return r; | 467 return r; |
468 } | 468 } |
469 | 469 |
470 static __inline__ double __fnmadd(double x, double y, double z) | 470 static __inline__ double __fnmadd(double x, double y, double z) |
471 __attribute__((always_inline)); | 471 __attribute__((always_inline)); |
472 static __inline__ double | 472 static __inline__ double |
473 __fnmadd(double x, double y, double z) | 473 __fnmadd(double x, double y, double z) |
474 { | 474 { |
475 double r; | 475 double r; |
476 __asm__("fnmadd %0,%1,%2,%3" : "=f"(r) : "f"(x),"f"(y),"f"(z)); | 476 __asm__("fnmadd %0,%1,%2,%3" : "=d"(r) : "d"(x),"d"(y),"d"(z)); |
477 return r; | 477 return r; |
478 } | 478 } |
479 | 479 |
480 static __inline__ double __fnmsub(double x, double y, double z) | 480 static __inline__ double __fnmsub(double x, double y, double z) |
481 __attribute__((always_inline)); | 481 __attribute__((always_inline)); |
482 static __inline__ double | 482 static __inline__ double |
483 __fnmsub(double x, double y, double z) | 483 __fnmsub(double x, double y, double z) |
484 { | 484 { |
485 double r; | 485 double r; |
486 __asm__("fnmsub %0,%1,%2,%3" : "=f"(r) : "f"(x),"f"(y),"f"(z)); | 486 __asm__("fnmsub %0,%1,%2,%3" : "=d"(r) : "d"(x),"d"(y),"d"(z)); |
487 return r; | 487 return r; |
488 } | 488 } |
489 | 489 |
490 static __inline__ float __fmadds(float x, float y, float z) | 490 static __inline__ float __fmadds(float x, float y, float z) |
491 __attribute__((always_inline)); | 491 __attribute__((always_inline)); |
531 __attribute__((always_inline)); | 531 __attribute__((always_inline)); |
532 static __inline__ double | 532 static __inline__ double |
533 __fsel(double x, double y, double z) | 533 __fsel(double x, double y, double z) |
534 { | 534 { |
535 double r; | 535 double r; |
536 __asm__("fsel %0,%1,%2,%3" : "=d"(r) : "d"(x),"d"(y),"d"(z)); | |
537 return r; | |
538 } | |
539 | |
540 static __inline__ float __fsels(float x, float y, float z) | |
541 __attribute__((always_inline)); | |
542 static __inline__ float | |
543 __fsels(float x, float y, float z) | |
544 { | |
545 float r; | |
536 __asm__("fsel %0,%1,%2,%3" : "=f"(r) : "f"(x),"f"(y),"f"(z)); | 546 __asm__("fsel %0,%1,%2,%3" : "=f"(r) : "f"(x),"f"(y),"f"(z)); |
537 return r; | 547 return r; |
538 } | 548 } |
539 | 549 |
540 static __inline__ float __fsels(float x, float y, float z) | |
541 __attribute__((always_inline)); | |
542 static __inline__ float | |
543 __fsels(float x, float y, float z) | |
544 { | |
545 float r; | |
546 __asm__("fsel %0,%1,%2,%3" : "=f"(r) : "f"(x),"f"(y),"f"(z)); | |
547 return r; | |
548 } | |
549 | |
550 static __inline__ double __frsqrte(double x) __attribute__((always_inline)); | 550 static __inline__ double __frsqrte(double x) __attribute__((always_inline)); |
551 static __inline__ double | 551 static __inline__ double |
552 __frsqrte(double x) | 552 __frsqrte(double x) |
553 { | 553 { |
554 double r; | 554 double r; |
555 __asm__("frsqrte %0,%1" : "=f" (r) : "f" (x)); | 555 __asm__("frsqrte %0,%1" : "=d" (r) : "d" (x)); |
556 return r; | 556 return r; |
557 } | 557 } |
558 | 558 |
559 static __inline__ float __fres(float x) __attribute__((always_inline)); | 559 static __inline__ float __fres(float x) __attribute__((always_inline)); |
560 static __inline__ float | 560 static __inline__ float |
568 static __inline__ double __fsqrt(double x) __attribute__((always_inline)); | 568 static __inline__ double __fsqrt(double x) __attribute__((always_inline)); |
569 static __inline__ double | 569 static __inline__ double |
570 __fsqrt(double x) | 570 __fsqrt(double x) |
571 { | 571 { |
572 double r; | 572 double r; |
573 __asm__("fsqrt %0,%1" : "=f"(r) : "f"(x)); | 573 __asm__("fsqrt %0,%1" : "=d"(r) : "d"(x)); |
574 return r; | 574 return r; |
575 } | 575 } |
576 | 576 |
577 static __inline__ float __fsqrts(float x) __attribute__((always_inline)); | 577 static __inline__ float __fsqrts(float x) __attribute__((always_inline)); |
578 static __inline__ float | 578 static __inline__ float |
586 static __inline__ double __fmul (double a, double b) __attribute__ ((always_inline)); | 586 static __inline__ double __fmul (double a, double b) __attribute__ ((always_inline)); |
587 static __inline__ double | 587 static __inline__ double |
588 __fmul(double a, double b) | 588 __fmul(double a, double b) |
589 { | 589 { |
590 double d; | 590 double d; |
591 __asm__ ("fmul %0,%1,%2" : "=f" (d) : "f" (a), "f" (b)); | 591 __asm__ ("fmul %0,%1,%2" : "=d" (d) : "d" (a), "d" (b)); |
592 return d; | 592 return d; |
593 } | 593 } |
594 | 594 |
595 static __inline__ float __fmuls (float a, float b) __attribute__ ((always_inline)); | 595 static __inline__ float __fmuls (float a, float b) __attribute__ ((always_inline)); |
596 static __inline__ float | 596 static __inline__ float |
597 __fmuls (float a, float b) | 597 __fmuls (float a, float b) |
598 { | 598 { |
599 float d; | 599 float d; |
600 __asm__ ("fmuls %0,%1,%2" : "=f" (d) : "f" (a), "f" (b)); | 600 __asm__ ("fmuls %0,%1,%2" : "=d" (d) : "f" (a), "f" (b)); |
601 return d; | 601 return d; |
602 } | 602 } |
603 | 603 |
604 static __inline__ float __frsp (float a) __attribute__ ((always_inline)); | 604 static __inline__ float __frsp (float a) __attribute__ ((always_inline)); |
605 static __inline__ float | 605 static __inline__ float |
606 __frsp (float a) | 606 __frsp (float a) |
607 { | 607 { |
608 float d; | 608 float d; |
609 __asm__ ("frsp %0,%1" : "=f" (d) : "f" (a)); | 609 __asm__ ("frsp %0,%1" : "=d" (d) : "f" (a)); |
610 return d; | 610 return d; |
611 } | 611 } |
612 | 612 |
613 static __inline__ double __fcfid (long long a) __attribute__((always_inline)); | 613 static __inline__ double __fcfid (long long a) __attribute__((always_inline)); |
614 static __inline__ double | 614 static __inline__ double |
615 __fcfid (long long a) | 615 __fcfid (long long a) |
616 { | 616 { |
617 double d; | 617 double d; |
618 __asm__ ("fcfid %0,%1" : "=f" (d) : "f" (a)); | 618 __asm__ ("fcfid %0,%1" : "=d" (d) : "d" (a)); |
619 return d; | 619 return d; |
620 } | 620 } |
621 | 621 |
622 static __inline__ long long __fctid (double a) __attribute__ ((always_inline)); | 622 static __inline__ long long __fctid (double a) __attribute__ ((always_inline)); |
623 static __inline__ long long | 623 static __inline__ long long |
624 __fctid (double a) | 624 __fctid (double a) |
625 { | 625 { |
626 long long d; | 626 long long d; |
627 __asm__ ("fctid %0,%1" : "=f" (d) : "f" (a)); | 627 __asm__ ("fctid %0,%1" : "=d" (d) : "d" (a)); |
628 return d; | 628 return d; |
629 } | 629 } |
630 | 630 |
631 static __inline__ long long __fctidz (double a) __attribute__ ((always_inline)); | 631 static __inline__ long long __fctidz (double a) __attribute__ ((always_inline)); |
632 static __inline__ long long | 632 static __inline__ long long |
633 __fctidz (double a) | 633 __fctidz (double a) |
634 { | 634 { |
635 long long d; | 635 long long d; |
636 __asm__ ("fctidz %0,%1" : "=f" (d) : "f" (a)); | 636 __asm__ ("fctidz %0,%1" : "=d" (d) : "d" (a)); |
637 return d; | 637 return d; |
638 } | 638 } |
639 | 639 |
640 static __inline__ int __fctiw (double a) __attribute__ ((always_inline)); | 640 static __inline__ int __fctiw (double a) __attribute__ ((always_inline)); |
641 static __inline__ int | 641 static __inline__ int |
642 __fctiw (double a) | 642 __fctiw (double a) |
643 { | 643 { |
644 unsigned long long d; | 644 unsigned long long d; |
645 __asm__ ("fctiw %0,%1" : "=f" (d) : "f" (a)); | 645 __asm__ ("fctiw %0,%1" : "=d" (d) : "d" (a)); |
646 return (int) d; | 646 return (int) d; |
647 } | 647 } |
648 | 648 |
649 static __inline__ int __fctiwz (double a) __attribute__ ((always_inline)); | 649 static __inline__ int __fctiwz (double a) __attribute__ ((always_inline)); |
650 static __inline__ int | 650 static __inline__ int |
651 __fctiwz (double a) | 651 __fctiwz (double a) |
652 { | 652 { |
653 long long d; | 653 long long d; |
654 __asm__ ("fctiwz %0,%1" : "=f" (d) : "f" (a)); | 654 __asm__ ("fctiwz %0,%1" : "=d" (d) : "d" (a)); |
655 return (int) d; | 655 return (int) d; |
656 } | 656 } |
657 | 657 |
658 #ifdef __powerpc64__ | 658 #ifdef __powerpc64__ |
659 #define __rldcl(a,b,mb) __extension__ \ | 659 #define __rldcl(a,b,mb) __extension__ \ |