@@ -306,7 +306,7 @@ def IIT_TRUNC_ARG : IIT_Base<26>;
306306def IIT_ANYPTR : IIT_Base<27>;
307307def IIT_V1 : IIT_Vec<1, 28>;
308308def IIT_VARARG : IIT_VT<isVoid, 29>;
309- def IIT_HALF_VEC_ARG : IIT_Base<30>;
309+ def IIT_ONE_NTH_ELTS_VEC_ARG : IIT_Base<30>;
310310def IIT_SAME_VEC_WIDTH_ARG : IIT_Base<31>;
311311def IIT_VEC_OF_ANYPTRS_TO_ELT : IIT_Base<34>;
312312def IIT_I128 : IIT_Int<128, 35>;
@@ -335,14 +335,8 @@ def IIT_I4 : IIT_Int<4, 58>;
335335def IIT_AARCH64_SVCOUNT : IIT_VT<aarch64svcount, 59>;
336336def IIT_V6 : IIT_Vec<6, 60>;
337337def IIT_V10 : IIT_Vec<10, 61>;
338- def IIT_ONE_THIRD_VEC_ARG : IIT_Base<62>;
339- def IIT_ONE_FIFTH_VEC_ARG : IIT_Base<63>;
340- def IIT_ONE_SEVENTH_VEC_ARG : IIT_Base<64>;
341- def IIT_V2048: IIT_Vec<2048, 65>;
342- def IIT_V4096: IIT_Vec<4096, 66>;
343- def IIT_ONE_FOURTH_VEC_ARG : IIT_Base<67>;
344- def IIT_ONE_SIXTH_VEC_ARG : IIT_Base<68>;
345- def IIT_ONE_EIGHTH_VEC_ARG : IIT_Base<69>;
338+ def IIT_V2048: IIT_Vec<2048, 62>;
339+ def IIT_V4096: IIT_Vec<4096, 63>;
346340}
347341
348342defvar IIT_all_FixedTypes = !filter(iit, IIT_all,
@@ -479,27 +473,15 @@ class LLVMVectorOfAnyPointersToElt<int num>
479473class LLVMVectorElementType<int num> : LLVMMatchType<num, IIT_VEC_ELEMENT>;
480474
481475// Match the type of another intrinsic parameter that is expected to be a
482- // vector type, but change the element count to be half as many.
483- class LLVMHalfElementsVectorType<int num>
484- : LLVMMatchType<num, IIT_HALF_VEC_ARG>;
485-
486- class LLVMOneThirdElementsVectorType<int num>
487- : LLVMMatchType<num, IIT_ONE_THIRD_VEC_ARG>;
488-
489- class LLVMOneFourthElementsVectorType<int num>
490- : LLVMMatchType<num, IIT_ONE_FOURTH_VEC_ARG>;
491-
492- class LLVMOneFifthElementsVectorType<int num>
493- : LLVMMatchType<num, IIT_ONE_FIFTH_VEC_ARG>;
494-
495- class LLVMOneSixthElementsVectorType<int num>
496- : LLVMMatchType<num, IIT_ONE_SIXTH_VEC_ARG>;
497-
498- class LLVMOneSeventhElementsVectorType<int num>
499- : LLVMMatchType<num, IIT_ONE_SEVENTH_VEC_ARG>;
500-
501- class LLVMOneEighthElementsVectorType<int num>
502- : LLVMMatchType<num, IIT_ONE_EIGHTH_VEC_ARG>;
476+ // vector type, but change the element count to be 1/n of it.
477+ class LLVMOneNthElementsVectorType<int idx, int n>
478+ : LLVMMatchType<idx, IIT_ONE_NTH_ELTS_VEC_ARG> {
479+ let Sig = [
480+ IIT_ONE_NTH_ELTS_VEC_ARG.Number,
481+ EncNextArgN<idx>.ret,
482+ n,
483+ ];
484+ }
503485
504486// Match the type of another intrinsic parameter that is expected to be a
505487// vector type (i.e. <N x iM>) but with each element subdivided to
@@ -2771,118 +2753,15 @@ def int_vector_extract : DefaultAttrsIntrinsic<[llvm_anyvector_ty],
27712753 [llvm_anyvector_ty, llvm_i64_ty],
27722754 [IntrNoMem, IntrSpeculatable, ImmArg<ArgIndex<1>>]>;
27732755
2756+ foreach n = 2...8 in {
2757+ def int_vector_interleave#n : DefaultAttrsIntrinsic<[llvm_anyvector_ty],
2758+ !listsplat(LLVMOneNthElementsVectorType<0, n>, n),
2759+ [IntrNoMem]>;
27742760
2775- def int_vector_interleave2 : DefaultAttrsIntrinsic<[llvm_anyvector_ty],
2776- [LLVMHalfElementsVectorType<0>,
2777- LLVMHalfElementsVectorType<0>],
2778- [IntrNoMem]>;
2779-
2780- def int_vector_deinterleave2 : DefaultAttrsIntrinsic<[LLVMHalfElementsVectorType<0>,
2781- LLVMHalfElementsVectorType<0>],
2782- [llvm_anyvector_ty],
2783- [IntrNoMem]>;
2784-
2785- def int_vector_interleave3 : DefaultAttrsIntrinsic<[llvm_anyvector_ty],
2786- [LLVMOneThirdElementsVectorType<0>,
2787- LLVMOneThirdElementsVectorType<0>,
2788- LLVMOneThirdElementsVectorType<0>],
2789- [IntrNoMem]>;
2790-
2791- def int_vector_deinterleave3 : DefaultAttrsIntrinsic<[LLVMOneThirdElementsVectorType<0>,
2792- LLVMOneThirdElementsVectorType<0>,
2793- LLVMOneThirdElementsVectorType<0>],
2794- [llvm_anyvector_ty],
2795- [IntrNoMem]>;
2796-
2797- def int_vector_interleave4 : DefaultAttrsIntrinsic<[llvm_anyvector_ty],
2798- [LLVMOneFourthElementsVectorType<0>,
2799- LLVMOneFourthElementsVectorType<0>,
2800- LLVMOneFourthElementsVectorType<0>,
2801- LLVMOneFourthElementsVectorType<0>],
2802- [IntrNoMem]>;
2803-
2804- def int_vector_deinterleave4 : DefaultAttrsIntrinsic<[LLVMOneFourthElementsVectorType<0>,
2805- LLVMOneFourthElementsVectorType<0>,
2806- LLVMOneFourthElementsVectorType<0>,
2807- LLVMOneFourthElementsVectorType<0>],
2808- [llvm_anyvector_ty],
2809- [IntrNoMem]>;
2810-
2811- def int_vector_interleave5 : DefaultAttrsIntrinsic<[llvm_anyvector_ty],
2812- [LLVMOneFifthElementsVectorType<0>,
2813- LLVMOneFifthElementsVectorType<0>,
2814- LLVMOneFifthElementsVectorType<0>,
2815- LLVMOneFifthElementsVectorType<0>,
2816- LLVMOneFifthElementsVectorType<0>],
2817- [IntrNoMem]>;
2818-
2819- def int_vector_deinterleave5 : DefaultAttrsIntrinsic<[LLVMOneFifthElementsVectorType<0>,
2820- LLVMOneFifthElementsVectorType<0>,
2821- LLVMOneFifthElementsVectorType<0>,
2822- LLVMOneFifthElementsVectorType<0>,
2823- LLVMOneFifthElementsVectorType<0>],
2824- [llvm_anyvector_ty],
2825- [IntrNoMem]>;
2826-
2827- def int_vector_interleave6 : DefaultAttrsIntrinsic<[llvm_anyvector_ty],
2828- [LLVMOneSixthElementsVectorType<0>,
2829- LLVMOneSixthElementsVectorType<0>,
2830- LLVMOneSixthElementsVectorType<0>,
2831- LLVMOneSixthElementsVectorType<0>,
2832- LLVMOneSixthElementsVectorType<0>,
2833- LLVMOneSixthElementsVectorType<0>],
2834- [IntrNoMem]>;
2835-
2836- def int_vector_deinterleave6 : DefaultAttrsIntrinsic<[LLVMOneSixthElementsVectorType<0>,
2837- LLVMOneSixthElementsVectorType<0>,
2838- LLVMOneSixthElementsVectorType<0>,
2839- LLVMOneSixthElementsVectorType<0>,
2840- LLVMOneSixthElementsVectorType<0>,
2841- LLVMOneSixthElementsVectorType<0>],
2842- [llvm_anyvector_ty],
2843- [IntrNoMem]>;
2844-
2845- def int_vector_interleave7 : DefaultAttrsIntrinsic<[llvm_anyvector_ty],
2846- [LLVMOneSeventhElementsVectorType<0>,
2847- LLVMOneSeventhElementsVectorType<0>,
2848- LLVMOneSeventhElementsVectorType<0>,
2849- LLVMOneSeventhElementsVectorType<0>,
2850- LLVMOneSeventhElementsVectorType<0>,
2851- LLVMOneSeventhElementsVectorType<0>,
2852- LLVMOneSeventhElementsVectorType<0>],
2853- [IntrNoMem]>;
2854-
2855- def int_vector_deinterleave7 : DefaultAttrsIntrinsic<[LLVMOneSeventhElementsVectorType<0>,
2856- LLVMOneSeventhElementsVectorType<0>,
2857- LLVMOneSeventhElementsVectorType<0>,
2858- LLVMOneSeventhElementsVectorType<0>,
2859- LLVMOneSeventhElementsVectorType<0>,
2860- LLVMOneSeventhElementsVectorType<0>,
2861- LLVMOneSeventhElementsVectorType<0>],
2862- [llvm_anyvector_ty],
2863- [IntrNoMem]>;
2864-
2865- def int_vector_interleave8 : DefaultAttrsIntrinsic<[llvm_anyvector_ty],
2866- [LLVMOneEighthElementsVectorType<0>,
2867- LLVMOneEighthElementsVectorType<0>,
2868- LLVMOneEighthElementsVectorType<0>,
2869- LLVMOneEighthElementsVectorType<0>,
2870- LLVMOneEighthElementsVectorType<0>,
2871- LLVMOneEighthElementsVectorType<0>,
2872- LLVMOneEighthElementsVectorType<0>,
2873- LLVMOneEighthElementsVectorType<0>],
2874- [IntrNoMem]>;
2875-
2876- def int_vector_deinterleave8 : DefaultAttrsIntrinsic<[LLVMOneEighthElementsVectorType<0>,
2877- LLVMOneEighthElementsVectorType<0>,
2878- LLVMOneEighthElementsVectorType<0>,
2879- LLVMOneEighthElementsVectorType<0>,
2880- LLVMOneEighthElementsVectorType<0>,
2881- LLVMOneEighthElementsVectorType<0>,
2882- LLVMOneEighthElementsVectorType<0>,
2883- LLVMOneEighthElementsVectorType<0>],
2884- [llvm_anyvector_ty],
2885- [IntrNoMem]>;
2761+ def int_vector_deinterleave#n : DefaultAttrsIntrinsic<!listsplat(LLVMOneNthElementsVectorType<0, n>, n),
2762+ [llvm_anyvector_ty],
2763+ [IntrNoMem]>;
2764+ }
28862765
28872766//===-------------- Intrinsics to perform partial reduction ---------------===//
28882767
0 commit comments