27
27
#define TARGET_BUILTIN (ID, TYPE, ATTRS, FEATURE ) BUILTIN(ID, TYPE, ATTRS)
28
28
#endif
29
29
30
+ // Built-ins requiring custom code generation.
31
+ // Because these built-ins rely on target-dependent types and to avoid pervasive
32
+ // change, they are type checked manually in Sema using custom type descriptors.
33
+ // The first argument of the CUSTOM_BUILTIN macro is the name of the built-in
34
+ // with its prefix, the second argument is the name of the intrinsic this
35
+ // built-in generates, the third argument specifies the type of the function
36
+ // (result value, then each argument) as follows:
37
+ // i -> Unsigned integer followed by the greatest possible value for that
38
+ // argument or 0 if no constraint on the value.
39
+ // (e.g. i15 for a 4-bits value)
40
+ // V -> Vector type used with MMA built-ins (vector unsigned char)
41
+ // W -> PPC Vector type followed by the size of the vector type.
42
+ // (e.g. W512 for __vector_quad)
43
+ // any other descriptor -> Fall back to generic type descriptor decoding.
44
+ // The 'C' suffix can be used as a suffix to specify the const type.
45
+ // The '*' suffix can be used as a suffix to specify a pointer to a type.
46
+ // The fourth argument is set to true if the built-in accumulates its result
47
+ // into its given accumulator.
48
+
30
49
#ifndef CUSTOM_BUILTIN
31
50
#define CUSTOM_BUILTIN (ID, INTR, TYPES, ACCUMULATE, FEATURE ) \
32
51
TARGET_BUILTIN (__builtin_##ID, " i." , " t" , FEATURE)
33
52
#endif
34
53
54
+ // UNALIASED_CUSTOM_BUILTIN macro is used for built-ins that have
55
+ // the same name as that of the intrinsic they generate, i.e. the
56
+ // ID and INTR are the same.
57
+ // This avoids repeating the ID and INTR in the macro expression.
35
58
#define UNALIASED_CUSTOM_BUILTIN (ID, TYPES, ACCUMULATE, FEATURE ) \
36
59
CUSTOM_BUILTIN (ID, ID, TYPES, ACCUMULATE, FEATURE)
37
60
61
+ // UNALIASED_CUSTOM_MMA_BUILTIN macro is used for MMA built-ins and its
62
+ // corresponding 4 positive/negative multiply and positive/negative accumulate
63
+ // built-in with the same ID concated with posfix [nn|np|pn|pp].
64
+ // This avoids repeating the TYPES and FEATURE in the macro expression.
65
+ // eg.
66
+ // UNALIASED_CUSTOM_MMA_BUILTIN(mma_xvf16ger2, "vW512*VV",
67
+ // "mma,paired-vector-memops")
68
+ // Will generate built-ins:
69
+ // * __builtin_mma_xvf16ger2()
70
+ // * __builtin_mma_xvf16ger2nn()
71
+ // * __builtin_mma_xvf16ger2np()
72
+ // * __builtin_mma_xvf16ger2pn()
73
+ // * __builtin_mma_xvf16ger2nn()
74
+ // All with the same TYPES and FEATURE.
75
+ #define UNALIASED_CUSTOM_MMA_BUILTIN (ID, TYPES, FEATURE ) \
76
+ UNALIASED_CUSTOM_BUILTIN (ID, TYPES, false , FEATURE) \
77
+ UNALIASED_CUSTOM_BUILTIN(ID##nn, TYPES, true , FEATURE) \
78
+ UNALIASED_CUSTOM_BUILTIN(ID##np, TYPES, true , FEATURE) \
79
+ UNALIASED_CUSTOM_BUILTIN(ID##pn, TYPES, true , FEATURE) \
80
+ UNALIASED_CUSTOM_BUILTIN(ID##pp, TYPES, true , FEATURE)
81
+
38
82
// GCC predefined macros to rename builtins, undef them to keep original names.
39
83
#if defined(__GNUC__) && !defined(__clang__)
40
84
#undef __builtin_vsx_xvnmaddadp
@@ -967,25 +1011,6 @@ BUILTIN(__builtin_setflm, "dd", "")
967
1011
// Cache built-ins
968
1012
BUILTIN(__builtin_dcbf, " vvC*" , " " )
969
1013
970
- // Built-ins requiring custom code generation.
971
- // Because these built-ins rely on target-dependent types and to avoid pervasive
972
- // change, they are type checked manually in Sema using custom type descriptors.
973
- // The first argument of the CUSTOM_BUILTIN macro is the name of the built-in
974
- // with its prefix, the second argument is the name of the intrinsic this
975
- // built-in generates, the third argument specifies the type of the function
976
- // (result value, then each argument) as follows:
977
- // i -> Unsigned integer followed by the greatest possible value for that
978
- // argument or 0 if no constraint on the value.
979
- // (e.g. i15 for a 4-bits value)
980
- // V -> Vector type used with MMA built-ins (vector unsigned char)
981
- // W -> PPC Vector type followed by the size of the vector type.
982
- // (e.g. W512 for __vector_quad)
983
- // any other descriptor -> Fall back to generic type descriptor decoding.
984
- // The 'C' suffix can be used as a suffix to specify the const type.
985
- // The '*' suffix can be used as a suffix to specify a pointer to a type.
986
- // The fourth argument is set to true if the built-in accumulates its result into
987
- // its given accumulator.
988
-
989
1014
// Provided builtins with _mma_ prefix for compatibility.
990
1015
CUSTOM_BUILTIN(mma_lxvp, vsx_lxvp, " W256SLiW256C*" , false ,
991
1016
" paired-vector-memops" )
@@ -999,11 +1024,6 @@ CUSTOM_BUILTIN(vsx_build_pair, vsx_assemble_pair, "vW256*VV", false,
999
1024
" paired-vector-memops" )
1000
1025
CUSTOM_BUILTIN(mma_build_acc, mma_assemble_acc, " vW512*VVVV" , false , " mma" )
1001
1026
1002
- // UNALIASED_CUSTOM_BUILTIN macro is used for built-ins that have
1003
- // the same name as that of the intrinsic they generate, i.e. the
1004
- // ID and INTR are the same.
1005
- // This avoids repeating the ID and INTR in the macro expression.
1006
-
1007
1027
UNALIASED_CUSTOM_BUILTIN(vsx_lxvp, " W256SLiW256C*" , false ,
1008
1028
" paired-vector-memops" )
1009
1029
UNALIASED_CUSTOM_BUILTIN(vsx_stxvp, " vW256SLiW256*" , false ,
@@ -1032,12 +1052,6 @@ UNALIASED_CUSTOM_BUILTIN(mma_xvi16ger2, "vW512*VV", false,
1032
1052
" mma,paired-vector-memops" )
1033
1053
UNALIASED_CUSTOM_BUILTIN(mma_xvi16ger2s, " vW512*VV" , false ,
1034
1054
" mma,paired-vector-memops" )
1035
- UNALIASED_CUSTOM_BUILTIN(mma_xvf16ger2, " vW512*VV" , false ,
1036
- " mma,paired-vector-memops" )
1037
- UNALIASED_CUSTOM_BUILTIN(mma_xvf32ger, " vW512*VV" , false ,
1038
- " mma,paired-vector-memops" )
1039
- UNALIASED_CUSTOM_BUILTIN(mma_xvf64ger, " vW512*W256V" , false ,
1040
- " mma,paired-vector-memops" )
1041
1055
UNALIASED_CUSTOM_BUILTIN(mma_pmxvi4ger8, " vW512*VVi15i15i255" , false ,
1042
1056
" mma,paired-vector-memops" )
1043
1057
UNALIASED_CUSTOM_BUILTIN(mma_pmxvi8ger4, " vW512*VVi15i15i15" , false ,
@@ -1046,12 +1060,6 @@ UNALIASED_CUSTOM_BUILTIN(mma_pmxvi16ger2, "vW512*VVi15i15i3", false,
1046
1060
" mma,paired-vector-memops" )
1047
1061
UNALIASED_CUSTOM_BUILTIN(mma_pmxvi16ger2s, " vW512*VVi15i15i3" , false ,
1048
1062
" mma,paired-vector-memops" )
1049
- UNALIASED_CUSTOM_BUILTIN(mma_pmxvf16ger2, " vW512*VVi15i15i3" , false ,
1050
- " mma,paired-vector-memops" )
1051
- UNALIASED_CUSTOM_BUILTIN(mma_pmxvf32ger, " vW512*VVi15i15" , false ,
1052
- " mma,paired-vector-memops" )
1053
- UNALIASED_CUSTOM_BUILTIN(mma_pmxvf64ger, " vW512*W256Vi15i3" , false ,
1054
- " mma,paired-vector-memops" )
1055
1063
UNALIASED_CUSTOM_BUILTIN(mma_xvi4ger8pp, " vW512*VV" , true ,
1056
1064
" mma,paired-vector-memops" )
1057
1065
UNALIASED_CUSTOM_BUILTIN(mma_xvi8ger4pp, " vW512*VV" , true ,
@@ -1072,74 +1080,6 @@ UNALIASED_CUSTOM_BUILTIN(mma_pmxvi16ger2pp, "vW512*VVi15i15i3", true,
1072
1080
" mma,paired-vector-memops" )
1073
1081
UNALIASED_CUSTOM_BUILTIN(mma_pmxvi16ger2spp, " vW512*VVi15i15i3" , true ,
1074
1082
" mma,paired-vector-memops" )
1075
- UNALIASED_CUSTOM_BUILTIN(mma_xvf16ger2pp, " vW512*VV" , true ,
1076
- " mma,paired-vector-memops" )
1077
- UNALIASED_CUSTOM_BUILTIN(mma_xvf16ger2pn, " vW512*VV" , true ,
1078
- " mma,paired-vector-memops" )
1079
- UNALIASED_CUSTOM_BUILTIN(mma_xvf16ger2np, " vW512*VV" , true ,
1080
- " mma,paired-vector-memops" )
1081
- UNALIASED_CUSTOM_BUILTIN(mma_xvf16ger2nn, " vW512*VV" , true ,
1082
- " mma,paired-vector-memops" )
1083
- UNALIASED_CUSTOM_BUILTIN(mma_pmxvf16ger2pp, " vW512*VVi15i15i3" , true ,
1084
- " mma,paired-vector-memops" )
1085
- UNALIASED_CUSTOM_BUILTIN(mma_pmxvf16ger2pn, " vW512*VVi15i15i3" , true ,
1086
- " mma,paired-vector-memops" )
1087
- UNALIASED_CUSTOM_BUILTIN(mma_pmxvf16ger2np, " vW512*VVi15i15i3" , true ,
1088
- " mma,paired-vector-memops" )
1089
- UNALIASED_CUSTOM_BUILTIN(mma_pmxvf16ger2nn, " vW512*VVi15i15i3" , true ,
1090
- " mma,paired-vector-memops" )
1091
- UNALIASED_CUSTOM_BUILTIN(mma_xvf32gerpp, " vW512*VV" , true ,
1092
- " mma,paired-vector-memops" )
1093
- UNALIASED_CUSTOM_BUILTIN(mma_xvf32gerpn, " vW512*VV" , true ,
1094
- " mma,paired-vector-memops" )
1095
- UNALIASED_CUSTOM_BUILTIN(mma_xvf32gernp, " vW512*VV" , true ,
1096
- " mma,paired-vector-memops" )
1097
- UNALIASED_CUSTOM_BUILTIN(mma_xvf32gernn, " vW512*VV" , true ,
1098
- " mma,paired-vector-memops" )
1099
- UNALIASED_CUSTOM_BUILTIN(mma_pmxvf32gerpp, " vW512*VVi15i15" , true ,
1100
- " mma,paired-vector-memops" )
1101
- UNALIASED_CUSTOM_BUILTIN(mma_pmxvf32gerpn, " vW512*VVi15i15" , true ,
1102
- " mma,paired-vector-memops" )
1103
- UNALIASED_CUSTOM_BUILTIN(mma_pmxvf32gernp, " vW512*VVi15i15" , true ,
1104
- " mma,paired-vector-memops" )
1105
- UNALIASED_CUSTOM_BUILTIN(mma_pmxvf32gernn, " vW512*VVi15i15" , true ,
1106
- " mma,paired-vector-memops" )
1107
- UNALIASED_CUSTOM_BUILTIN(mma_xvf64gerpp, " vW512*W256V" , true ,
1108
- " mma,paired-vector-memops" )
1109
- UNALIASED_CUSTOM_BUILTIN(mma_xvf64gerpn, " vW512*W256V" , true ,
1110
- " mma,paired-vector-memops" )
1111
- UNALIASED_CUSTOM_BUILTIN(mma_xvf64gernp, " vW512*W256V" , true ,
1112
- " mma,paired-vector-memops" )
1113
- UNALIASED_CUSTOM_BUILTIN(mma_xvf64gernn, " vW512*W256V" , true ,
1114
- " mma,paired-vector-memops" )
1115
- UNALIASED_CUSTOM_BUILTIN(mma_pmxvf64gerpp, " vW512*W256Vi15i3" , true ,
1116
- " mma,paired-vector-memops" )
1117
- UNALIASED_CUSTOM_BUILTIN(mma_pmxvf64gerpn, " vW512*W256Vi15i3" , true ,
1118
- " mma,paired-vector-memops" )
1119
- UNALIASED_CUSTOM_BUILTIN(mma_pmxvf64gernp, " vW512*W256Vi15i3" , true ,
1120
- " mma,paired-vector-memops" )
1121
- UNALIASED_CUSTOM_BUILTIN(mma_pmxvf64gernn, " vW512*W256Vi15i3" , true ,
1122
- " mma,paired-vector-memops" )
1123
- UNALIASED_CUSTOM_BUILTIN(mma_xvbf16ger2, " vW512*VV" , false ,
1124
- " mma,paired-vector-memops" )
1125
- UNALIASED_CUSTOM_BUILTIN(mma_pmxvbf16ger2, " vW512*VVi15i15i3" , false ,
1126
- " mma,paired-vector-memops" )
1127
- UNALIASED_CUSTOM_BUILTIN(mma_xvbf16ger2pp, " vW512*VV" , true ,
1128
- " mma,paired-vector-memops" )
1129
- UNALIASED_CUSTOM_BUILTIN(mma_xvbf16ger2pn, " vW512*VV" , true ,
1130
- " mma,paired-vector-memops" )
1131
- UNALIASED_CUSTOM_BUILTIN(mma_xvbf16ger2np, " vW512*VV" , true ,
1132
- " mma,paired-vector-memops" )
1133
- UNALIASED_CUSTOM_BUILTIN(mma_xvbf16ger2nn, " vW512*VV" , true ,
1134
- " mma,paired-vector-memops" )
1135
- UNALIASED_CUSTOM_BUILTIN(mma_pmxvbf16ger2pp, " vW512*VVi15i15i3" , true ,
1136
- " mma,paired-vector-memops" )
1137
- UNALIASED_CUSTOM_BUILTIN(mma_pmxvbf16ger2pn, " vW512*VVi15i15i3" , true ,
1138
- " mma,paired-vector-memops" )
1139
- UNALIASED_CUSTOM_BUILTIN(mma_pmxvbf16ger2np, " vW512*VVi15i15i3" , true ,
1140
- " mma,paired-vector-memops" )
1141
- UNALIASED_CUSTOM_BUILTIN(mma_pmxvbf16ger2nn, " vW512*VVi15i15i3" , true ,
1142
- " mma,paired-vector-memops" )
1143
1083
UNALIASED_CUSTOM_BUILTIN(mma_dmxvi8gerx4, " vW1024*W256V" , false ,
1144
1084
" mma,paired-vector-memops" )
1145
1085
UNALIASED_CUSTOM_BUILTIN(mma_pmdmxvi8gerx4, " vW1024*W256Vi255i15i15" , false ,
@@ -1148,14 +1088,33 @@ UNALIASED_CUSTOM_BUILTIN(mma_dmxvi8gerx4pp, "vW1024*W256V", true,
1148
1088
" mma,paired-vector-memops" )
1149
1089
UNALIASED_CUSTOM_BUILTIN(mma_pmdmxvi8gerx4pp, " vW1024*W256Vi255i15i15" , true ,
1150
1090
" mma,paired-vector-memops" )
1151
- UNALIASED_CUSTOM_BUILTIN(mma_dmxvi8gerx4spp, " vW1024*W256V" , true ,
1091
+ UNALIASED_CUSTOM_BUILTIN(mma_dmxvi8gerx4spp, " vW1024*W256V" , true ,
1152
1092
" mma,paired-vector-memops" )
1153
1093
UNALIASED_CUSTOM_BUILTIN(mma_pmdmxvi8gerx4spp, " vW1024*W256Vi255i15i15" , true ,
1154
1094
" mma,paired-vector-memops" )
1155
1095
1096
+ // MMA builtins with positive/negative multiply/accumulate.
1097
+ UNALIASED_CUSTOM_MMA_BUILTIN(mma_xvf16ger2, " vW512*VV" ,
1098
+ " mma,paired-vector-memops" )
1099
+ UNALIASED_CUSTOM_MMA_BUILTIN(mma_xvf32ger, " vW512*VV" ,
1100
+ " mma,paired-vector-memops" )
1101
+ UNALIASED_CUSTOM_MMA_BUILTIN(mma_xvf64ger, " vW512*W256V" ,
1102
+ " mma,paired-vector-memops" )
1103
+ UNALIASED_CUSTOM_MMA_BUILTIN(mma_pmxvf16ger2, " vW512*VVi15i15i3" ,
1104
+ " mma,paired-vector-memops" )
1105
+ UNALIASED_CUSTOM_MMA_BUILTIN(mma_pmxvf32ger, " vW512*VVi15i15" ,
1106
+ " mma,paired-vector-memops" )
1107
+ UNALIASED_CUSTOM_MMA_BUILTIN(mma_pmxvf64ger, " vW512*W256Vi15i3" ,
1108
+ " mma,paired-vector-memops" )
1109
+ UNALIASED_CUSTOM_MMA_BUILTIN(mma_xvbf16ger2, " vW512*VV" ,
1110
+ " mma,paired-vector-memops" )
1111
+ UNALIASED_CUSTOM_MMA_BUILTIN(mma_pmxvbf16ger2, " vW512*VVi15i15i3" ,
1112
+ " mma,paired-vector-memops" )
1113
+
1156
1114
// FIXME: Obviously incomplete.
1157
1115
1158
1116
#undef BUILTIN
1159
1117
#undef TARGET_BUILTIN
1160
1118
#undef CUSTOM_BUILTIN
1161
1119
#undef UNALIASED_CUSTOM_BUILTIN
1120
+ #undef UNALIASED_CUSTOM_MMA_BUILTIN
0 commit comments