@@ -485,23 +485,16 @@ foreach name = ["half_cos",
485
485
"half_exp", "half_exp2", "half_exp10",
486
486
"half_log", "half_log2", "half_log10",
487
487
"half_recip", "half_rsqrt",
488
- "half_sin", "half_sqrt", "half_tan"] in {
489
- def : ConstOCLSPVBuiltin<name, [GenTypeFloatVecAndScalar, GenTypeFloatVecAndScalar]>;
490
- }
491
-
492
- foreach name = ["half_divide", "half_powr"] in {
493
- def : ConstOCLSPVBuiltin<name, [GenTypeFloatVecAndScalar, GenTypeFloatVecAndScalar, GenTypeFloatVecAndScalar]>;
494
- }
495
-
496
- foreach name = ["native_cos", "native_exp", "native_exp2", "native_exp10",
488
+ "half_sin", "half_sqrt", "half_tan",
489
+ "native_cos", "native_exp", "native_exp2", "native_exp10",
497
490
"native_log", "native_log2", "native_log10",
498
491
"native_recip", "native_rsqrt",
499
492
"native_sin", "native_sqrt", "native_tan"] in {
500
- def : ConstOCLSPVBuiltin<name, [FGenTypeN, FGenTypeN ]>;
493
+ def : ConstOCLSPVBuiltin<name, [GenTypeFloatVecAndScalar, GenTypeFloatVecAndScalar ]>;
501
494
}
502
495
503
- foreach name = ["native_divide", "native_powr"] in {
504
- def : ConstOCLSPVBuiltin<name, [FGenTypeN, FGenTypeN, FGenTypeN ]>;
496
+ foreach name = ["half_divide", "half_powr", " native_divide", "native_powr"] in {
497
+ def : ConstOCLSPVBuiltin<name, [GenTypeFloatVecAndScalar, GenTypeFloatVecAndScalar, GenTypeFloatVecAndScalar ]>;
505
498
}
506
499
507
500
// 2.2. Integer instructions
@@ -635,20 +628,22 @@ foreach VSize = [2, 3, 4, 8, 16] in {
635
628
}
636
629
}
637
630
foreach name = ["vloada_halfn", "vload_halfn"] in {
638
- def : OCLSPVBuiltin<name, [VectorType<Float, VSize>, Size, PointerType<ConstType<Half>, AS>]>;
631
+ def : OCLSPVBuiltin<name # "_Rfloat" # VSize , [VectorType<Float, VSize>, Size, PointerType<ConstType<Half>, AS>]>;
639
632
}
640
633
}
641
634
foreach AS = [GlobalAS, LocalAS, PrivateAS, GenericAS, DefaultAS] in {
642
635
foreach Ty = TLAll.List in {
643
636
foreach name = ["vstoren"] in {
644
- def : OCLSPVBuiltin<name, [Void, VectorType<Ty, VSize>, Size, PointerType<ConstType<Ty> , AS>]>;
637
+ def : OCLSPVBuiltin<name, [Void, VectorType<Ty, VSize>, Size, PointerType<Ty , AS>]>;
645
638
}
646
639
}
647
- foreach rnd = ["", "_rte", "_rtz", "_rtp", "_rtn"] in {
648
- foreach name = ["vstore_halfn" # rnd, "vstorea_halfn" # rnd] in {
649
- def : OCLSPVBuiltin<name, [Void, VectorType<Float, VSize>, Size, PointerType<Half, AS>]>;
650
- def : OCLSPVBuiltin<name, [Void, VectorType<Double, VSize>, Size, PointerType<Half, AS>]>;
651
- }
640
+ foreach name = ["vstore_halfn", "vstorea_halfn"] in {
641
+ def : OCLSPVBuiltin<name, [Void, VectorType<Float, VSize>, Size, PointerType<Half, AS>]>;
642
+ def : OCLSPVBuiltin<name, [Void, VectorType<Double, VSize>, Size, PointerType<Half, AS>]>;
643
+ }
644
+ foreach name = ["vstore_halfn_r", "vstorea_halfn_r"] in {
645
+ def : OCLSPVBuiltin<name, [Void, VectorType<Float, VSize>, Size, PointerType<Half, AS>, UInt]>;
646
+ def : OCLSPVBuiltin<name, [Void, VectorType<Double, VSize>, Size, PointerType<Half, AS>, UInt]>;
652
647
}
653
648
}
654
649
}
@@ -660,11 +655,13 @@ foreach AS = [GlobalAS, LocalAS, PrivateAS, ConstantAS, GenericAS, DefaultAS] in
660
655
}
661
656
662
657
foreach AS = [GlobalAS, LocalAS, PrivateAS, GenericAS, DefaultAS] in {
663
- foreach rnd = ["", "_rte", "_rtz", "_rtp", "_rtn"] in {
664
- foreach name = ["vstore_half" # rnd] in {
665
- def : OCLSPVBuiltin<name, [Void, Float, Size, PointerType<Half, AS>]>;
666
- def : OCLSPVBuiltin<name, [Void, Double, Size, PointerType<Half, AS>]>;
667
- }
658
+ foreach name = ["vstore_half"] in {
659
+ def : OCLSPVBuiltin<name, [Void, Float, Size, PointerType<Half, AS>]>;
660
+ def : OCLSPVBuiltin<name, [Void, Double, Size, PointerType<Half, AS>]>;
661
+ }
662
+ foreach name = ["vstore_half_r"] in {
663
+ def : OCLSPVBuiltin<name, [Void, Float, Size, PointerType<Half, AS>, UInt]>;
664
+ def : OCLSPVBuiltin<name, [Void, Double, Size, PointerType<Half, AS>, UInt]>;
668
665
}
669
666
}
670
667
@@ -710,72 +707,79 @@ foreach name = ["GenericPtrMemSemantics"] in {
710
707
}
711
708
712
709
// 3.32.11. Conversion Instructions
713
-
714
- foreach IType = [UChar, UShort, UInt, ULong] in {
715
- foreach FType = [Float, Double, Half] in {
716
- def : SPVBuiltin<"ConvertUToF_R" # FType.Name, [FType, IType], Attr.Const>;
717
- foreach rnd = ["", "_rte", "_rtz", "_rtp", "_rtn"] in {
718
- def : SPVBuiltin<"ConvertFToU_R" # IType.Name # rnd, [IType, FType], Attr.Const>;
719
- }
720
- foreach v = [2, 3, 4, 8, 16] in {
721
- def : SPVBuiltin<"ConvertFToU_R" # IType.Name # v,
722
- [VectorType<IType, v>, VectorType<FType, v>],
723
- Attr.Const>;
724
- def : SPVBuiltin<"ConvertUToF_R" # FType.Name # v,
725
- [VectorType<FType, v>, VectorType<IType, v>],
726
- Attr.Const>;
727
- }
728
- }
729
- }
730
-
731
- foreach IType = [Char, Short, Int, Long] in {
732
- foreach FType = [Float, Double, Half] in {
733
- def : SPVBuiltin<"ConvertSToF_R" # FType.Name, [FType, IType], Attr.Const>;
734
- foreach rnd = ["", "_rte", "_rtz", "_rtp", "_rtn"] in {
735
- def : SPVBuiltin<"ConvertFToS_R" # IType.Name # rnd, [IType, FType], Attr.Const>;
736
- }
737
- foreach v = [2, 3, 4, 8, 16] in {
738
- def : SPVBuiltin<"ConvertFToS_R" # IType.Name # v,
739
- [VectorType<IType, v>, VectorType<FType, v>],
740
- Attr.Const>;
741
- def : SPVBuiltin<"ConvertSToF_R" # FType.Name # v,
742
- [VectorType<FType, v>, VectorType<IType, v>],
743
- Attr.Const>;
710
+ foreach rnd = ["", "_rte", "_rtn", "_rtp", "_rtz"] in {
711
+ foreach IType = TLUnsignedInts.List in {
712
+ foreach FType = TLFloat.List in {
713
+ foreach sat = ["", "_sat"] in {
714
+ def : SPVBuiltin<"ConvertFToU_R" # IType.Name # sat # rnd, [IType, FType], Attr.Const>;
715
+ }
716
+ def : SPVBuiltin<"ConvertUToF_R" # FType.Name # rnd, [FType, IType], Attr.Const>;
717
+ foreach v = [2, 3, 4, 8, 16] in {
718
+ foreach sat = ["", "_sat"] in {
719
+ def : SPVBuiltin<"ConvertFToU_R" # IType.Name # v # sat # rnd,
720
+ [VectorType<IType, v>, VectorType<FType, v>],
721
+ Attr.Const>;
722
+ }
723
+ def : SPVBuiltin<"ConvertUToF_R" # FType.Name # v # rnd,
724
+ [VectorType<FType, v>, VectorType<IType, v>],
725
+ Attr.Const>;
726
+ }
744
727
}
745
728
}
746
- }
747
729
748
- foreach InType = TLAll.List in {
749
- foreach OutType = TLUnsignedInts.List in {
750
- if !ne(OutType.ElementSize, InType.ElementSize) then {
751
- def : SPVBuiltin<"UConvert_R" # OutType.Name, [OutType, InType], Attr.Const>;
730
+ foreach IType = TLSignedInts.List in {
731
+ foreach FType = TLFloat.List in {
732
+ foreach sat = ["", "_sat"] in {
733
+ def : SPVBuiltin<"ConvertFToS_R" # IType.Name # sat # rnd, [IType, FType], Attr.Const>;
734
+ }
735
+ def : SPVBuiltin<"ConvertSToF_R" # FType.Name # rnd, [FType, IType], Attr.Const>;
752
736
foreach v = [2, 3, 4, 8, 16] in {
753
- def : SPVBuiltin<"UConvert_R" # OutType.Name # v,
754
- [VectorType<OutType, v>, VectorType<InType, v>],
737
+ foreach sat = ["", "_sat"] in {
738
+ def : SPVBuiltin<"ConvertFToS_R" # IType.Name # v # sat # rnd,
739
+ [VectorType<IType, v>, VectorType<FType, v>],
740
+ Attr.Const>;
741
+ }
742
+ def : SPVBuiltin<"ConvertSToF_R" # FType.Name # v # rnd,
743
+ [VectorType<FType, v>, VectorType<IType, v>],
755
744
Attr.Const>;
756
745
}
757
746
}
758
747
}
759
- foreach OutType = TLSignedInts.List in {
760
- if !ne(OutType.ElementSize, InType.ElementSize) then {
761
- def : SPVBuiltin<"SConvert_R" # OutType.Name, [OutType, InType], Attr.Const>;
762
- foreach v = [2, 3, 4, 8, 16] in {
763
- def : SPVBuiltin<"SConvert_R" # OutType.Name # v,
764
- [VectorType<OutType, v>, VectorType<InType, v>],
765
- Attr.Const>;
748
+
749
+ foreach InType = TLFloat.List in {
750
+ foreach OutType = TLFloat.List in {
751
+ if !ne(OutType.ElementSize, InType.ElementSize) then {
752
+ def : SPVBuiltin<"FConvert_R" # OutType.Name # rnd, [OutType, InType], Attr.Const>;
753
+ foreach v = [2, 3, 4, 8, 16] in {
754
+ def : SPVBuiltin<"FConvert_R" # OutType.Name # v # rnd,
755
+ [VectorType<OutType, v>, VectorType<InType, v>],
756
+ Attr.Const>;
757
+ }
766
758
}
767
759
}
768
760
}
769
761
}
770
762
771
- foreach InType = TLFloat.List in {
772
- foreach OutType = TLFloat.List in {
773
- if !ne(OutType.ElementSize, InType.ElementSize) then {
774
- def : SPVBuiltin<"FConvert_R" # OutType.Name, [OutType, InType], Attr.Const>;
775
- foreach v = [2, 3, 4, 8, 16] in {
776
- def : SPVBuiltin<"FConvert_R" # OutType.Name # v,
777
- [VectorType<OutType, v>, VectorType<InType, v>],
778
- Attr.Const>;
763
+ foreach sat = ["", "_sat"] in {
764
+ foreach InType = TLAllInts.List in {
765
+ foreach OutType = TLUnsignedInts.List in {
766
+ if !ne(OutType.ElementSize, InType.ElementSize) then {
767
+ def : SPVBuiltin<"UConvert_R" # OutType.Name # sat, [OutType, InType], Attr.Const>;
768
+ foreach v = [2, 3, 4, 8, 16] in {
769
+ def : SPVBuiltin<"UConvert_R" # OutType.Name # v # sat,
770
+ [VectorType<OutType, v>, VectorType<InType, v>],
771
+ Attr.Const>;
772
+ }
773
+ }
774
+ }
775
+ foreach OutType = TLSignedInts.List in {
776
+ if !ne(OutType.ElementSize, InType.ElementSize) then {
777
+ def : SPVBuiltin<"SConvert_R" # OutType.Name # sat, [OutType, InType], Attr.Const>;
778
+ foreach v = [2, 3, 4, 8, 16] in {
779
+ def : SPVBuiltin<"SConvert_R" # OutType.Name # v # sat,
780
+ [VectorType<OutType, v>, VectorType<InType, v>],
781
+ Attr.Const>;
782
+ }
779
783
}
780
784
}
781
785
}
@@ -809,7 +813,7 @@ foreach AS = [GlobalAS, LocalAS, PrivateAS] in {
809
813
810
814
foreach Type = TLFloat.List in {
811
815
foreach v = [2, 3, 4, 8, 16] in {
812
- def : SPVBuiltin<"VectorTimesScalar", [VectorType<Type, v>, VectorType<Type, v>, Type]>;
816
+ def : SPVBuiltin<"VectorTimesScalar", [VectorType<Type, v>, VectorType<Type, v>, Type], Attr.Const >;
813
817
}
814
818
}
815
819
@@ -820,7 +824,6 @@ foreach name = ["Dot"] in {
820
824
}
821
825
822
826
foreach name = ["Any", "All"] in {
823
- def : SPVBuiltin<name, [Bool, Bool], Attr.Const>;
824
827
def : SPVBuiltin<name, [Bool, GenTypeSCharVecNoScalar], Attr.Const>;
825
828
}
826
829
0 commit comments