449 case NVPTX::BI__nvvm_mulhi_i:
450 case NVPTX::BI__nvvm_mulhi_ui:
451 case NVPTX::BI__nvvm_mulhi_ll:
452 case NVPTX::BI__nvvm_mulhi_ull:
453 return Builder.CreateBinaryIntrinsic(
457 case NVPTX::BI__nvvm_atom_add_gen_i:
458 case NVPTX::BI__nvvm_atom_add_gen_l:
459 case NVPTX::BI__nvvm_atom_add_gen_ll:
461 AtomicOrdering::Monotonic);
463 case NVPTX::BI__nvvm_atom_sub_gen_i:
464 case NVPTX::BI__nvvm_atom_sub_gen_l:
465 case NVPTX::BI__nvvm_atom_sub_gen_ll:
467 AtomicOrdering::Monotonic);
469 case NVPTX::BI__nvvm_atom_and_gen_i:
470 case NVPTX::BI__nvvm_atom_and_gen_l:
471 case NVPTX::BI__nvvm_atom_and_gen_ll:
473 AtomicOrdering::Monotonic);
475 case NVPTX::BI__nvvm_atom_or_gen_i:
476 case NVPTX::BI__nvvm_atom_or_gen_l:
477 case NVPTX::BI__nvvm_atom_or_gen_ll:
479 AtomicOrdering::Monotonic);
481 case NVPTX::BI__nvvm_atom_xor_gen_i:
482 case NVPTX::BI__nvvm_atom_xor_gen_l:
483 case NVPTX::BI__nvvm_atom_xor_gen_ll:
485 AtomicOrdering::Monotonic);
487 case NVPTX::BI__nvvm_atom_xchg_gen_i:
488 case NVPTX::BI__nvvm_atom_xchg_gen_l:
489 case NVPTX::BI__nvvm_atom_xchg_gen_ll:
491 AtomicOrdering::Monotonic);
493 case NVPTX::BI__nvvm_atom_max_gen_i:
494 case NVPTX::BI__nvvm_atom_max_gen_l:
495 case NVPTX::BI__nvvm_atom_max_gen_ll:
497 AtomicOrdering::Monotonic);
499 case NVPTX::BI__nvvm_atom_max_gen_ui:
500 case NVPTX::BI__nvvm_atom_max_gen_ul:
501 case NVPTX::BI__nvvm_atom_max_gen_ull:
503 AtomicOrdering::Monotonic);
505 case NVPTX::BI__nvvm_atom_min_gen_i:
506 case NVPTX::BI__nvvm_atom_min_gen_l:
507 case NVPTX::BI__nvvm_atom_min_gen_ll:
509 AtomicOrdering::Monotonic);
511 case NVPTX::BI__nvvm_atom_min_gen_ui:
512 case NVPTX::BI__nvvm_atom_min_gen_ul:
513 case NVPTX::BI__nvvm_atom_min_gen_ull:
515 AtomicOrdering::Monotonic);
517 case NVPTX::BI__nvvm_atom_cas_gen_us:
518 case NVPTX::BI__nvvm_atom_cas_gen_i:
519 case NVPTX::BI__nvvm_atom_cas_gen_l:
520 case NVPTX::BI__nvvm_atom_cas_gen_ll:
524 AtomicOrdering::Monotonic,
525 AtomicOrdering::Monotonic);
527 case NVPTX::BI__nvvm_atom_add_gen_f:
528 case NVPTX::BI__nvvm_atom_add_gen_d: {
532 return Builder.CreateAtomicRMW(llvm::AtomicRMWInst::FAdd, DestAddr, Val,
533 AtomicOrdering::Monotonic);
536 case NVPTX::BI__nvvm_atom_inc_gen_ui:
538 AtomicOrdering::Monotonic);
540 case NVPTX::BI__nvvm_atom_dec_gen_ui:
542 AtomicOrdering::Monotonic);
544 case NVPTX::BI__nvvm_ldg_c:
545 case NVPTX::BI__nvvm_ldg_sc:
546 case NVPTX::BI__nvvm_ldg_c2:
547 case NVPTX::BI__nvvm_ldg_sc2:
548 case NVPTX::BI__nvvm_ldg_c4:
549 case NVPTX::BI__nvvm_ldg_sc4:
550 case NVPTX::BI__nvvm_ldg_s:
551 case NVPTX::BI__nvvm_ldg_s2:
552 case NVPTX::BI__nvvm_ldg_s4:
553 case NVPTX::BI__nvvm_ldg_i:
554 case NVPTX::BI__nvvm_ldg_i2:
555 case NVPTX::BI__nvvm_ldg_i4:
556 case NVPTX::BI__nvvm_ldg_l:
557 case NVPTX::BI__nvvm_ldg_l2:
558 case NVPTX::BI__nvvm_ldg_ll:
559 case NVPTX::BI__nvvm_ldg_ll2:
560 case NVPTX::BI__nvvm_ldg_uc:
561 case NVPTX::BI__nvvm_ldg_uc2:
562 case NVPTX::BI__nvvm_ldg_uc4:
563 case NVPTX::BI__nvvm_ldg_us:
564 case NVPTX::BI__nvvm_ldg_us2:
565 case NVPTX::BI__nvvm_ldg_us4:
566 case NVPTX::BI__nvvm_ldg_ui:
567 case NVPTX::BI__nvvm_ldg_ui2:
568 case NVPTX::BI__nvvm_ldg_ui4:
569 case NVPTX::BI__nvvm_ldg_ul:
570 case NVPTX::BI__nvvm_ldg_ul2:
571 case NVPTX::BI__nvvm_ldg_ull:
572 case NVPTX::BI__nvvm_ldg_ull2:
573 case NVPTX::BI__nvvm_ldg_f:
574 case NVPTX::BI__nvvm_ldg_f2:
575 case NVPTX::BI__nvvm_ldg_f4:
576 case NVPTX::BI__nvvm_ldg_d:
577 case NVPTX::BI__nvvm_ldg_d2:
581 return MakeLdg(*
this, E);
583 case NVPTX::BI__nvvm_ldu_c:
584 case NVPTX::BI__nvvm_ldu_sc:
585 case NVPTX::BI__nvvm_ldu_c2:
586 case NVPTX::BI__nvvm_ldu_sc2:
587 case NVPTX::BI__nvvm_ldu_c4:
588 case NVPTX::BI__nvvm_ldu_sc4:
589 case NVPTX::BI__nvvm_ldu_s:
590 case NVPTX::BI__nvvm_ldu_s2:
591 case NVPTX::BI__nvvm_ldu_s4:
592 case NVPTX::BI__nvvm_ldu_i:
593 case NVPTX::BI__nvvm_ldu_i2:
594 case NVPTX::BI__nvvm_ldu_i4:
595 case NVPTX::BI__nvvm_ldu_l:
596 case NVPTX::BI__nvvm_ldu_l2:
597 case NVPTX::BI__nvvm_ldu_ll:
598 case NVPTX::BI__nvvm_ldu_ll2:
599 case NVPTX::BI__nvvm_ldu_uc:
600 case NVPTX::BI__nvvm_ldu_uc2:
601 case NVPTX::BI__nvvm_ldu_uc4:
602 case NVPTX::BI__nvvm_ldu_us:
603 case NVPTX::BI__nvvm_ldu_us2:
604 case NVPTX::BI__nvvm_ldu_us4:
605 case NVPTX::BI__nvvm_ldu_ui:
606 case NVPTX::BI__nvvm_ldu_ui2:
607 case NVPTX::BI__nvvm_ldu_ui4:
608 case NVPTX::BI__nvvm_ldu_ul:
609 case NVPTX::BI__nvvm_ldu_ul2:
610 case NVPTX::BI__nvvm_ldu_ull:
611 case NVPTX::BI__nvvm_ldu_ull2:
612 return MakeLdu(Intrinsic::nvvm_ldu_global_i, *
this, E);
613 case NVPTX::BI__nvvm_ldu_f:
614 case NVPTX::BI__nvvm_ldu_f2:
615 case NVPTX::BI__nvvm_ldu_f4:
616 case NVPTX::BI__nvvm_ldu_d:
617 case NVPTX::BI__nvvm_ldu_d2:
618 return MakeLdu(Intrinsic::nvvm_ldu_global_f, *
this, E);
620 case NVPTX::BI__nvvm_atom_cta_add_gen_i:
621 case NVPTX::BI__nvvm_atom_cta_add_gen_l:
622 case NVPTX::BI__nvvm_atom_cta_add_gen_ll:
623 return MakeScopedAtomicRMW(*
this, E, llvm::AtomicRMWInst::Add,
624 llvm::AtomicScope::Workgroup);
625 case NVPTX::BI__nvvm_atom_sys_add_gen_i:
626 case NVPTX::BI__nvvm_atom_sys_add_gen_l:
627 case NVPTX::BI__nvvm_atom_sys_add_gen_ll:
628 return MakeScopedAtomicRMW(*
this, E, llvm::AtomicRMWInst::Add,
629 llvm::AtomicScope::System);
630 case NVPTX::BI__nvvm_atom_cta_add_gen_f:
631 case NVPTX::BI__nvvm_atom_cta_add_gen_d:
632 return MakeScopedAtomicRMW(*
this, E, llvm::AtomicRMWInst::FAdd,
633 llvm::AtomicScope::Workgroup);
634 case NVPTX::BI__nvvm_atom_sys_add_gen_f:
635 case NVPTX::BI__nvvm_atom_sys_add_gen_d:
636 return MakeScopedAtomicRMW(*
this, E, llvm::AtomicRMWInst::FAdd,
637 llvm::AtomicScope::System);
638 case NVPTX::BI__nvvm_atom_cta_xchg_gen_i:
639 case NVPTX::BI__nvvm_atom_cta_xchg_gen_l:
640 case NVPTX::BI__nvvm_atom_cta_xchg_gen_ll:
641 return MakeScopedAtomicRMW(*
this, E, llvm::AtomicRMWInst::Xchg,
642 llvm::AtomicScope::Workgroup);
643 case NVPTX::BI__nvvm_atom_sys_xchg_gen_i:
644 case NVPTX::BI__nvvm_atom_sys_xchg_gen_l:
645 case NVPTX::BI__nvvm_atom_sys_xchg_gen_ll:
646 return MakeScopedAtomicRMW(*
this, E, llvm::AtomicRMWInst::Xchg,
647 llvm::AtomicScope::System);
648 case NVPTX::BI__nvvm_atom_cta_max_gen_i:
649 case NVPTX::BI__nvvm_atom_cta_max_gen_l:
650 case NVPTX::BI__nvvm_atom_cta_max_gen_ll:
651 return MakeScopedAtomicRMW(*
this, E, llvm::AtomicRMWInst::Max,
652 llvm::AtomicScope::Workgroup);
653 case NVPTX::BI__nvvm_atom_cta_max_gen_ui:
654 case NVPTX::BI__nvvm_atom_cta_max_gen_ul:
655 case NVPTX::BI__nvvm_atom_cta_max_gen_ull:
656 return MakeScopedAtomicRMW(*
this, E, llvm::AtomicRMWInst::UMax,
657 llvm::AtomicScope::Workgroup);
658 case NVPTX::BI__nvvm_atom_sys_max_gen_i:
659 case NVPTX::BI__nvvm_atom_sys_max_gen_l:
660 case NVPTX::BI__nvvm_atom_sys_max_gen_ll:
661 return MakeScopedAtomicRMW(*
this, E, llvm::AtomicRMWInst::Max,
662 llvm::AtomicScope::System);
663 case NVPTX::BI__nvvm_atom_sys_max_gen_ui:
664 case NVPTX::BI__nvvm_atom_sys_max_gen_ul:
665 case NVPTX::BI__nvvm_atom_sys_max_gen_ull:
666 return MakeScopedAtomicRMW(*
this, E, llvm::AtomicRMWInst::UMax,
667 llvm::AtomicScope::System);
668 case NVPTX::BI__nvvm_atom_cta_min_gen_i:
669 case NVPTX::BI__nvvm_atom_cta_min_gen_l:
670 case NVPTX::BI__nvvm_atom_cta_min_gen_ll:
671 return MakeScopedAtomicRMW(*
this, E, llvm::AtomicRMWInst::Min,
672 llvm::AtomicScope::Workgroup);
673 case NVPTX::BI__nvvm_atom_cta_min_gen_ui:
674 case NVPTX::BI__nvvm_atom_cta_min_gen_ul:
675 case NVPTX::BI__nvvm_atom_cta_min_gen_ull:
676 return MakeScopedAtomicRMW(*
this, E, llvm::AtomicRMWInst::UMin,
677 llvm::AtomicScope::Workgroup);
678 case NVPTX::BI__nvvm_atom_sys_min_gen_i:
679 case NVPTX::BI__nvvm_atom_sys_min_gen_l:
680 case NVPTX::BI__nvvm_atom_sys_min_gen_ll:
681 return MakeScopedAtomicRMW(*
this, E, llvm::AtomicRMWInst::Min,
682 llvm::AtomicScope::System);
683 case NVPTX::BI__nvvm_atom_sys_min_gen_ui:
684 case NVPTX::BI__nvvm_atom_sys_min_gen_ul:
685 case NVPTX::BI__nvvm_atom_sys_min_gen_ull:
686 return MakeScopedAtomicRMW(*
this, E, llvm::AtomicRMWInst::UMin,
687 llvm::AtomicScope::System);
688 case NVPTX::BI__nvvm_atom_cta_inc_gen_ui:
689 return MakeScopedAtomicRMW(*
this, E, llvm::AtomicRMWInst::UIncWrap,
690 llvm::AtomicScope::Workgroup);
691 case NVPTX::BI__nvvm_atom_cta_dec_gen_ui:
692 return MakeScopedAtomicRMW(*
this, E, llvm::AtomicRMWInst::UDecWrap,
693 llvm::AtomicScope::Workgroup);
694 case NVPTX::BI__nvvm_atom_sys_inc_gen_ui:
695 return MakeScopedAtomicRMW(*
this, E, llvm::AtomicRMWInst::UIncWrap,
696 llvm::AtomicScope::System);
697 case NVPTX::BI__nvvm_atom_sys_dec_gen_ui:
698 return MakeScopedAtomicRMW(*
this, E, llvm::AtomicRMWInst::UDecWrap,
699 llvm::AtomicScope::System);
700 case NVPTX::BI__nvvm_atom_cta_and_gen_i:
701 case NVPTX::BI__nvvm_atom_cta_and_gen_l:
702 case NVPTX::BI__nvvm_atom_cta_and_gen_ll:
703 return MakeScopedAtomicRMW(*
this, E, llvm::AtomicRMWInst::And,
704 llvm::AtomicScope::Workgroup);
705 case NVPTX::BI__nvvm_atom_sys_and_gen_i:
706 case NVPTX::BI__nvvm_atom_sys_and_gen_l:
707 case NVPTX::BI__nvvm_atom_sys_and_gen_ll:
708 return MakeScopedAtomicRMW(*
this, E, llvm::AtomicRMWInst::And,
709 llvm::AtomicScope::System);
710 case NVPTX::BI__nvvm_atom_cta_or_gen_i:
711 case NVPTX::BI__nvvm_atom_cta_or_gen_l:
712 case NVPTX::BI__nvvm_atom_cta_or_gen_ll:
713 return MakeScopedAtomicRMW(*
this, E, llvm::AtomicRMWInst::Or,
714 llvm::AtomicScope::Workgroup);
715 case NVPTX::BI__nvvm_atom_sys_or_gen_i:
716 case NVPTX::BI__nvvm_atom_sys_or_gen_l:
717 case NVPTX::BI__nvvm_atom_sys_or_gen_ll:
718 return MakeScopedAtomicRMW(*
this, E, llvm::AtomicRMWInst::Or,
719 llvm::AtomicScope::System);
720 case NVPTX::BI__nvvm_atom_cta_xor_gen_i:
721 case NVPTX::BI__nvvm_atom_cta_xor_gen_l:
722 case NVPTX::BI__nvvm_atom_cta_xor_gen_ll:
723 return MakeScopedAtomicRMW(*
this, E, llvm::AtomicRMWInst::Xor,
724 llvm::AtomicScope::Workgroup);
725 case NVPTX::BI__nvvm_atom_sys_xor_gen_i:
726 case NVPTX::BI__nvvm_atom_sys_xor_gen_l:
727 case NVPTX::BI__nvvm_atom_sys_xor_gen_ll:
728 return MakeScopedAtomicRMW(*
this, E, llvm::AtomicRMWInst::Xor,
729 llvm::AtomicScope::System);
730 case NVPTX::BI__nvvm_atom_cta_cas_gen_us:
731 case NVPTX::BI__nvvm_atom_cta_cas_gen_i:
732 case NVPTX::BI__nvvm_atom_cta_cas_gen_l:
733 case NVPTX::BI__nvvm_atom_cta_cas_gen_ll:
734 return MakeScopedAtomicCAS(*
this, E, llvm::AtomicScope::Workgroup);
735 case NVPTX::BI__nvvm_atom_sys_cas_gen_us:
736 case NVPTX::BI__nvvm_atom_sys_cas_gen_i:
737 case NVPTX::BI__nvvm_atom_sys_cas_gen_l:
738 case NVPTX::BI__nvvm_atom_sys_cas_gen_ll:
739 return MakeScopedAtomicCAS(*
this, E, llvm::AtomicScope::System);
740 case NVPTX::BI__nvvm_match_all_sync_i32p:
741 case NVPTX::BI__nvvm_match_all_sync_i64p: {
746 CGM.getIntrinsic(BuiltinID == NVPTX::BI__nvvm_match_all_sync_i32p
747 ? Intrinsic::nvvm_match_all_sync_i32p
748 : Intrinsic::nvvm_match_all_sync_i64p),
752 Builder.CreateStore(Pred, PredOutPtr);
753 return Builder.CreateExtractValue(ResultPair, 0);
757 case NVPTX::BI__hmma_m16n16k16_ld_a:
758 case NVPTX::BI__hmma_m16n16k16_ld_b:
759 case NVPTX::BI__hmma_m16n16k16_ld_c_f16:
760 case NVPTX::BI__hmma_m16n16k16_ld_c_f32:
761 case NVPTX::BI__hmma_m32n8k16_ld_a:
762 case NVPTX::BI__hmma_m32n8k16_ld_b:
763 case NVPTX::BI__hmma_m32n8k16_ld_c_f16:
764 case NVPTX::BI__hmma_m32n8k16_ld_c_f32:
765 case NVPTX::BI__hmma_m8n32k16_ld_a:
766 case NVPTX::BI__hmma_m8n32k16_ld_b:
767 case NVPTX::BI__hmma_m8n32k16_ld_c_f16:
768 case NVPTX::BI__hmma_m8n32k16_ld_c_f32:
770 case NVPTX::BI__imma_m16n16k16_ld_a_s8:
771 case NVPTX::BI__imma_m16n16k16_ld_a_u8:
772 case NVPTX::BI__imma_m16n16k16_ld_b_s8:
773 case NVPTX::BI__imma_m16n16k16_ld_b_u8:
774 case NVPTX::BI__imma_m16n16k16_ld_c:
775 case NVPTX::BI__imma_m32n8k16_ld_a_s8:
776 case NVPTX::BI__imma_m32n8k16_ld_a_u8:
777 case NVPTX::BI__imma_m32n8k16_ld_b_s8:
778 case NVPTX::BI__imma_m32n8k16_ld_b_u8:
779 case NVPTX::BI__imma_m32n8k16_ld_c:
780 case NVPTX::BI__imma_m8n32k16_ld_a_s8:
781 case NVPTX::BI__imma_m8n32k16_ld_a_u8:
782 case NVPTX::BI__imma_m8n32k16_ld_b_s8:
783 case NVPTX::BI__imma_m8n32k16_ld_b_u8:
784 case NVPTX::BI__imma_m8n32k16_ld_c:
786 case NVPTX::BI__imma_m8n8k32_ld_a_s4:
787 case NVPTX::BI__imma_m8n8k32_ld_a_u4:
788 case NVPTX::BI__imma_m8n8k32_ld_b_s4:
789 case NVPTX::BI__imma_m8n8k32_ld_b_u4:
790 case NVPTX::BI__imma_m8n8k32_ld_c:
791 case NVPTX::BI__bmma_m8n8k128_ld_a_b1:
792 case NVPTX::BI__bmma_m8n8k128_ld_b_b1:
793 case NVPTX::BI__bmma_m8n8k128_ld_c:
795 case NVPTX::BI__dmma_m8n8k4_ld_a:
796 case NVPTX::BI__dmma_m8n8k4_ld_b:
797 case NVPTX::BI__dmma_m8n8k4_ld_c:
799 case NVPTX::BI__mma_bf16_m16n16k16_ld_a:
800 case NVPTX::BI__mma_bf16_m16n16k16_ld_b:
801 case NVPTX::BI__mma_bf16_m8n32k16_ld_a:
802 case NVPTX::BI__mma_bf16_m8n32k16_ld_b:
803 case NVPTX::BI__mma_bf16_m32n8k16_ld_a:
804 case NVPTX::BI__mma_bf16_m32n8k16_ld_b:
805 case NVPTX::BI__mma_tf32_m16n16k8_ld_a:
806 case NVPTX::BI__mma_tf32_m16n16k8_ld_b:
807 case NVPTX::BI__mma_tf32_m16n16k8_ld_c: {
811 std::optional<llvm::APSInt> isColMajorArg =
815 bool isColMajor = isColMajorArg->getSExtValue();
816 NVPTXMmaLdstInfo II = getNVPTXMmaLdstInfo(BuiltinID);
817 unsigned IID = isColMajor ? II.IID_col : II.IID_row;
825 assert(II.NumResults);
826 if (II.NumResults == 1) {
830 for (
unsigned i = 0; i < II.NumResults; ++i) {
835 llvm::ConstantInt::get(
IntTy, i)),
842 case NVPTX::BI__hmma_m16n16k16_st_c_f16:
843 case NVPTX::BI__hmma_m16n16k16_st_c_f32:
844 case NVPTX::BI__hmma_m32n8k16_st_c_f16:
845 case NVPTX::BI__hmma_m32n8k16_st_c_f32:
846 case NVPTX::BI__hmma_m8n32k16_st_c_f16:
847 case NVPTX::BI__hmma_m8n32k16_st_c_f32:
848 case NVPTX::BI__imma_m16n16k16_st_c_i32:
849 case NVPTX::BI__imma_m32n8k16_st_c_i32:
850 case NVPTX::BI__imma_m8n32k16_st_c_i32:
851 case NVPTX::BI__imma_m8n8k32_st_c_i32:
852 case NVPTX::BI__bmma_m8n8k128_st_c_i32:
853 case NVPTX::BI__dmma_m8n8k4_st_c_f64:
854 case NVPTX::BI__mma_m16n16k8_st_c_f32: {
858 std::optional<llvm::APSInt> isColMajorArg =
862 bool isColMajor = isColMajorArg->getSExtValue();
863 NVPTXMmaLdstInfo II = getNVPTXMmaLdstInfo(BuiltinID);
864 unsigned IID = isColMajor ? II.IID_col : II.IID_row;
869 llvm::Type *ParamType = Intrinsic->getFunctionType()->getParamType(1);
871 for (
unsigned i = 0; i < II.NumResults; ++i) {
875 llvm::ConstantInt::get(
IntTy, i)),
877 Values.push_back(
Builder.CreateBitCast(
V, ParamType));
879 Values.push_back(Ldm);
886 case NVPTX::BI__hmma_m16n16k16_mma_f16f16:
887 case NVPTX::BI__hmma_m16n16k16_mma_f32f16:
888 case NVPTX::BI__hmma_m16n16k16_mma_f32f32:
889 case NVPTX::BI__hmma_m16n16k16_mma_f16f32:
890 case NVPTX::BI__hmma_m32n8k16_mma_f16f16:
891 case NVPTX::BI__hmma_m32n8k16_mma_f32f16:
892 case NVPTX::BI__hmma_m32n8k16_mma_f32f32:
893 case NVPTX::BI__hmma_m32n8k16_mma_f16f32:
894 case NVPTX::BI__hmma_m8n32k16_mma_f16f16:
895 case NVPTX::BI__hmma_m8n32k16_mma_f32f16:
896 case NVPTX::BI__hmma_m8n32k16_mma_f32f32:
897 case NVPTX::BI__hmma_m8n32k16_mma_f16f32:
898 case NVPTX::BI__imma_m16n16k16_mma_s8:
899 case NVPTX::BI__imma_m16n16k16_mma_u8:
900 case NVPTX::BI__imma_m32n8k16_mma_s8:
901 case NVPTX::BI__imma_m32n8k16_mma_u8:
902 case NVPTX::BI__imma_m8n32k16_mma_s8:
903 case NVPTX::BI__imma_m8n32k16_mma_u8:
904 case NVPTX::BI__imma_m8n8k32_mma_s4:
905 case NVPTX::BI__imma_m8n8k32_mma_u4:
906 case NVPTX::BI__bmma_m8n8k128_mma_xor_popc_b1:
907 case NVPTX::BI__bmma_m8n8k128_mma_and_popc_b1:
908 case NVPTX::BI__dmma_m8n8k4_mma_f64:
909 case NVPTX::BI__mma_bf16_m16n16k16_mma_f32:
910 case NVPTX::BI__mma_bf16_m8n32k16_mma_f32:
911 case NVPTX::BI__mma_bf16_m32n8k16_mma_f32:
912 case NVPTX::BI__mma_tf32_m16n16k8_mma_f32: {
917 std::optional<llvm::APSInt> LayoutArg =
921 int Layout = LayoutArg->getSExtValue();
922 if (Layout < 0 || Layout > 3)
924 llvm::APSInt SatfArg;
925 if (BuiltinID == NVPTX::BI__bmma_m8n8k128_mma_xor_popc_b1 ||
926 BuiltinID == NVPTX::BI__bmma_m8n8k128_mma_and_popc_b1)
928 else if (std::optional<llvm::APSInt> OptSatfArg =
930 SatfArg = *OptSatfArg;
933 bool Satf = SatfArg.getSExtValue();
934 NVPTXMmaInfo MI = getNVPTXMmaInfo(BuiltinID);
935 unsigned IID = MI.getMMAIntrinsic(Layout, Satf);
941 llvm::Type *AType = Intrinsic->getFunctionType()->getParamType(0);
943 for (
unsigned i = 0; i < MI.NumEltsA; ++i) {
947 llvm::ConstantInt::get(
IntTy, i)),
949 Values.push_back(
Builder.CreateBitCast(
V, AType));
952 llvm::Type *BType = Intrinsic->getFunctionType()->getParamType(MI.NumEltsA);
953 for (
unsigned i = 0; i < MI.NumEltsB; ++i) {
957 llvm::ConstantInt::get(
IntTy, i)),
959 Values.push_back(
Builder.CreateBitCast(
V, BType));
963 Intrinsic->getFunctionType()->getParamType(MI.NumEltsA + MI.NumEltsB);
964 for (
unsigned i = 0; i < MI.NumEltsC; ++i) {
968 llvm::ConstantInt::get(
IntTy, i)),
970 Values.push_back(
Builder.CreateBitCast(
V, CType));
974 for (
unsigned i = 0; i < MI.NumEltsD; ++i)
978 llvm::ConstantInt::get(
IntTy, i)),
983 case NVPTX::BI__nvvm_ex2_approx_f16:
985 CGM.getIntrinsic(Intrinsic::nvvm_ex2_approx,
Builder.getHalfTy()),
986 BuiltinID, E, *
this);
987 case NVPTX::BI__nvvm_ex2_approx_f16x2:
989 CGM.getIntrinsic(Intrinsic::nvvm_ex2_approx,
990 FixedVectorType::get(
Builder.getHalfTy(), 2)),
991 BuiltinID, E, *
this);
992 case NVPTX::BI__nvvm_ff2f16x2_rn:
993 return MakeHalfType(Intrinsic::nvvm_ff2f16x2_rn, BuiltinID, E, *
this);
994 case NVPTX::BI__nvvm_ff2f16x2_rn_relu:
995 return MakeHalfType(Intrinsic::nvvm_ff2f16x2_rn_relu, BuiltinID, E, *
this);
996 case NVPTX::BI__nvvm_ff2f16x2_rz:
997 return MakeHalfType(Intrinsic::nvvm_ff2f16x2_rz, BuiltinID, E, *
this);
998 case NVPTX::BI__nvvm_ff2f16x2_rz_relu:
999 return MakeHalfType(Intrinsic::nvvm_ff2f16x2_rz_relu, BuiltinID, E, *
this);
1001#define PZO_CVT(cvt) \
1002 case NVPTX::BI__nvvm_##cvt##_pzo: \
1003 return MakeHalfType(Intrinsic::nvvm_##cvt, BuiltinID, E, *this, \
1004 {Builder.getTrue()})
1010 PZO_CVT(ff2f16x2_rn_satfinite);
1011 PZO_CVT(ff2f16x2_rn_relu_satfinite);
1012 PZO_CVT(ff2f16x2_rz_satfinite);
1013 PZO_CVT(ff2f16x2_rz_relu_satfinite);
1018 PZO_CVT(ff2bf16x2_rn_satfinite);
1019 PZO_CVT(ff2bf16x2_rn_relu_satfinite);
1020 PZO_CVT(ff2bf16x2_rz_satfinite);
1021 PZO_CVT(ff2bf16x2_rz_relu_satfinite);
1027 PZO_CVT(f2f16_rn_relu_satfinite);
1029 PZO_CVT(f2f16_rz_relu_satfinite);
1035 PZO_CVT(f2bf16_rn_relu_satfinite);
1037 PZO_CVT(f2bf16_rz_relu_satfinite);
1040 PZO_CVT(ff_to_e4m3x2_rn_relu);
1042 PZO_CVT(ff_to_e4m3x2_rz_relu);
1044 PZO_CVT(ff_to_e5m2x2_rn_relu);
1046 PZO_CVT(ff_to_e5m2x2_rz_relu);
1048 PZO_CVT(f16x2_to_e4m3x2_rn_relu);
1050 PZO_CVT(f16x2_to_e4m3x2_rz_relu);
1052 PZO_CVT(f16x2_to_e5m2x2_rn_relu);
1054 PZO_CVT(f16x2_to_e5m2x2_rz_relu);
1055 PZO_CVT(bf16x2_to_e4m3x2_rn_satfinite);
1056 PZO_CVT(bf16x2_to_e4m3x2_rn_relu_satfinite);
1057 PZO_CVT(bf16x2_to_e4m3x2_rz_satfinite);
1058 PZO_CVT(bf16x2_to_e4m3x2_rz_relu_satfinite);
1059 PZO_CVT(bf16x2_to_e5m2x2_rn_satfinite);
1060 PZO_CVT(bf16x2_to_e5m2x2_rn_relu_satfinite);
1061 PZO_CVT(bf16x2_to_e5m2x2_rz_satfinite);
1062 PZO_CVT(bf16x2_to_e5m2x2_rz_relu_satfinite);
1064 PZO_CVT(ff_to_e2m3x2_rn_satfinite);
1065 PZO_CVT(ff_to_e2m3x2_rn_relu_satfinite);
1066 PZO_CVT(ff_to_e2m3x2_rz_satfinite);
1067 PZO_CVT(ff_to_e2m3x2_rz_relu_satfinite);
1068 PZO_CVT(ff_to_e3m2x2_rn_satfinite);
1069 PZO_CVT(ff_to_e3m2x2_rn_relu_satfinite);
1070 PZO_CVT(ff_to_e3m2x2_rz_satfinite);
1071 PZO_CVT(ff_to_e3m2x2_rz_relu_satfinite);
1072 PZO_CVT(f16x2_to_e2m3x2_rn_satfinite);
1073 PZO_CVT(f16x2_to_e2m3x2_rn_relu_satfinite);
1074 PZO_CVT(f16x2_to_e2m3x2_rz_satfinite);
1075 PZO_CVT(f16x2_to_e2m3x2_rz_relu_satfinite);
1076 PZO_CVT(f16x2_to_e3m2x2_rn_satfinite);
1077 PZO_CVT(f16x2_to_e3m2x2_rn_relu_satfinite);
1078 PZO_CVT(f16x2_to_e3m2x2_rz_satfinite);
1079 PZO_CVT(f16x2_to_e3m2x2_rz_relu_satfinite);
1080 PZO_CVT(bf16x2_to_e2m3x2_rn_satfinite);
1081 PZO_CVT(bf16x2_to_e2m3x2_rn_relu_satfinite);
1082 PZO_CVT(bf16x2_to_e2m3x2_rz_satfinite);
1083 PZO_CVT(bf16x2_to_e2m3x2_rz_relu_satfinite);
1084 PZO_CVT(bf16x2_to_e3m2x2_rn_satfinite);
1085 PZO_CVT(bf16x2_to_e3m2x2_rn_relu_satfinite);
1086 PZO_CVT(bf16x2_to_e3m2x2_rz_satfinite);
1087 PZO_CVT(bf16x2_to_e3m2x2_rz_relu_satfinite);
1089 PZO_CVT(ff_to_e2m1x2_rn_satfinite);
1090 PZO_CVT(ff_to_e2m1x2_rn_relu_satfinite);
1091 PZO_CVT(ff_to_e2m1x2_rz_satfinite);
1092 PZO_CVT(ff_to_e2m1x2_rz_relu_satfinite);
1093 PZO_CVT(f16x2_to_e2m1x2_rn_satfinite);
1094 PZO_CVT(f16x2_to_e2m1x2_rn_relu_satfinite);
1095 PZO_CVT(f16x2_to_e2m1x2_rz_satfinite);
1096 PZO_CVT(f16x2_to_e2m1x2_rz_relu_satfinite);
1097 PZO_CVT(bf16x2_to_e2m1x2_rn_satfinite);
1098 PZO_CVT(bf16x2_to_e2m1x2_rn_relu_satfinite);
1099 PZO_CVT(bf16x2_to_e2m1x2_rz_satfinite);
1100 PZO_CVT(bf16x2_to_e2m1x2_rz_relu_satfinite);
1104 case NVPTX::BI__nvvm_fma_rn_f16:
1105 return MakeHalfType(Intrinsic::nvvm_fma_rn_f16, BuiltinID, E, *
this);
1106 case NVPTX::BI__nvvm_fma_rn_f16x2:
1107 return MakeHalfType(Intrinsic::nvvm_fma_rn_f16x2, BuiltinID, E, *
this);
1108 case NVPTX::BI__nvvm_fma_rn_ftz_f16:
1109 return MakeHalfType(Intrinsic::nvvm_fma_rn_ftz_f16, BuiltinID, E, *
this);
1110 case NVPTX::BI__nvvm_fma_rn_ftz_f16x2:
1111 return MakeHalfType(Intrinsic::nvvm_fma_rn_ftz_f16x2, BuiltinID, E, *
this);
1112 case NVPTX::BI__nvvm_fma_rn_ftz_relu_f16:
1113 return MakeHalfType(Intrinsic::nvvm_fma_rn_ftz_relu_f16, BuiltinID, E,
1115 case NVPTX::BI__nvvm_fma_rn_ftz_relu_f16x2:
1116 return MakeHalfType(Intrinsic::nvvm_fma_rn_ftz_relu_f16x2, BuiltinID, E,
1118 case NVPTX::BI__nvvm_fma_rn_ftz_sat_f16:
1119 return MakeHalfType(Intrinsic::nvvm_fma_rn_ftz_sat_f16, BuiltinID, E,
1121 case NVPTX::BI__nvvm_fma_rn_ftz_sat_f16x2:
1122 return MakeHalfType(Intrinsic::nvvm_fma_rn_ftz_sat_f16x2, BuiltinID, E,
1124 case NVPTX::BI__nvvm_fma_rn_relu_f16:
1125 return MakeHalfType(Intrinsic::nvvm_fma_rn_relu_f16, BuiltinID, E, *
this);
1126 case NVPTX::BI__nvvm_fma_rn_relu_f16x2:
1127 return MakeHalfType(Intrinsic::nvvm_fma_rn_relu_f16x2, BuiltinID, E, *
this);
1128 case NVPTX::BI__nvvm_fma_rn_sat_f16:
1129 return MakeHalfType(Intrinsic::nvvm_fma_rn_sat_f16, BuiltinID, E, *
this);
1130 case NVPTX::BI__nvvm_fma_rn_sat_f16x2:
1131 return MakeHalfType(Intrinsic::nvvm_fma_rn_sat_f16x2, BuiltinID, E, *
this);
1132 case NVPTX::BI__nvvm_fma_rn_oob_f16:
1133 return MakeFMAOOB(Intrinsic::nvvm_fma_rn_oob,
Builder.getHalfTy(), E,
1135 case NVPTX::BI__nvvm_fma_rn_oob_f16x2:
1136 return MakeFMAOOB(Intrinsic::nvvm_fma_rn_oob,
1137 llvm::FixedVectorType::get(
Builder.getHalfTy(), 2), E,
1139 case NVPTX::BI__nvvm_fma_rn_oob_bf16:
1140 return MakeFMAOOB(Intrinsic::nvvm_fma_rn_oob,
Builder.getBFloatTy(), E,
1142 case NVPTX::BI__nvvm_fma_rn_oob_bf16x2:
1143 return MakeFMAOOB(Intrinsic::nvvm_fma_rn_oob,
1144 llvm::FixedVectorType::get(
Builder.getBFloatTy(), 2), E,
1146 case NVPTX::BI__nvvm_fma_rn_oob_relu_f16:
1147 return MakeFMAOOB(Intrinsic::nvvm_fma_rn_oob_relu,
Builder.getHalfTy(), E,
1149 case NVPTX::BI__nvvm_fma_rn_oob_relu_f16x2:
1150 return MakeFMAOOB(Intrinsic::nvvm_fma_rn_oob_relu,
1151 llvm::FixedVectorType::get(
Builder.getHalfTy(), 2), E,
1153 case NVPTX::BI__nvvm_fma_rn_oob_relu_bf16:
1154 return MakeFMAOOB(Intrinsic::nvvm_fma_rn_oob_relu,
Builder.getBFloatTy(), E,
1156 case NVPTX::BI__nvvm_fma_rn_oob_relu_bf16x2:
1157 return MakeFMAOOB(Intrinsic::nvvm_fma_rn_oob_relu,
1158 llvm::FixedVectorType::get(
Builder.getBFloatTy(), 2), E,
1160 case NVPTX::BI__nvvm_fmax_f16:
1161 return MakeHalfType(Intrinsic::nvvm_fmax_f16, BuiltinID, E, *
this);
1162 case NVPTX::BI__nvvm_fmax_f16x2:
1163 return MakeHalfType(Intrinsic::nvvm_fmax_f16x2, BuiltinID, E, *
this);
1164 case NVPTX::BI__nvvm_fmax_ftz_f16:
1165 return MakeHalfType(Intrinsic::nvvm_fmax_ftz_f16, BuiltinID, E, *
this);
1166 case NVPTX::BI__nvvm_fmax_ftz_f16x2:
1167 return MakeHalfType(Intrinsic::nvvm_fmax_ftz_f16x2, BuiltinID, E, *
this);
1168 case NVPTX::BI__nvvm_fmax_ftz_nan_f16:
1169 return MakeHalfType(Intrinsic::nvvm_fmax_ftz_nan_f16, BuiltinID, E, *
this);
1170 case NVPTX::BI__nvvm_fmax_ftz_nan_f16x2:
1171 return MakeHalfType(Intrinsic::nvvm_fmax_ftz_nan_f16x2, BuiltinID, E,
1173 case NVPTX::BI__nvvm_fmax_ftz_nan_xorsign_abs_f16:
1174 return MakeHalfType(Intrinsic::nvvm_fmax_ftz_nan_xorsign_abs_f16, BuiltinID,
1176 case NVPTX::BI__nvvm_fmax_ftz_nan_xorsign_abs_f16x2:
1177 return MakeHalfType(Intrinsic::nvvm_fmax_ftz_nan_xorsign_abs_f16x2,
1178 BuiltinID, E, *
this);
1179 case NVPTX::BI__nvvm_fmax_ftz_xorsign_abs_f16:
1180 return MakeHalfType(Intrinsic::nvvm_fmax_ftz_xorsign_abs_f16, BuiltinID, E,
1182 case NVPTX::BI__nvvm_fmax_ftz_xorsign_abs_f16x2:
1183 return MakeHalfType(Intrinsic::nvvm_fmax_ftz_xorsign_abs_f16x2, BuiltinID,
1185 case NVPTX::BI__nvvm_fmax_nan_f16:
1186 return MakeHalfType(Intrinsic::nvvm_fmax_nan_f16, BuiltinID, E, *
this);
1187 case NVPTX::BI__nvvm_fmax_nan_f16x2:
1188 return MakeHalfType(Intrinsic::nvvm_fmax_nan_f16x2, BuiltinID, E, *
this);
1189 case NVPTX::BI__nvvm_fmax_nan_xorsign_abs_f16:
1190 return MakeHalfType(Intrinsic::nvvm_fmax_nan_xorsign_abs_f16, BuiltinID, E,
1192 case NVPTX::BI__nvvm_fmax_nan_xorsign_abs_f16x2:
1193 return MakeHalfType(Intrinsic::nvvm_fmax_nan_xorsign_abs_f16x2, BuiltinID,
1195 case NVPTX::BI__nvvm_fmax_xorsign_abs_f16:
1196 return MakeHalfType(Intrinsic::nvvm_fmax_xorsign_abs_f16, BuiltinID, E,
1198 case NVPTX::BI__nvvm_fmax_xorsign_abs_f16x2:
1199 return MakeHalfType(Intrinsic::nvvm_fmax_xorsign_abs_f16x2, BuiltinID, E,
1201 case NVPTX::BI__nvvm_fmin_f16:
1202 return MakeHalfType(Intrinsic::nvvm_fmin_f16, BuiltinID, E, *
this);
1203 case NVPTX::BI__nvvm_fmin_f16x2:
1204 return MakeHalfType(Intrinsic::nvvm_fmin_f16x2, BuiltinID, E, *
this);
1205 case NVPTX::BI__nvvm_fmin_ftz_f16:
1206 return MakeHalfType(Intrinsic::nvvm_fmin_ftz_f16, BuiltinID, E, *
this);
1207 case NVPTX::BI__nvvm_fmin_ftz_f16x2:
1208 return MakeHalfType(Intrinsic::nvvm_fmin_ftz_f16x2, BuiltinID, E, *
this);
1209 case NVPTX::BI__nvvm_fmin_ftz_nan_f16:
1210 return MakeHalfType(Intrinsic::nvvm_fmin_ftz_nan_f16, BuiltinID, E, *
this);
1211 case NVPTX::BI__nvvm_fmin_ftz_nan_f16x2:
1212 return MakeHalfType(Intrinsic::nvvm_fmin_ftz_nan_f16x2, BuiltinID, E,
1214 case NVPTX::BI__nvvm_fmin_ftz_nan_xorsign_abs_f16:
1215 return MakeHalfType(Intrinsic::nvvm_fmin_ftz_nan_xorsign_abs_f16, BuiltinID,
1217 case NVPTX::BI__nvvm_fmin_ftz_nan_xorsign_abs_f16x2:
1218 return MakeHalfType(Intrinsic::nvvm_fmin_ftz_nan_xorsign_abs_f16x2,
1219 BuiltinID, E, *
this);
1220 case NVPTX::BI__nvvm_fmin_ftz_xorsign_abs_f16:
1221 return MakeHalfType(Intrinsic::nvvm_fmin_ftz_xorsign_abs_f16, BuiltinID, E,
1223 case NVPTX::BI__nvvm_fmin_ftz_xorsign_abs_f16x2:
1224 return MakeHalfType(Intrinsic::nvvm_fmin_ftz_xorsign_abs_f16x2, BuiltinID,
1226 case NVPTX::BI__nvvm_fmin_nan_f16:
1227 return MakeHalfType(Intrinsic::nvvm_fmin_nan_f16, BuiltinID, E, *
this);
1228 case NVPTX::BI__nvvm_fmin_nan_f16x2:
1229 return MakeHalfType(Intrinsic::nvvm_fmin_nan_f16x2, BuiltinID, E, *
this);
1230 case NVPTX::BI__nvvm_fmin_nan_xorsign_abs_f16:
1231 return MakeHalfType(Intrinsic::nvvm_fmin_nan_xorsign_abs_f16, BuiltinID, E,
1233 case NVPTX::BI__nvvm_fmin_nan_xorsign_abs_f16x2:
1234 return MakeHalfType(Intrinsic::nvvm_fmin_nan_xorsign_abs_f16x2, BuiltinID,
1236 case NVPTX::BI__nvvm_fmin_xorsign_abs_f16:
1237 return MakeHalfType(Intrinsic::nvvm_fmin_xorsign_abs_f16, BuiltinID, E,
1239 case NVPTX::BI__nvvm_fmin_xorsign_abs_f16x2:
1240 return MakeHalfType(Intrinsic::nvvm_fmin_xorsign_abs_f16x2, BuiltinID, E,
1242 case NVPTX::BI__nvvm_fabs_f:
1243 case NVPTX::BI__nvvm_abs_bf16:
1244 case NVPTX::BI__nvvm_abs_bf16x2:
1245 case NVPTX::BI__nvvm_fabs_f16:
1246 case NVPTX::BI__nvvm_fabs_f16x2:
1247 return Builder.CreateUnaryIntrinsic(Intrinsic::nvvm_fabs,
1249 case NVPTX::BI__nvvm_fabs_ftz_f:
1250 case NVPTX::BI__nvvm_fabs_ftz_f16:
1251 case NVPTX::BI__nvvm_fabs_ftz_f16x2:
1252 return Builder.CreateUnaryIntrinsic(Intrinsic::nvvm_fabs_ftz,
1254 case NVPTX::BI__nvvm_fabs_d:
1256 case NVPTX::BI__nvvm_ex2_approx_d:
1257 case NVPTX::BI__nvvm_ex2_approx_f:
1258 return Builder.CreateUnaryIntrinsic(Intrinsic::nvvm_ex2_approx,
1260 case NVPTX::BI__nvvm_ex2_approx_ftz_f:
1261 return Builder.CreateUnaryIntrinsic(Intrinsic::nvvm_ex2_approx_ftz,
1263 case NVPTX::BI__nvvm_add_rn_f:
1264 case NVPTX::BI__nvvm_add_rn_d:
1265 return MakeFAdd(Intrinsic::nvvm_fadd, APFloat::rmNearestTiesToEven,
1266 BuiltinID, E, *
this);
1267 case NVPTX::BI__nvvm_add_rz_f:
1268 case NVPTX::BI__nvvm_add_rz_d:
1269 return MakeFAdd(Intrinsic::nvvm_fadd, APFloat::rmTowardZero, BuiltinID, E,
1271 case NVPTX::BI__nvvm_add_rm_f:
1272 case NVPTX::BI__nvvm_add_rm_d:
1273 return MakeFAdd(Intrinsic::nvvm_fadd, APFloat::rmTowardNegative, BuiltinID,
1275 case NVPTX::BI__nvvm_add_rp_f:
1276 case NVPTX::BI__nvvm_add_rp_d:
1277 return MakeFAdd(Intrinsic::nvvm_fadd, APFloat::rmTowardPositive, BuiltinID,
1279 case NVPTX::BI__nvvm_add_rn_ftz_f:
1280 return MakeFAdd(Intrinsic::nvvm_fadd_ftz, APFloat::rmNearestTiesToEven,
1281 BuiltinID, E, *
this);
1282 case NVPTX::BI__nvvm_add_rz_ftz_f:
1283 return MakeFAdd(Intrinsic::nvvm_fadd_ftz, APFloat::rmTowardZero, BuiltinID,
1285 case NVPTX::BI__nvvm_add_rm_ftz_f:
1286 return MakeFAdd(Intrinsic::nvvm_fadd_ftz, APFloat::rmTowardNegative,
1287 BuiltinID, E, *
this);
1288 case NVPTX::BI__nvvm_add_rp_ftz_f:
1289 return MakeFAdd(Intrinsic::nvvm_fadd_ftz, APFloat::rmTowardPositive,
1290 BuiltinID, E, *
this);
1291 case NVPTX::BI__nvvm_add_rn_sat_f:
1292 case NVPTX::BI__nvvm_add_rn_sat_f16:
1293 case NVPTX::BI__nvvm_add_rn_sat_v2f16:
1294 return MakeFAdd(Intrinsic::nvvm_fadd_sat, APFloat::rmNearestTiesToEven,
1295 BuiltinID, E, *
this);
1296 case NVPTX::BI__nvvm_add_rz_sat_f:
1297 return MakeFAdd(Intrinsic::nvvm_fadd_sat, APFloat::rmTowardZero, BuiltinID,
1299 case NVPTX::BI__nvvm_add_rm_sat_f:
1300 return MakeFAdd(Intrinsic::nvvm_fadd_sat, APFloat::rmTowardNegative,
1301 BuiltinID, E, *
this);
1302 case NVPTX::BI__nvvm_add_rp_sat_f:
1303 return MakeFAdd(Intrinsic::nvvm_fadd_sat, APFloat::rmTowardPositive,
1304 BuiltinID, E, *
this);
1305 case NVPTX::BI__nvvm_add_rn_ftz_sat_f:
1306 case NVPTX::BI__nvvm_add_rn_ftz_sat_f16:
1307 case NVPTX::BI__nvvm_add_rn_ftz_sat_v2f16:
1308 return MakeFAdd(Intrinsic::nvvm_fadd_ftz_sat, APFloat::rmNearestTiesToEven,
1309 BuiltinID, E, *
this);
1310 case NVPTX::BI__nvvm_add_rz_ftz_sat_f:
1311 return MakeFAdd(Intrinsic::nvvm_fadd_ftz_sat, APFloat::rmTowardZero,
1312 BuiltinID, E, *
this);
1313 case NVPTX::BI__nvvm_add_rm_ftz_sat_f:
1314 return MakeFAdd(Intrinsic::nvvm_fadd_ftz_sat, APFloat::rmTowardNegative,
1315 BuiltinID, E, *
this);
1316 case NVPTX::BI__nvvm_add_rp_ftz_sat_f:
1317 return MakeFAdd(Intrinsic::nvvm_fadd_ftz_sat, APFloat::rmTowardPositive,
1318 BuiltinID, E, *
this);
1319 case NVPTX::BI__nvvm_ldg_h:
1320 case NVPTX::BI__nvvm_ldg_h2:
1321 return MakeLdg(*
this, E);
1322 case NVPTX::BI__nvvm_ldu_h:
1323 case NVPTX::BI__nvvm_ldu_h2:
1324 return MakeLdu(Intrinsic::nvvm_ldu_global_f, *
this, E);
1325 case NVPTX::BI__nvvm_cp_async_ca_shared_global_4:
1326 return MakeCpAsync(Intrinsic::nvvm_cp_async_ca_shared_global_4,
1327 Intrinsic::nvvm_cp_async_ca_shared_global_4_s, *
this, E,
1329 case NVPTX::BI__nvvm_cp_async_ca_shared_global_8:
1330 return MakeCpAsync(Intrinsic::nvvm_cp_async_ca_shared_global_8,
1331 Intrinsic::nvvm_cp_async_ca_shared_global_8_s, *
this, E,
1333 case NVPTX::BI__nvvm_cp_async_ca_shared_global_16:
1334 return MakeCpAsync(Intrinsic::nvvm_cp_async_ca_shared_global_16,
1335 Intrinsic::nvvm_cp_async_ca_shared_global_16_s, *
this, E,
1337 case NVPTX::BI__nvvm_cp_async_cg_shared_global_16:
1338 return MakeCpAsync(Intrinsic::nvvm_cp_async_cg_shared_global_16,
1339 Intrinsic::nvvm_cp_async_cg_shared_global_16_s, *
this, E,
1341 case NVPTX::BI__nvvm_read_ptx_sreg_clusterid_x:
1343 CGM.getIntrinsic(Intrinsic::nvvm_read_ptx_sreg_clusterid_x));
1344 case NVPTX::BI__nvvm_read_ptx_sreg_clusterid_y:
1346 CGM.getIntrinsic(Intrinsic::nvvm_read_ptx_sreg_clusterid_y));
1347 case NVPTX::BI__nvvm_read_ptx_sreg_clusterid_z:
1349 CGM.getIntrinsic(Intrinsic::nvvm_read_ptx_sreg_clusterid_z));
1350 case NVPTX::BI__nvvm_read_ptx_sreg_clusterid_w:
1352 CGM.getIntrinsic(Intrinsic::nvvm_read_ptx_sreg_clusterid_w));
1353 case NVPTX::BI__nvvm_read_ptx_sreg_nclusterid_x:
1355 CGM.getIntrinsic(Intrinsic::nvvm_read_ptx_sreg_nclusterid_x));
1356 case NVPTX::BI__nvvm_read_ptx_sreg_nclusterid_y:
1358 CGM.getIntrinsic(Intrinsic::nvvm_read_ptx_sreg_nclusterid_y));
1359 case NVPTX::BI__nvvm_read_ptx_sreg_nclusterid_z:
1361 CGM.getIntrinsic(Intrinsic::nvvm_read_ptx_sreg_nclusterid_z));
1362 case NVPTX::BI__nvvm_read_ptx_sreg_nclusterid_w:
1364 CGM.getIntrinsic(Intrinsic::nvvm_read_ptx_sreg_nclusterid_w));
1365 case NVPTX::BI__nvvm_read_ptx_sreg_cluster_ctaid_x:
1367 CGM.getIntrinsic(Intrinsic::nvvm_read_ptx_sreg_cluster_ctaid_x));
1368 case NVPTX::BI__nvvm_read_ptx_sreg_cluster_ctaid_y:
1370 CGM.getIntrinsic(Intrinsic::nvvm_read_ptx_sreg_cluster_ctaid_y));
1371 case NVPTX::BI__nvvm_read_ptx_sreg_cluster_ctaid_z:
1373 CGM.getIntrinsic(Intrinsic::nvvm_read_ptx_sreg_cluster_ctaid_z));
1374 case NVPTX::BI__nvvm_read_ptx_sreg_cluster_ctaid_w:
1376 CGM.getIntrinsic(Intrinsic::nvvm_read_ptx_sreg_cluster_ctaid_w));
1377 case NVPTX::BI__nvvm_read_ptx_sreg_cluster_nctaid_x:
1379 CGM.getIntrinsic(Intrinsic::nvvm_read_ptx_sreg_cluster_nctaid_x));
1380 case NVPTX::BI__nvvm_read_ptx_sreg_cluster_nctaid_y:
1382 CGM.getIntrinsic(Intrinsic::nvvm_read_ptx_sreg_cluster_nctaid_y));
1383 case NVPTX::BI__nvvm_read_ptx_sreg_cluster_nctaid_z:
1385 CGM.getIntrinsic(Intrinsic::nvvm_read_ptx_sreg_cluster_nctaid_z));
1386 case NVPTX::BI__nvvm_read_ptx_sreg_cluster_nctaid_w:
1388 CGM.getIntrinsic(Intrinsic::nvvm_read_ptx_sreg_cluster_nctaid_w));
1389 case NVPTX::BI__nvvm_read_ptx_sreg_cluster_ctarank:
1391 CGM.getIntrinsic(Intrinsic::nvvm_read_ptx_sreg_cluster_ctarank));
1392 case NVPTX::BI__nvvm_read_ptx_sreg_cluster_nctarank:
1394 CGM.getIntrinsic(Intrinsic::nvvm_read_ptx_sreg_cluster_nctarank));
1395 case NVPTX::BI__nvvm_is_explicit_cluster:
1397 CGM.getIntrinsic(Intrinsic::nvvm_is_explicit_cluster));
1398 case NVPTX::BI__nvvm_isspacep_shared_cluster:
1400 CGM.getIntrinsic(Intrinsic::nvvm_isspacep_shared_cluster),
1402 case NVPTX::BI__nvvm_mapa:
1404 CGM.getIntrinsic(Intrinsic::nvvm_mapa),
1405 {EmitScalarExpr(E->getArg(0)), EmitScalarExpr(E->getArg(1))});
1406 case NVPTX::BI__nvvm_mapa_shared_cluster:
1408 CGM.getIntrinsic(Intrinsic::nvvm_mapa_shared_cluster),
1409 {EmitScalarExpr(E->getArg(0)), EmitScalarExpr(E->getArg(1))});
1410 case NVPTX::BI__nvvm_getctarank:
1412 CGM.getIntrinsic(Intrinsic::nvvm_getctarank),
1414 case NVPTX::BI__nvvm_getctarank_shared_cluster:
1416 CGM.getIntrinsic(Intrinsic::nvvm_getctarank_shared_cluster),
1418 case NVPTX::BI__nvvm_barrier_cluster_arrive:
1420 CGM.getIntrinsic(Intrinsic::nvvm_barrier_cluster_arrive));
1421 case NVPTX::BI__nvvm_barrier_cluster_arrive_relaxed:
1423 CGM.getIntrinsic(Intrinsic::nvvm_barrier_cluster_arrive_relaxed));
1424 case NVPTX::BI__nvvm_barrier_cluster_wait:
1426 CGM.getIntrinsic(Intrinsic::nvvm_barrier_cluster_wait));
1427 case NVPTX::BI__nvvm_fence_sc_cluster:
1429 CGM.getIntrinsic(Intrinsic::nvvm_fence_sc_cluster));
1430 case NVPTX::BI__nvvm_bar_sync:
1432 CGM.getIntrinsic(Intrinsic::nvvm_barrier_cta_sync_aligned_all),
1434 case NVPTX::BI__syncthreads:
1436 CGM.getIntrinsic(Intrinsic::nvvm_barrier_cta_sync_aligned_all),
1438 case NVPTX::BI__nvvm_barrier_sync:
1440 CGM.getIntrinsic(Intrinsic::nvvm_barrier_cta_sync_all),
1442 case NVPTX::BI__nvvm_barrier_sync_cnt:
1444 CGM.getIntrinsic(Intrinsic::nvvm_barrier_cta_sync_count),
1445 {EmitScalarExpr(E->getArg(0)), EmitScalarExpr(E->getArg(1))});
1446 case NVPTX::BI__nvvm_bar0_and:
1449 Intrinsic::nvvm_barrier_cta_red_and_aligned_all, {},
1450 {Builder.getInt32(0),
1451 Builder.CreateICmpNE(EmitScalarExpr(E->getArg(0)),
1452 Builder.getInt32(0))}),
1454 case NVPTX::BI__nvvm_bar0_or:
1457 Intrinsic::nvvm_barrier_cta_red_or_aligned_all, {},
1458 {Builder.getInt32(0),
1459 Builder.CreateICmpNE(EmitScalarExpr(E->getArg(0)),
1460 Builder.getInt32(0))}),
1462 case NVPTX::BI__nvvm_bar0_popc:
1463 return Builder.CreateIntrinsic(
1464 Intrinsic::nvvm_barrier_cta_red_popc_aligned_all, {},
1467 case NVPTX::BI__nvvm_mbarrier_init:
1468 case NVPTX::BI__nvvm_mbarrier_init_shared: {
1472 return Builder.CreateIntrinsic(
1473 Intrinsic::nvvm_mbarrier_init, {Ptr->getType()},