llvm.org GIT mirror llvm / 19f047f
Add the new builder arthmetic instructions to llvm-c and ocaml. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97372 91177308-0d34-0410-b5e6-96231b3b80d8 Erick Tryzelaar 9 years ago
6 changed file(s) with 320 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
269269 external align_of : lltype -> llvalue = "LLVMAlignOf"
270270 external size_of : lltype -> llvalue = "LLVMSizeOf"
271271 external const_neg : llvalue -> llvalue = "LLVMConstNeg"
272 external const_nsw_neg : llvalue -> llvalue = "LLVMConstNSWNeg"
273 external const_nuw_neg : llvalue -> llvalue = "LLVMConstNUWNeg"
272274 external const_fneg : llvalue -> llvalue = "LLVMConstFNeg"
273275 external const_not : llvalue -> llvalue = "LLVMConstNot"
274276 external const_add : llvalue -> llvalue -> llvalue = "LLVMConstAdd"
275277 external const_nsw_add : llvalue -> llvalue -> llvalue = "LLVMConstNSWAdd"
278 external const_nuw_add : llvalue -> llvalue -> llvalue = "LLVMConstNUWAdd"
276279 external const_fadd : llvalue -> llvalue -> llvalue = "LLVMConstFAdd"
277280 external const_sub : llvalue -> llvalue -> llvalue = "LLVMConstSub"
281 external const_nsw_sub : llvalue -> llvalue -> llvalue = "LLVMConstNSWSub"
282 external const_nuw_sub : llvalue -> llvalue -> llvalue = "LLVMConstNUWSub"
278283 external const_fsub : llvalue -> llvalue -> llvalue = "LLVMConstFSub"
279284 external const_mul : llvalue -> llvalue -> llvalue = "LLVMConstMul"
285 external const_nsw_mul : llvalue -> llvalue -> llvalue = "LLVMConstNSWMul"
286 external const_nuw_mul : llvalue -> llvalue -> llvalue = "LLVMConstNUWMul"
280287 external const_fmul : llvalue -> llvalue -> llvalue = "LLVMConstFMul"
281288 external const_udiv : llvalue -> llvalue -> llvalue = "LLVMConstUDiv"
282289 external const_sdiv : llvalue -> llvalue -> llvalue = "LLVMConstSDiv"
710717 = "llvm_build_add"
711718 external build_nsw_add : llvalue -> llvalue -> string -> llbuilder -> llvalue
712719 = "llvm_build_nsw_add"
720 external build_nuw_add : llvalue -> llvalue -> string -> llbuilder -> llvalue
721 = "llvm_build_nuw_add"
713722 external build_fadd : llvalue -> llvalue -> string -> llbuilder -> llvalue
714723 = "llvm_build_fadd"
715724 external build_sub : llvalue -> llvalue -> string -> llbuilder -> llvalue
716725 = "llvm_build_sub"
726 external build_nsw_sub : llvalue -> llvalue -> string -> llbuilder -> llvalue
727 = "llvm_build_nsw_sub"
728 external build_nuw_sub : llvalue -> llvalue -> string -> llbuilder -> llvalue
729 = "llvm_build_nuw_sub"
717730 external build_fsub : llvalue -> llvalue -> string -> llbuilder -> llvalue
718731 = "llvm_build_fsub"
719732 external build_mul : llvalue -> llvalue -> string -> llbuilder -> llvalue
720733 = "llvm_build_mul"
734 external build_nsw_mul : llvalue -> llvalue -> string -> llbuilder -> llvalue
735 = "llvm_build_nsw_mul"
736 external build_nuw_mul : llvalue -> llvalue -> string -> llbuilder -> llvalue
737 = "llvm_build_nuw_mul"
721738 external build_fmul : llvalue -> llvalue -> string -> llbuilder -> llvalue
722739 = "llvm_build_fmul"
723740 external build_udiv : llvalue -> llvalue -> string -> llbuilder -> llvalue
748765 = "llvm_build_xor"
749766 external build_neg : llvalue -> string -> llbuilder -> llvalue
750767 = "llvm_build_neg"
768 external build_nsw_neg : llvalue -> string -> llbuilder -> llvalue
769 = "llvm_build_nsw_neg"
770 external build_nuw_neg : llvalue -> string -> llbuilder -> llvalue
771 = "llvm_build_nuw_neg"
772 external build_fneg : llvalue -> string -> llbuilder -> llvalue
773 = "llvm_build_fneg"
751774 external build_not : llvalue -> string -> llbuilder -> llvalue
752775 = "llvm_build_not"
753776
614614 See the method [llvm::ConstantExpr::getNeg]. *)
615615 external const_neg : llvalue -> llvalue = "LLVMConstNeg"
616616
617 (** [const_nsw_neg c] returns the arithmetic negation of the constant [c] with
618 no signed wrapping. The result is undefined if the negation overflows.
619 See the method [llvm::ConstantExpr::getNSWNeg]. *)
620 external const_nsw_neg : llvalue -> llvalue = "LLVMConstNSWNeg"
621
622 (** [const_nuw_neg c] returns the arithmetic negation of the constant [c] with
623 no unsigned wrapping. The result is undefined if the negation overflows.
624 See the method [llvm::ConstantExpr::getNUWNeg]. *)
625 external const_nuw_neg : llvalue -> llvalue = "LLVMConstNUWNeg"
626
617627 (** [const_fneg c] returns the arithmetic negation of the constant float [c].
618628 See the method [llvm::ConstantExpr::getFNeg]. *)
619629 external const_fneg : llvalue -> llvalue = "LLVMConstFNeg"
631641 See the method [llvm::ConstantExpr::getNSWAdd]. *)
632642 external const_nsw_add : llvalue -> llvalue -> llvalue = "LLVMConstNSWAdd"
633643
644 (** [const_nuw_add c1 c2] returns the constant sum of two constants with no
645 unsigned wrapping. The result is undefined if the sum overflows.
646 See the method [llvm::ConstantExpr::getNSWAdd]. *)
647 external const_nuw_add : llvalue -> llvalue -> llvalue = "LLVMConstNUWAdd"
648
634649 (** [const_fadd c1 c2] returns the constant sum of two constant floats.
635650 See the method [llvm::ConstantExpr::getFAdd]. *)
636651 external const_fadd : llvalue -> llvalue -> llvalue = "LLVMConstFAdd"
639654 constants. See the method [llvm::ConstantExpr::getSub]. *)
640655 external const_sub : llvalue -> llvalue -> llvalue = "LLVMConstSub"
641656
657 (** [const_nsw_sub c1 c2] returns the constant difference of two constants with
658 no signed wrapping. The result is undefined if the sum overflows.
659 See the method [llvm::ConstantExpr::getNSWSub]. *)
660 external const_nsw_sub : llvalue -> llvalue -> llvalue = "LLVMConstNSWSub"
661
662 (** [const_nuw_sub c1 c2] returns the constant difference of two constants with
663 no unsigned wrapping. The result is undefined if the sum overflows.
664 See the method [llvm::ConstantExpr::getNSWSub]. *)
665 external const_nuw_sub : llvalue -> llvalue -> llvalue = "LLVMConstNUWSub"
666
642667 (** [const_fsub c1 c2] returns the constant difference, [c1 - c2], of two
643668 constant floats. See the method [llvm::ConstantExpr::getFSub]. *)
644669 external const_fsub : llvalue -> llvalue -> llvalue = "LLVMConstFSub"
646671 (** [const_mul c1 c2] returns the constant product of two constants.
647672 See the method [llvm::ConstantExpr::getMul]. *)
648673 external const_mul : llvalue -> llvalue -> llvalue = "LLVMConstMul"
674
675 (** [const_nsw_mul c1 c2] returns the constant product of two constants with
676 no signed wrapping. The result is undefined if the sum overflows.
677 See the method [llvm::ConstantExpr::getNSWMul]. *)
678 external const_nsw_mul : llvalue -> llvalue -> llvalue = "LLVMConstNSWMul"
679
680 (** [const_nuw_mul c1 c2] returns the constant product of two constants with
681 no unsigned wrapping. The result is undefined if the sum overflows.
682 See the method [llvm::ConstantExpr::getNSWMul]. *)
683 external const_nuw_mul : llvalue -> llvalue -> llvalue = "LLVMConstNUWMul"
649684
650685 (** [const_fmul c1 c2] returns the constant product of two constants floats.
651686 See the method [llvm::ConstantExpr::getFMul]. *)
15011536 external build_nsw_add : llvalue -> llvalue -> string -> llbuilder -> llvalue
15021537 = "llvm_build_nsw_add"
15031538
1539 (** [build_nuw_add x y name b] creates a
1540 [%name = nuw add %x, %y]
1541 instruction at the position specified by the instruction builder [b].
1542 See the method [llvm::LLVMBuilder::CreateNUWAdd]. *)
1543 external build_nuw_add : llvalue -> llvalue -> string -> llbuilder -> llvalue
1544 = "llvm_build_nuw_add"
1545
15041546 (** [build_fadd x y name b] creates a
15051547 [%name = fadd %x, %y]
15061548 instruction at the position specified by the instruction builder [b].
15151557 external build_sub : llvalue -> llvalue -> string -> llbuilder -> llvalue
15161558 = "llvm_build_sub"
15171559
1560 (** [build_nsw_sub x y name b] creates a
1561 [%name = nsw sub %x, %y]
1562 instruction at the position specified by the instruction builder [b].
1563 See the method [llvm::LLVMBuilder::CreateNSWSub]. *)
1564 external build_nsw_sub : llvalue -> llvalue -> string -> llbuilder -> llvalue
1565 = "llvm_build_nsw_sub"
1566
1567 (** [build_nuw_sub x y name b] creates a
1568 [%name = nuw sub %x, %y]
1569 instruction at the position specified by the instruction builder [b].
1570 See the method [llvm::LLVMBuilder::CreateNUWSub]. *)
1571 external build_nuw_sub : llvalue -> llvalue -> string -> llbuilder -> llvalue
1572 = "llvm_build_nuw_sub"
1573
15181574 (** [build_fsub x y name b] creates a
15191575 [%name = fsub %x, %y]
15201576 instruction at the position specified by the instruction builder [b].
15281584 See the method [llvm::LLVMBuilder::CreateMul]. *)
15291585 external build_mul : llvalue -> llvalue -> string -> llbuilder -> llvalue
15301586 = "llvm_build_mul"
1587
1588 (** [build_nsw_mul x y name b] creates a
1589 [%name = nsw mul %x, %y]
1590 instruction at the position specified by the instruction builder [b].
1591 See the method [llvm::LLVMBuilder::CreateNSWMul]. *)
1592 external build_nsw_mul : llvalue -> llvalue -> string -> llbuilder -> llvalue
1593 = "llvm_build_nsw_mul"
1594
1595 (** [build_nuw_mul x y name b] creates a
1596 [%name = nuw mul %x, %y]
1597 instruction at the position specified by the instruction builder [b].
1598 See the method [llvm::LLVMBuilder::CreateNUWMul]. *)
1599 external build_nuw_mul : llvalue -> llvalue -> string -> llbuilder -> llvalue
1600 = "llvm_build_nuw_mul"
15311601
15321602 (** [build_fmul x y name b] creates a
15331603 [%name = fmul %x, %y]
16341704 See the method [llvm::LLVMBuilder::CreateNeg]. *)
16351705 external build_neg : llvalue -> string -> llbuilder -> llvalue
16361706 = "llvm_build_neg"
1707
1708 (** [build_nsw_neg x name b] creates a
1709 [%name = nsw sub 0, %x]
1710 instruction at the position specified by the instruction builder [b].
1711 [-0.0] is used for floating point types to compute the correct sign.
1712 See the method [llvm::LLVMBuilder::CreateNeg]. *)
1713 external build_nsw_neg : llvalue -> string -> llbuilder -> llvalue
1714 = "llvm_build_nsw_neg"
1715
1716 (** [build_nuw_neg x name b] creates a
1717 [%name = nuw sub 0, %x]
1718 instruction at the position specified by the instruction builder [b].
1719 [-0.0] is used for floating point types to compute the correct sign.
1720 See the method [llvm::LLVMBuilder::CreateNeg]. *)
1721 external build_nuw_neg : llvalue -> string -> llbuilder -> llvalue
1722 = "llvm_build_nuw_neg"
1723
1724 (** [build_fneg x name b] creates a
1725 [%name = fsub 0, %x]
1726 instruction at the position specified by the instruction builder [b].
1727 [-0.0] is used for floating point types to compute the correct sign.
1728 See the method [llvm::LLVMBuilder::CreateFNeg]. *)
1729 external build_fneg : llvalue -> string -> llbuilder -> llvalue
1730 = "llvm_build_fneg"
16371731
16381732 (** [build_xor x name b] creates a
16391733 [%name = xor %x, -1]
10951095 }
10961096
10971097 /* llvalue -> llvalue -> string -> llbuilder -> llvalue */
1098 CAMLprim LLVMValueRef llvm_build_nuw_add(LLVMValueRef LHS, LLVMValueRef RHS,
1099 value Name, value B) {
1100 return LLVMBuildNUWAdd(Builder_val(B), LHS, RHS, String_val(Name));
1101 }
1102
1103 /* llvalue -> llvalue -> string -> llbuilder -> llvalue */
10981104 CAMLprim LLVMValueRef llvm_build_fadd(LLVMValueRef LHS, LLVMValueRef RHS,
10991105 value Name, value B) {
11001106 return LLVMBuildFAdd(Builder_val(B), LHS, RHS, String_val(Name));
11071113 }
11081114
11091115 /* llvalue -> llvalue -> string -> llbuilder -> llvalue */
1116 CAMLprim LLVMValueRef llvm_build_nsw_sub(LLVMValueRef LHS, LLVMValueRef RHS,
1117 value Name, value B) {
1118 return LLVMBuildNSWSub(Builder_val(B), LHS, RHS, String_val(Name));
1119 }
1120
1121 /* llvalue -> llvalue -> string -> llbuilder -> llvalue */
1122 CAMLprim LLVMValueRef llvm_build_nuw_sub(LLVMValueRef LHS, LLVMValueRef RHS,
1123 value Name, value B) {
1124 return LLVMBuildNUWSub(Builder_val(B), LHS, RHS, String_val(Name));
1125 }
1126
1127 /* llvalue -> llvalue -> string -> llbuilder -> llvalue */
11101128 CAMLprim LLVMValueRef llvm_build_fsub(LLVMValueRef LHS, LLVMValueRef RHS,
11111129 value Name, value B) {
11121130 return LLVMBuildFSub(Builder_val(B), LHS, RHS, String_val(Name));
11161134 CAMLprim LLVMValueRef llvm_build_mul(LLVMValueRef LHS, LLVMValueRef RHS,
11171135 value Name, value B) {
11181136 return LLVMBuildMul(Builder_val(B), LHS, RHS, String_val(Name));
1137 }
1138
1139 /* llvalue -> llvalue -> string -> llbuilder -> llvalue */
1140 CAMLprim LLVMValueRef llvm_build_nsw_mul(LLVMValueRef LHS, LLVMValueRef RHS,
1141 value Name, value B) {
1142 return LLVMBuildNSWMul(Builder_val(B), LHS, RHS, String_val(Name));
1143 }
1144
1145 /* llvalue -> llvalue -> string -> llbuilder -> llvalue */
1146 CAMLprim LLVMValueRef llvm_build_nuw_mul(LLVMValueRef LHS, LLVMValueRef RHS,
1147 value Name, value B) {
1148 return LLVMBuildNUWMul(Builder_val(B), LHS, RHS, String_val(Name));
11191149 }
11201150
11211151 /* llvalue -> llvalue -> string -> llbuilder -> llvalue */
12061236 CAMLprim LLVMValueRef llvm_build_neg(LLVMValueRef X,
12071237 value Name, value B) {
12081238 return LLVMBuildNeg(Builder_val(B), X, String_val(Name));
1239 }
1240
1241 /* llvalue -> string -> llbuilder -> llvalue */
1242 CAMLprim LLVMValueRef llvm_build_nsw_neg(LLVMValueRef X,
1243 value Name, value B) {
1244 return LLVMBuildNSWNeg(Builder_val(B), X, String_val(Name));
1245 }
1246
1247 /* llvalue -> string -> llbuilder -> llvalue */
1248 CAMLprim LLVMValueRef llvm_build_nuw_neg(LLVMValueRef X,
1249 value Name, value B) {
1250 return LLVMBuildNUWNeg(Builder_val(B), X, String_val(Name));
1251 }
1252
1253 /* llvalue -> string -> llbuilder -> llvalue */
1254 CAMLprim LLVMValueRef llvm_build_fneg(LLVMValueRef X,
1255 value Name, value B) {
1256 return LLVMBuildFNeg(Builder_val(B), X, String_val(Name));
12091257 }
12101258
12111259 /* llvalue -> string -> llbuilder -> llvalue */
557557 LLVMValueRef LLVMAlignOf(LLVMTypeRef Ty);
558558 LLVMValueRef LLVMSizeOf(LLVMTypeRef Ty);
559559 LLVMValueRef LLVMConstNeg(LLVMValueRef ConstantVal);
560 LLVMValueRef LLVMConstNSWNeg(LLVMValueRef ConstantVal);
561 LLVMValueRef LLVMConstNUWNeg(LLVMValueRef ConstantVal);
560562 LLVMValueRef LLVMConstFNeg(LLVMValueRef ConstantVal);
561563 LLVMValueRef LLVMConstNot(LLVMValueRef ConstantVal);
562564 LLVMValueRef LLVMConstAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
563565 LLVMValueRef LLVMConstNSWAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
566 LLVMValueRef LLVMConstNUWAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
564567 LLVMValueRef LLVMConstFAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
565568 LLVMValueRef LLVMConstSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
569 LLVMValueRef LLVMConstNSWSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
570 LLVMValueRef LLVMConstNUWSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
566571 LLVMValueRef LLVMConstFSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
567572 LLVMValueRef LLVMConstMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
573 LLVMValueRef LLVMConstNSWMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
574 LLVMValueRef LLVMConstNUWMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
568575 LLVMValueRef LLVMConstFMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
569576 LLVMValueRef LLVMConstUDiv(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
570577 LLVMValueRef LLVMConstSDiv(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
791798 const char *Name);
792799 LLVMValueRef LLVMBuildNSWAdd(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
793800 const char *Name);
801 LLVMValueRef LLVMBuildNUWAdd(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
802 const char *Name);
794803 LLVMValueRef LLVMBuildFAdd(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
795804 const char *Name);
796805 LLVMValueRef LLVMBuildSub(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
797806 const char *Name);
807 LLVMValueRef LLVMBuildNSWSub(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
808 const char *Name);
809 LLVMValueRef LLVMBuildNUWSub(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
810 const char *Name);
798811 LLVMValueRef LLVMBuildFSub(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
799812 const char *Name);
800813 LLVMValueRef LLVMBuildMul(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
801814 const char *Name);
815 LLVMValueRef LLVMBuildNSWMul(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
816 const char *Name);
817 LLVMValueRef LLVMBuildNUWMul(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
818 const char *Name);
802819 LLVMValueRef LLVMBuildFMul(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
803820 const char *Name);
804821 LLVMValueRef LLVMBuildUDiv(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
831848 LLVMValueRef LHS, LLVMValueRef RHS,
832849 const char *Name);
833850 LLVMValueRef LLVMBuildNeg(LLVMBuilderRef, LLVMValueRef V, const char *Name);
851 LLVMValueRef LLVMBuildNSWNeg(LLVMBuilderRef B, LLVMValueRef V,
852 const char *Name);
853 LLVMValueRef LLVMBuildNUWNeg(LLVMBuilderRef B, LLVMValueRef V,
854 const char *Name);
834855 LLVMValueRef LLVMBuildFNeg(LLVMBuilderRef, LLVMValueRef V, const char *Name);
835856 LLVMValueRef LLVMBuildNot(LLVMBuilderRef, LLVMValueRef V, const char *Name);
836857
593593 unwrap(ConstantVal)));
594594 }
595595
596 LLVMValueRef LLVMConstNSWNeg(LLVMValueRef ConstantVal) {
597 return wrap(ConstantExpr::getNSWNeg(
598 unwrap(ConstantVal)));
599 }
600
601 LLVMValueRef LLVMConstNUWNeg(LLVMValueRef ConstantVal) {
602 return wrap(ConstantExpr::getNUWNeg(
603 unwrap(ConstantVal)));
604 }
605
606
596607 LLVMValueRef LLVMConstFNeg(LLVMValueRef ConstantVal) {
597608 return wrap(ConstantExpr::getFNeg(
598609 unwrap(ConstantVal)));
616627 unwrap(RHSConstant)));
617628 }
618629
630 LLVMValueRef LLVMConstNUWAdd(LLVMValueRef LHSConstant,
631 LLVMValueRef RHSConstant) {
632 return wrap(ConstantExpr::getNUWAdd(
633 unwrap(LHSConstant),
634 unwrap(RHSConstant)));
635 }
636
619637 LLVMValueRef LLVMConstFAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) {
620638 return wrap(ConstantExpr::getFAdd(
621639 unwrap(LHSConstant),
628646 unwrap(RHSConstant)));
629647 }
630648
649 LLVMValueRef LLVMConstNSWSub(LLVMValueRef LHSConstant,
650 LLVMValueRef RHSConstant) {
651 return wrap(ConstantExpr::getNSWSub(
652 unwrap(LHSConstant),
653 unwrap(RHSConstant)));
654 }
655
656 LLVMValueRef LLVMConstNUWSub(LLVMValueRef LHSConstant,
657 LLVMValueRef RHSConstant) {
658 return wrap(ConstantExpr::getNUWSub(
659 unwrap(LHSConstant),
660 unwrap(RHSConstant)));
661 }
662
631663 LLVMValueRef LLVMConstFSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) {
632664 return wrap(ConstantExpr::getFSub(unwrap(LHSConstant),
633665 unwrap(RHSConstant)));
637669 return wrap(ConstantExpr::getMul(
638670 unwrap(LHSConstant),
639671 unwrap(RHSConstant)));
672 }
673
674 LLVMValueRef LLVMConstNSWMul(LLVMValueRef LHSConstant,
675 LLVMValueRef RHSConstant) {
676 return wrap(ConstantExpr::getNSWMul(
677 unwrap(LHSConstant),
678 unwrap(RHSConstant)));
679 }
680
681 LLVMValueRef LLVMConstNUWMul(LLVMValueRef LHSConstant,
682 LLVMValueRef RHSConstant) {
683 return wrap(ConstantExpr::getNUWMul(
684 unwrap(LHSConstant),
685 unwrap(RHSConstant)));
640686 }
641687
642688 LLVMValueRef LLVMConstFMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) {
16271673 return wrap(unwrap(B)->CreateNSWAdd(unwrap(LHS), unwrap(RHS), Name));
16281674 }
16291675
1676 LLVMValueRef LLVMBuildNUWAdd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS,
1677 const char *Name) {
1678 return wrap(unwrap(B)->CreateNUWAdd(unwrap(LHS), unwrap(RHS), Name));
1679 }
1680
16301681 LLVMValueRef LLVMBuildFAdd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS,
16311682 const char *Name) {
16321683 return wrap(unwrap(B)->CreateFAdd(unwrap(LHS), unwrap(RHS), Name));
16371688 return wrap(unwrap(B)->CreateSub(unwrap(LHS), unwrap(RHS), Name));
16381689 }
16391690
1691 LLVMValueRef LLVMBuildNSWSub(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS,
1692 const char *Name) {
1693 return wrap(unwrap(B)->CreateNSWSub(unwrap(LHS), unwrap(RHS), Name));
1694 }
1695
1696 LLVMValueRef LLVMBuildNUWSub(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS,
1697 const char *Name) {
1698 return wrap(unwrap(B)->CreateNUWSub(unwrap(LHS), unwrap(RHS), Name));
1699 }
1700
16401701 LLVMValueRef LLVMBuildFSub(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS,
16411702 const char *Name) {
16421703 return wrap(unwrap(B)->CreateFSub(unwrap(LHS), unwrap(RHS), Name));
16451706 LLVMValueRef LLVMBuildMul(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS,
16461707 const char *Name) {
16471708 return wrap(unwrap(B)->CreateMul(unwrap(LHS), unwrap(RHS), Name));
1709 }
1710
1711 LLVMValueRef LLVMBuildNSWMul(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS,
1712 const char *Name) {
1713 return wrap(unwrap(B)->CreateNSWMul(unwrap(LHS), unwrap(RHS), Name));
1714 }
1715
1716 LLVMValueRef LLVMBuildNUWMul(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS,
1717 const char *Name) {
1718 return wrap(unwrap(B)->CreateNUWMul(unwrap(LHS), unwrap(RHS), Name));
16481719 }
16491720
16501721 LLVMValueRef LLVMBuildFMul(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS,
17261797
17271798 LLVMValueRef LLVMBuildNeg(LLVMBuilderRef B, LLVMValueRef V, const char *Name) {
17281799 return wrap(unwrap(B)->CreateNeg(unwrap(V), Name));
1800 }
1801
1802 LLVMValueRef LLVMBuildNSWNeg(LLVMBuilderRef B, LLVMValueRef V,
1803 const char *Name) {
1804 return wrap(unwrap(B)->CreateNSWNeg(unwrap(V), Name));
1805 }
1806
1807 LLVMValueRef LLVMBuildNUWNeg(LLVMBuilderRef B, LLVMValueRef V,
1808 const char *Name) {
1809 return wrap(unwrap(B)->CreateNUWNeg(unwrap(V), Name));
17291810 }
17301811
17311812 LLVMValueRef LLVMBuildFNeg(LLVMBuilderRef B, LLVMValueRef V, const char *Name) {
291291 group "union";
292292 let t = union_type context [| i1_type; i16_type; i64_type; double_type |] in
293293 let c = const_union t one in
294 ignore (define_global "Const_union" c m);
294 ignore (define_global "const_union" c m);
295295 insist (t = (type_of c));
296296
297297 (* RUN: grep {const_null.*zeroinit} < %t.ll
317317
318318 group "constant arithmetic";
319319 (* RUN: grep {@const_neg = global i64 sub} < %t.ll
320 * RUN: grep {@const_nsw_neg = global i64 sub nsw } < %t.ll
321 * RUN: grep {@const_nuw_neg = global i64 sub nuw } < %t.ll
322 * RUN: grep {@const_fneg = global double fsub } < %t.ll
320323 * RUN: grep {@const_not = global i64 xor } < %t.ll
321324 * RUN: grep {@const_add = global i64 add } < %t.ll
325 * RUN: grep {@const_nsw_add = global i64 add nsw } < %t.ll
326 * RUN: grep {@const_nuw_add = global i64 add nuw } < %t.ll
327 * RUN: grep {@const_fadd = global double fadd } < %t.ll
322328 * RUN: grep {@const_sub = global i64 sub } < %t.ll
329 * RUN: grep {@const_nsw_sub = global i64 sub nsw } < %t.ll
330 * RUN: grep {@const_nuw_sub = global i64 sub nuw } < %t.ll
331 * RUN: grep {@const_fsub = global double fsub } < %t.ll
323332 * RUN: grep {@const_mul = global i64 mul } < %t.ll
333 * RUN: grep {@const_nsw_mul = global i64 mul nsw } < %t.ll
334 * RUN: grep {@const_nuw_mul = global i64 mul nuw } < %t.ll
335 * RUN: grep {@const_fmul = global double fmul } < %t.ll
324336 * RUN: grep {@const_udiv = global i64 udiv } < %t.ll
325337 * RUN: grep {@const_sdiv = global i64 sdiv } < %t.ll
338 * RUN: grep {@const_exact_sdiv = global i64 sdiv exact } < %t.ll
326339 * RUN: grep {@const_fdiv = global double fdiv } < %t.ll
327340 * RUN: grep {@const_urem = global i64 urem } < %t.ll
328341 * RUN: grep {@const_srem = global i64 srem } < %t.ll
340353 let foldbomb = const_ptrtoint foldbomb_gv i64_type in
341354 let ffoldbomb = const_uitofp foldbomb double_type in
342355 ignore (define_global "const_neg" (const_neg foldbomb) m);
356 ignore (define_global "const_nsw_neg" (const_nsw_neg foldbomb) m);
357 ignore (define_global "const_nuw_neg" (const_nuw_neg foldbomb) m);
358 ignore (define_global "const_fneg" (const_fneg ffoldbomb) m);
343359 ignore (define_global "const_not" (const_not foldbomb) m);
344360 ignore (define_global "const_add" (const_add foldbomb five) m);
361 ignore (define_global "const_nsw_add" (const_nsw_add foldbomb five) m);
362 ignore (define_global "const_nuw_add" (const_nuw_add foldbomb five) m);
363 ignore (define_global "const_fadd" (const_fadd ffoldbomb ffive) m);
345364 ignore (define_global "const_sub" (const_sub foldbomb five) m);
365 ignore (define_global "const_nsw_sub" (const_nsw_sub foldbomb five) m);
366 ignore (define_global "const_nuw_sub" (const_nuw_sub foldbomb five) m);
367 ignore (define_global "const_fsub" (const_fsub ffoldbomb ffive) m);
346368 ignore (define_global "const_mul" (const_mul foldbomb five) m);
369 ignore (define_global "const_nsw_mul" (const_nsw_mul foldbomb five) m);
370 ignore (define_global "const_nuw_mul" (const_nuw_mul foldbomb five) m);
371 ignore (define_global "const_fmul" (const_fmul ffoldbomb ffive) m);
347372 ignore (define_global "const_udiv" (const_udiv foldbomb five) m);
348373 ignore (define_global "const_sdiv" (const_sdiv foldbomb five) m);
374 ignore (define_global "const_exact_sdiv" (const_exact_sdiv foldbomb five) m);
349375 ignore (define_global "const_fdiv" (const_fdiv ffoldbomb ffive) m);
350376 ignore (define_global "const_urem" (const_urem foldbomb five) m);
351377 ignore (define_global "const_srem" (const_srem foldbomb five) m);
901927 let b = builder_at_end context bb07 in
902928
903929 (* RUN: grep {%build_add = add i32 %P1, %P2} < %t.ll
930 * RUN: grep {%build_nsw_add = add nsw i32 %P1, %P2} < %t.ll
931 * RUN: grep {%build_nuw_add = add nuw i32 %P1, %P2} < %t.ll
932 * RUN: grep {%build_fadd = fadd float %F1, %F2} < %t.ll
904933 * RUN: grep {%build_sub = sub i32 %P1, %P2} < %t.ll
934 * RUN: grep {%build_nsw_sub = sub nsw i32 %P1, %P2} < %t.ll
935 * RUN: grep {%build_nuw_sub = sub nuw i32 %P1, %P2} < %t.ll
936 * RUN: grep {%build_fsub = fsub float %F1, %F2} < %t.ll
905937 * RUN: grep {%build_mul = mul i32 %P1, %P2} < %t.ll
938 * RUN: grep {%build_nsw_mul = mul nsw i32 %P1, %P2} < %t.ll
939 * RUN: grep {%build_nuw_mul = mul nuw i32 %P1, %P2} < %t.ll
940 * RUN: grep {%build_fmul = fmul float %F1, %F2} < %t.ll
906941 * RUN: grep {%build_udiv = udiv i32 %P1, %P2} < %t.ll
907942 * RUN: grep {%build_sdiv = sdiv i32 %P1, %P2} < %t.ll
943 * RUN: grep {%build_exact_sdiv = sdiv exact i32 %P1, %P2} < %t.ll
908944 * RUN: grep {%build_fdiv = fdiv float %F1, %F2} < %t.ll
909945 * RUN: grep {%build_urem = urem i32 %P1, %P2} < %t.ll
910946 * RUN: grep {%build_srem = srem i32 %P1, %P2} < %t.ll
916952 * RUN: grep {%build_or = or i32 %P1, %P2} < %t.ll
917953 * RUN: grep {%build_xor = xor i32 %P1, %P2} < %t.ll
918954 * RUN: grep {%build_neg = sub i32 0, %P1} < %t.ll
955 * RUN: grep {%build_nsw_neg = sub nsw i32 0, %P1} < %t.ll
956 * RUN: grep {%build_nuw_neg = sub nuw i32 0, %P1} < %t.ll
957 * RUN: grep {%build_fneg = fsub float .*0.*, %F1} < %t.ll
919958 * RUN: grep {%build_not = xor i32 %P1, -1} < %t.ll
920959 *)
921960 ignore (build_add p1 p2 "build_add" b);
961 ignore (build_nsw_add p1 p2 "build_nsw_add" b);
962 ignore (build_nuw_add p1 p2 "build_nuw_add" b);
963 ignore (build_fadd f1 f2 "build_fadd" b);
922964 ignore (build_sub p1 p2 "build_sub" b);
965 ignore (build_nsw_sub p1 p2 "build_nsw_sub" b);
966 ignore (build_nuw_sub p1 p2 "build_nuw_sub" b);
967 ignore (build_fsub f1 f2 "build_fsub" b);
923968 ignore (build_mul p1 p2 "build_mul" b);
969 ignore (build_nsw_mul p1 p2 "build_nsw_mul" b);
970 ignore (build_nuw_mul p1 p2 "build_nuw_mul" b);
971 ignore (build_fmul f1 f2 "build_fmul" b);
924972 ignore (build_udiv p1 p2 "build_udiv" b);
925973 ignore (build_sdiv p1 p2 "build_sdiv" b);
974 ignore (build_exact_sdiv p1 p2 "build_exact_sdiv" b);
926975 ignore (build_fdiv f1 f2 "build_fdiv" b);
927976 ignore (build_urem p1 p2 "build_urem" b);
928977 ignore (build_srem p1 p2 "build_srem" b);
934983 ignore (build_or p1 p2 "build_or" b);
935984 ignore (build_xor p1 p2 "build_xor" b);
936985 ignore (build_neg p1 "build_neg" b);
986 ignore (build_nsw_neg p1 "build_nsw_neg" b);
987 ignore (build_nuw_neg p1 "build_nuw_neg" b);
988 ignore (build_fneg f1 "build_fneg" b);
937989 ignore (build_not p1 "build_not" b);
938990 ignore (build_unreachable b)
939991 end;