File tree Expand file tree Collapse file tree 2 files changed +75
-0
lines changed Expand file tree Collapse file tree 2 files changed +75
-0
lines changed Original file line number Diff line number Diff line change @@ -1089,6 +1089,76 @@ get_dtype_from_tytype(TY_KIND ty)
10891089 }
10901090}
10911091
1092+ /* *
1093+ \brief Convert a <tt>nme</tt><i>*</i> to a <tt>DT_</tt><i>*</i> value
1094+
1095+ If the DT_ value can't be determined, returns <tt>DT_NONE</tt>.
1096+ */
1097+ DTYPE
1098+ get_dtype_for_vect_type_nme (int nme) {
1099+ DTYPE dtype = DT_NONE;
1100+ if (nme) {
1101+ SPTR sym = basesym_of (nme);
1102+ if (sym != SPTR_NULL) {
1103+ dtype = DTYPEG (sym);
1104+ assert (DTY (dtype) == TY_VECT, " Not a vect type" , dtype, ERR_Fatal);
1105+ switch (size_of (dtype)) {
1106+ case 1 :
1107+ dtype = DT_CHAR;
1108+ break ;
1109+ case 2 :
1110+ dtype = DT_SINT;
1111+ break ;
1112+ case 4 :
1113+ switch (DTySeqTyElement (dtype)) {
1114+ case DT_FLOAT:
1115+ dtype = DT_FLOAT;
1116+ break ;
1117+ default :
1118+ dtype = DT_INT;
1119+ }
1120+ break ;
1121+ case 8 :
1122+ switch (DTySeqTyElement (dtype)) {
1123+ case DT_FLOAT:
1124+ case DT_DBLE:
1125+ dtype = DT_DBLE;
1126+ break ;
1127+ default :
1128+ dtype = DT_INT8;
1129+ }
1130+ break ;
1131+ case 16 :
1132+ switch (DTySeqTyElement (dtype)) {
1133+ case DT_FLOAT:
1134+ dtype = DT_128F;
1135+ break ;
1136+ case DT_DBLE:
1137+ dtype = DT_128D;
1138+ break ;
1139+ default :
1140+ dtype = DT_128;
1141+ }
1142+ break ;
1143+ case 32 :
1144+ switch (DTySeqTyElement (dtype)) {
1145+ case DT_FLOAT:
1146+ dtype = DT_256F;
1147+ break ;
1148+ case DT_DBLE:
1149+ dtype = DT_256D;
1150+ break ;
1151+ default :
1152+ dtype = DT_256;
1153+ }
1154+ break ;
1155+ }
1156+ }
1157+ }
1158+
1159+ return dtype;
1160+ }
1161+
10921162/* *
10931163 \brief Get the function return type coprresponding to an IL_DFR* opcode.
10941164 */
Original file line number Diff line number Diff line change @@ -1062,6 +1062,11 @@ DTYPE get_dtype_from_arg_opc(ILI_OP opc);
10621062 */
10631063DTYPE get_dtype_from_tytype (TY_KIND ty );
10641064
1065+ /**
1066+ \brief ...
1067+ */
1068+ DTYPE get_dtype_for_vect_type_nme (int nme );
1069+
10651070/**
10661071 \brief ...
10671072 */
You can’t perform that action at this time.
0 commit comments