74 if (Name==
"ssse3.pabs.b.128" ||
75 Name==
"ssse3.pabs.w.128" ||
76 Name==
"ssse3.pabs.d.128" ||
101 Name ==
"sse.sqrt.ss" ||
102 Name ==
"sse2.sqrt.sd" ||
115 Name ==
"avx2.vperm2i128" ||
116 Name ==
"sse.add.ss" ||
117 Name ==
"sse2.add.sd" ||
118 Name ==
"sse.sub.ss" ||
119 Name ==
"sse2.sub.sd" ||
120 Name ==
"sse.mul.ss" ||
121 Name ==
"sse2.mul.sd" ||
122 Name ==
"sse.div.ss" ||
123 Name ==
"sse2.div.sd" ||
124 Name ==
"sse41.pmaxsb" ||
125 Name ==
"sse2.pmaxs.w" ||
126 Name ==
"sse41.pmaxsd" ||
127 Name ==
"sse2.pmaxu.b" ||
128 Name ==
"sse41.pmaxuw" ||
129 Name ==
"sse41.pmaxud" ||
130 Name ==
"sse41.pminsb" ||
131 Name ==
"sse2.pmins.w" ||
132 Name ==
"sse41.pminsd" ||
133 Name ==
"sse2.pminu.b" ||
134 Name ==
"sse41.pminuw" ||
135 Name ==
"sse41.pminud" ||
136 Name ==
"avx512.kand.w" ||
137 Name ==
"avx512.kandn.w" ||
138 Name ==
"avx512.knot.w" ||
139 Name ==
"avx512.kor.w" ||
140 Name ==
"avx512.kxor.w" ||
141 Name ==
"avx512.kxnor.w" ||
142 Name ==
"avx512.kortestc.w" ||
143 Name ==
"avx512.kortestz.w" ||
182 Name ==
"avx512.mask.cvtudq2ps.128" ||
183 Name ==
"avx512.mask.cvtudq2ps.256" ||
184 Name ==
"avx512.mask.cvtqq2pd.128" ||
185 Name ==
"avx512.mask.cvtqq2pd.256" ||
186 Name ==
"avx512.mask.cvtuqq2pd.128" ||
187 Name ==
"avx512.mask.cvtuqq2pd.256" ||
188 Name ==
"avx512.mask.cvtdq2ps.128" ||
189 Name ==
"avx512.mask.cvtdq2ps.256" ||
190 Name ==
"avx512.mask.cvtpd2dq.256" ||
191 Name ==
"avx512.mask.cvtpd2ps.256" ||
192 Name ==
"avx512.mask.cvttpd2dq.256" ||
193 Name ==
"avx512.mask.cvttps2dq.128" ||
194 Name ==
"avx512.mask.cvttps2dq.256" ||
195 Name ==
"avx512.mask.cvtps2pd.128" ||
196 Name ==
"avx512.mask.cvtps2pd.256" ||
197 Name ==
"avx512.cvtusi2sd" ||
200 Name ==
"sse2.pmulu.dq" ||
201 Name ==
"sse41.pmuldq" ||
202 Name ==
"avx2.pmulu.dq" ||
203 Name ==
"avx2.pmul.dq" ||
204 Name ==
"avx512.pmulu.dq.512" ||
205 Name ==
"avx512.pmul.dq.512" ||
256 Name.
startswith(
"avx512.maskz.vpermt2var.") ||
279 Name ==
"sse.cvtsi2ss" ||
280 Name ==
"sse.cvtsi642ss" ||
281 Name ==
"sse2.cvtsi2sd" ||
282 Name ==
"sse2.cvtsi642sd" ||
283 Name ==
"sse2.cvtss2sd" ||
284 Name ==
"sse2.cvtdq2pd" ||
285 Name ==
"sse2.cvtdq2ps" ||
286 Name ==
"sse2.cvtps2pd" ||
287 Name ==
"avx.cvtdq2.pd.256" ||
288 Name ==
"avx.cvtdq2.ps.256" ||
289 Name ==
"avx.cvt.ps2.pd.256" ||
291 Name ==
"avx2.vinserti128" ||
294 Name ==
"avx2.vextracti128" ||
299 Name ==
"sse41.movntdqa" ||
300 Name ==
"avx2.movntdqa" ||
301 Name ==
"avx512.movntdqa" ||
302 Name ==
"sse2.storel.dq" ||
312 Name ==
"avx512.mask.store.ss" ||
315 Name.
startswith(
"avx512.mask.expand.load.") ||
316 Name.
startswith(
"avx512.mask.compress.store.") ||
317 Name ==
"sse42.crc32.64.8" ||
328 Name ==
"sse41.pblendw" ||
331 Name ==
"avx2.pblendw" ||
334 Name ==
"avx2.vbroadcasti128" ||
337 Name ==
"xop.vpcmov" ||
338 Name ==
"xop.vpcmov.256" ||
368 if (Name.
substr(11) ==
"c")
370 if (Name.
substr(11) ==
"z")
372 if (Name.
substr(11) ==
"nzc")
377 if (Name ==
"sse41.insertps")
380 if (Name ==
"sse41.dppd")
383 if (Name ==
"sse41.dpps")
386 if (Name ==
"sse41.mpsadbw")
389 if (Name ==
"avx.dp.ps.256")
392 if (Name ==
"avx2.mpsadbw")
400 Intrinsic::x86_xop_vfrcz_ss);
406 Intrinsic::x86_xop_vfrcz_sd);
412 if (Idx->isFPOrFPVectorTy()) {
414 unsigned IdxSize = Idx->getPrimitiveSizeInBits();
415 unsigned EltSize = Idx->getScalarSizeInBits();
417 if (EltSize == 64 && IdxSize == 128)
418 Permil2ID = Intrinsic::x86_xop_vpermil2pd;
419 else if (EltSize == 32 && IdxSize == 128)
420 Permil2ID = Intrinsic::x86_xop_vpermil2ps;
421 else if (EltSize == 64 && IdxSize == 256)
422 Permil2ID = Intrinsic::x86_xop_vpermil2pd_256;
424 Permil2ID = Intrinsic::x86_xop_vpermil2ps_256;
434 assert(F &&
"Illegal to upgrade a non-existent Function.");
468 Regex vldRegex(
"^arm\\.neon\\.vld([1234]|[234]lane)\\.v[a-z0-9]*$");
469 if (vldRegex.
match(Name)) {
476 "llvm." + Name +
".p0i8", F->
getParent());
479 Regex vstRegex(
"^arm\\.neon\\.vst([1234]|[234]lane)\\.v[a-z0-9]*$");
480 if (vstRegex.
match(Name)) {
481 static const Intrinsic::ID StoreInts[] = {Intrinsic::arm_neon_vst1,
482 Intrinsic::arm_neon_vst2,
483 Intrinsic::arm_neon_vst3,
484 Intrinsic::arm_neon_vst4};
487 Intrinsic::arm_neon_vst2lane, Intrinsic::arm_neon_vst3lane,
488 Intrinsic::arm_neon_vst4lane
492 Type *Tys[] = {fArgs[0], fArgs[1]};
495 StoreInts[fArgs.size() - 3], Tys);
498 StoreLaneInts[fArgs.size() - 5], Tys);
501 if (Name ==
"aarch64.thread.pointer" || Name ==
"arm.thread.pointer") {
524 if (Name ==
"dbg.value" && F->
arg_size() == 4) {
533 bool IsLifetimeStart = Name.
startswith(
"lifetime.start");
534 if (IsLifetimeStart || Name.
startswith(
"invariant.start")) {
536 Intrinsic::lifetime_start : Intrinsic::invariant_start;
546 bool IsLifetimeEnd = Name.
startswith(
"lifetime.end");
547 if (IsLifetimeEnd || Name.
startswith(
"invariant.end")) {
549 Intrinsic::lifetime_end : Intrinsic::invariant_end;
552 Type* ObjectPtr[1] = {
Args[IsLifetimeEnd ? 1 : 2]};
559 if (Name.
startswith(
"invariant.group.barrier")) {
565 Intrinsic::launder_invariant_group, ObjectPtr);
578 Intrinsic::masked_load,
589 Intrinsic::masked_store,
601 Intrinsic::masked_gather, Tys);
611 Intrinsic::masked_scatter, Tys);
638 Type *ParamTypes[2] = {
654 .Cases(
"brev32",
"brev64", Intrinsic::bitreverse)
655 .
Case(
"clz.i", Intrinsic::ctlz)
656 .
Case(
"popc.i", Intrinsic::ctpop)
669 .Cases(
"abs.i",
"abs.ll",
true)
670 .
Cases(
"clz.ll",
"popc.ll",
"h2f",
true)
671 .
Cases(
"max.i",
"max.ll",
"max.ui",
"max.ull",
true)
672 .
Cases(
"min.i",
"min.ll",
"min.ui",
"min.ull",
true)
697 if (Name ==
"stackprotectorcheck") {
710 NewFn =
Result.getValue();
724 assert(F != NewFn &&
"Intrinsic function upgraded to the same function");
758 for (
unsigned l = 0; l != NumElts; l += 16)
759 for (
unsigned i = 0; i != 16; ++i) {
760 unsigned Idx = NumElts + i - Shift;
763 Idxs[l + i] = Idx + l;
792 for (
unsigned l = 0; l != NumElts; l += 16)
793 for (
unsigned i = 0; i != 16; ++i) {
794 unsigned Idx = i + Shift;
797 Idxs[l + i] = Idx + l;
817 for (
unsigned i = 0; i != NumElts; ++i)
830 if (
const auto *
C = dyn_cast<Constant>(Mask))
831 if (
C->isAllOnesValue())
841 if (
const auto *
C = dyn_cast<Constant>(Mask))
842 if (
C->isAllOnesValue())
860 unsigned ShiftVal = cast<llvm::ConstantInt>(Shift)->getZExtValue();
863 assert((IsVALIGN || NumElts % 16 == 0) &&
"Illegal NumElts for PALIGNR!");
864 assert((!IsVALIGN || NumElts <= 16) &&
"NumElts too large for VALIGN!");
869 ShiftVal &= (NumElts - 1);
886 for (
unsigned l = 0; l < NumElts; l += 16) {
887 for (
unsigned i = 0; i != 16; ++i) {
888 unsigned Idx = ShiftVal + i;
889 if (!IsVALIGN && Idx >= 16)
891 Indices[l + i] = Idx + l;
912 if (
const auto *
C = dyn_cast<Constant>(Mask))
913 if (
C->isAllOnesValue())
932 if (
const auto *
C = dyn_cast<Constant>(Mask))
933 if (
C->isAllOnesValue())
1004 if (!
C || !
C->isAllOnesValue())
1010 for (
unsigned i = 0; i != NumElts; ++i)
1012 for (
unsigned i = NumElts; i != 8; ++i)
1013 Indices[i] = NumElts + i % NumElts;
1022 unsigned CC,
bool Signed) {
1029 }
else if (CC == 7) {
1079 return Builder.
CreateSExt(Mask, ReturnOp,
"vpmovm2");
1091 if (VecWidth == 128 && EltWidth == 32)
1092 IID = Intrinsic::x86_sse_max_ps;
1093 else if (VecWidth == 128 && EltWidth == 64)
1094 IID = Intrinsic::x86_sse2_max_pd;
1095 else if (VecWidth == 256 && EltWidth == 32)
1096 IID = Intrinsic::x86_avx_max_ps_256;
1097 else if (VecWidth == 256 && EltWidth == 64)
1098 IID = Intrinsic::x86_avx_max_pd_256;
1102 if (VecWidth == 128 && EltWidth == 32)
1103 IID = Intrinsic::x86_sse_min_ps;
1104 else if (VecWidth == 128 && EltWidth == 64)
1105 IID = Intrinsic::x86_sse2_min_pd;
1106 else if (VecWidth == 256 && EltWidth == 32)
1107 IID = Intrinsic::x86_avx_min_ps_256;
1108 else if (VecWidth == 256 && EltWidth == 64)
1109 IID = Intrinsic::x86_avx_min_pd_256;
1113 if (VecWidth == 128)
1114 IID = Intrinsic::x86_ssse3_pshuf_b_128;
1115 else if (VecWidth == 256)
1116 IID = Intrinsic::x86_avx2_pshuf_b;
1117 else if (VecWidth == 512)
1118 IID = Intrinsic::x86_avx512_pshuf_b_512;
1122 if (VecWidth == 128)
1123 IID = Intrinsic::x86_ssse3_pmul_hr_sw_128;
1124 else if (VecWidth == 256)
1125 IID = Intrinsic::x86_avx2_pmul_hr_sw;
1126 else if (VecWidth == 512)
1127 IID = Intrinsic::x86_avx512_pmul_hr_sw_512;
1131 if (VecWidth == 128)
1132 IID = Intrinsic::x86_sse2_pmulh_w;
1133 else if (VecWidth == 256)
1134 IID = Intrinsic::x86_avx2_pmulh_w;
1135 else if (VecWidth == 512)
1136 IID = Intrinsic::x86_avx512_pmulh_w_512;
1140 if (VecWidth == 128)
1141 IID = Intrinsic::x86_sse2_pmulhu_w;
1142 else if (VecWidth == 256)
1143 IID = Intrinsic::x86_avx2_pmulhu_w;
1144 else if (VecWidth == 512)
1145 IID = Intrinsic::x86_avx512_pmulhu_w_512;
1149 if (VecWidth == 128)
1150 IID = Intrinsic::x86_sse2_pmadd_wd;
1151 else if (VecWidth == 256)
1152 IID = Intrinsic::x86_avx2_pmadd_wd;
1153 else if (VecWidth == 512)
1154 IID = Intrinsic::x86_avx512_pmaddw_d_512;
1158 if (VecWidth == 128)
1159 IID = Intrinsic::x86_ssse3_pmadd_ub_sw_128;
1160 else if (VecWidth == 256)
1161 IID = Intrinsic::x86_avx2_pmadd_ub_sw;
1162 else if (VecWidth == 512)
1163 IID = Intrinsic::x86_avx512_pmaddubs_w_512;
1167 if (VecWidth == 128)
1168 IID = Intrinsic::x86_sse2_packsswb_128;
1169 else if (VecWidth == 256)
1170 IID = Intrinsic::x86_avx2_packsswb;
1171 else if (VecWidth == 512)
1172 IID = Intrinsic::x86_avx512_packsswb_512;
1176 if (VecWidth == 128)
1177 IID = Intrinsic::x86_sse2_packssdw_128;
1178 else if (VecWidth == 256)
1179 IID = Intrinsic::x86_avx2_packssdw;
1180 else if (VecWidth == 512)
1181 IID = Intrinsic::x86_avx512_packssdw_512;
1185 if (VecWidth == 128)
1186 IID = Intrinsic::x86_sse2_packuswb_128;
1187 else if (VecWidth == 256)
1188 IID = Intrinsic::x86_avx2_packuswb;
1189 else if (VecWidth == 512)
1190 IID = Intrinsic::x86_avx512_packuswb_512;
1194 if (VecWidth == 128)
1195 IID = Intrinsic::x86_sse41_packusdw;
1196 else if (VecWidth == 256)
1197 IID = Intrinsic::x86_avx2_packusdw;
1198 else if (VecWidth == 512)
1199 IID = Intrinsic::x86_avx512_packusdw_512;
1203 if (VecWidth == 128 && EltWidth == 32)
1204 IID = Intrinsic::x86_avx_vpermilvar_ps;
1205 else if (VecWidth == 128 && EltWidth == 64)
1206 IID = Intrinsic::x86_avx_vpermilvar_pd;
1207 else if (VecWidth == 256 && EltWidth == 32)
1208 IID = Intrinsic::x86_avx_vpermilvar_ps_256;
1209 else if (VecWidth == 256 && EltWidth == 64)
1210 IID = Intrinsic::x86_avx_vpermilvar_pd_256;
1211 else if (VecWidth == 512 && EltWidth == 32)
1212 IID = Intrinsic::x86_avx512_vpermilvar_ps_512;
1213 else if (VecWidth == 512 && EltWidth == 64)
1214 IID = Intrinsic::x86_avx512_vpermilvar_pd_512;
1217 }
else if (Name ==
"cvtpd2dq.256") {
1218 IID = Intrinsic::x86_avx_cvt_pd2dq_256;
1219 }
else if (Name ==
"cvtpd2ps.256") {
1220 IID = Intrinsic::x86_avx_cvt_pd2_ps_256;
1221 }
else if (Name ==
"cvttpd2dq.256") {
1222 IID = Intrinsic::x86_avx_cvtt_pd2dq_256;
1223 }
else if (Name ==
"cvttps2dq.128") {
1224 IID = Intrinsic::x86_sse2_cvttps2dq;
1225 }
else if (Name ==
"cvttps2dq.256") {
1226 IID = Intrinsic::x86_avx_cvtt_ps2dq_256;
1229 if (VecWidth == 256 && EltWidth == 32 && IsFloat)
1230 IID = Intrinsic::x86_avx2_permps;
1231 else if (VecWidth == 256 && EltWidth == 32 && !IsFloat)
1232 IID = Intrinsic::x86_avx2_permd;
1233 else if (VecWidth == 256 && EltWidth == 64 && IsFloat)
1234 IID = Intrinsic::x86_avx512_permvar_df_256;
1235 else if (VecWidth == 256 && EltWidth == 64 && !IsFloat)
1236 IID = Intrinsic::x86_avx512_permvar_di_256;
1237 else if (VecWidth == 512 && EltWidth == 32 && IsFloat)
1238 IID = Intrinsic::x86_avx512_permvar_sf_512;
1239 else if (VecWidth == 512 && EltWidth == 32 && !IsFloat)
1240 IID = Intrinsic::x86_avx512_permvar_si_512;
1241 else if (VecWidth == 512 && EltWidth == 64 && IsFloat)
1242 IID = Intrinsic::x86_avx512_permvar_df_512;
1243 else if (VecWidth == 512 && EltWidth == 64 && !IsFloat)
1244 IID = Intrinsic::x86_avx512_permvar_di_512;
1245 else if (VecWidth == 128 && EltWidth == 16)
1246 IID = Intrinsic::x86_avx512_permvar_hi_128;
1247 else if (VecWidth == 256 && EltWidth == 16)
1248 IID = Intrinsic::x86_avx512_permvar_hi_256;
1249 else if (VecWidth == 512 && EltWidth == 16)
1250 IID = Intrinsic::x86_avx512_permvar_hi_512;
1251 else if (VecWidth == 128 && EltWidth == 8)
1252 IID = Intrinsic::x86_avx512_permvar_qi_128;
1253 else if (VecWidth == 256 && EltWidth == 8)
1254 IID = Intrinsic::x86_avx512_permvar_qi_256;
1255 else if (VecWidth == 512 && EltWidth == 8)
1256 IID = Intrinsic::x86_avx512_permvar_qi_512;
1260 if (VecWidth == 128)
1261 IID = Intrinsic::x86_avx512_dbpsadbw_128;
1262 else if (VecWidth == 256)
1263 IID = Intrinsic::x86_avx512_dbpsadbw_256;
1264 else if (VecWidth == 512)
1265 IID = Intrinsic::x86_avx512_dbpsadbw_512;
1269 if (VecWidth == 128 && Name[7] ==
'q')
1270 IID = Intrinsic::x86_avx512_vpshld_q_128;
1271 else if (VecWidth == 128 && Name[7] ==
'd')
1272 IID = Intrinsic::x86_avx512_vpshld_d_128;
1273 else if (VecWidth == 128 && Name[7] ==
'w')
1274 IID = Intrinsic::x86_avx512_vpshld_w_128;
1275 else if (VecWidth == 256 && Name[7] ==
'q')
1276 IID = Intrinsic::x86_avx512_vpshld_q_256;
1277 else if (VecWidth == 256 && Name[7] ==
'd')
1278 IID = Intrinsic::x86_avx512_vpshld_d_256;
1279 else if (VecWidth == 256 && Name[7] ==
'w')
1280 IID = Intrinsic::x86_avx512_vpshld_w_256;
1281 else if (VecWidth == 512 && Name[7] ==
'q')
1282 IID = Intrinsic::x86_avx512_vpshld_q_512;
1283 else if (VecWidth == 512 && Name[7] ==
'd')
1284 IID = Intrinsic::x86_avx512_vpshld_d_512;
1285 else if (VecWidth == 512 && Name[7] ==
'w')
1286 IID = Intrinsic::x86_avx512_vpshld_w_512;
1290 if (VecWidth == 128 && Name[7] ==
'q')
1291 IID = Intrinsic::x86_avx512_vpshrd_q_128;
1292 else if (VecWidth == 128 && Name[7] ==
'd')
1293 IID = Intrinsic::x86_avx512_vpshrd_d_128;
1294 else if (VecWidth == 128 && Name[7] ==
'w')
1295 IID = Intrinsic::x86_avx512_vpshrd_w_128;
1296 else if (VecWidth == 256 && Name[7] ==
'q')
1297 IID = Intrinsic::x86_avx512_vpshrd_q_256;
1298 else if (VecWidth == 256 && Name[7] ==
'd')
1299 IID = Intrinsic::x86_avx512_vpshrd_d_256;
1300 else if (VecWidth == 256 && Name[7] ==
'w')
1301 IID = Intrinsic::x86_avx512_vpshrd_w_256;
1302 else if (VecWidth == 512 && Name[7] ==
'q')
1303 IID = Intrinsic::x86_avx512_vpshrd_q_512;
1304 else if (VecWidth == 512 && Name[7] ==
'd')
1305 IID = Intrinsic::x86_avx512_vpshrd_d_512;
1306 else if (VecWidth == 512 && Name[7] ==
'w')
1307 IID = Intrinsic::x86_avx512_vpshrd_w_512;
1311 if (VecWidth == 128 && EltWidth == 32)
1312 IID = Intrinsic::x86_avx512_prorv_d_128;
1313 else if (VecWidth == 256 && EltWidth == 32)
1314 IID = Intrinsic::x86_avx512_prorv_d_256;
1315 else if (VecWidth == 512 && EltWidth == 32)
1316 IID = Intrinsic::x86_avx512_prorv_d_512;
1317 else if (VecWidth == 128 && EltWidth == 64)
1318 IID = Intrinsic::x86_avx512_prorv_q_128;
1319 else if (VecWidth == 256 && EltWidth == 64)
1320 IID = Intrinsic::x86_avx512_prorv_q_256;
1321 else if (VecWidth == 512 && EltWidth == 64)
1322 IID = Intrinsic::x86_avx512_prorv_q_512;
1326 if (VecWidth == 128 && EltWidth == 32)
1327 IID = Intrinsic::x86_avx512_prolv_d_128;
1328 else if (VecWidth == 256 && EltWidth == 32)
1329 IID = Intrinsic::x86_avx512_prolv_d_256;
1330 else if (VecWidth == 512 && EltWidth == 32)
1331 IID = Intrinsic::x86_avx512_prolv_d_512;
1332 else if (VecWidth == 128 && EltWidth == 64)
1333 IID = Intrinsic::x86_avx512_prolv_q_128;
1334 else if (VecWidth == 256 && EltWidth == 64)
1335 IID = Intrinsic::x86_avx512_prolv_q_256;
1336 else if (VecWidth == 512 && EltWidth == 64)
1337 IID = Intrinsic::x86_avx512_prolv_q_512;
1341 if (VecWidth == 128 && EltWidth == 32)
1342 IID = Intrinsic::x86_avx512_pror_d_128;
1343 else if (VecWidth == 256 && EltWidth == 32)
1344 IID = Intrinsic::x86_avx512_pror_d_256;
1345 else if (VecWidth == 512 && EltWidth == 32)
1346 IID = Intrinsic::x86_avx512_pror_d_512;
1347 else if (VecWidth == 128 && EltWidth == 64)
1348 IID = Intrinsic::x86_avx512_pror_q_128;
1349 else if (VecWidth == 256 && EltWidth == 64)
1350 IID = Intrinsic::x86_avx512_pror_q_256;
1351 else if (VecWidth == 512 && EltWidth == 64)
1352 IID = Intrinsic::x86_avx512_pror_q_512;
1356 if (VecWidth == 128 && EltWidth == 32)
1357 IID = Intrinsic::x86_avx512_prol_d_128;
1358 else if (VecWidth == 256 && EltWidth == 32)
1359 IID = Intrinsic::x86_avx512_prol_d_256;
1360 else if (VecWidth == 512 && EltWidth == 32)
1361 IID = Intrinsic::x86_avx512_prol_d_512;
1362 else if (VecWidth == 128 && EltWidth == 64)
1363 IID = Intrinsic::x86_avx512_prol_q_128;
1364 else if (VecWidth == 256 && EltWidth == 64)
1365 IID = Intrinsic::x86_avx512_prol_q_256;
1366 else if (VecWidth == 512 && EltWidth == 64)
1367 IID = Intrinsic::x86_avx512_prol_q_512;
1389 if (AsmStr->find(
"mov\tfp") == 0 &&
1390 AsmStr->find(
"objc_retainAutoreleaseReturnValue") != std::string::npos &&
1391 (Pos = AsmStr->find(
"# marker")) != std::string::npos) {
1392 AsmStr->replace(Pos, 1,
";");
1405 assert(F &&
"Intrinsic call is not direct?");
1411 assert(Name.
startswith(
"llvm.") &&
"Intrinsic doesn't start with 'llvm.'");
1416 Name = Name.substr(4);
1417 bool IsNVVM = Name.startswith(
"nvvm.");
1419 Name = Name.substr(5);
1421 if (IsX86 && Name.startswith(
"sse4a.movnt.")) {
1433 Type *SrcEltTy = cast<VectorType>(Arg1->
getType())->getElementType();
1447 if (IsX86 && (Name.startswith(
"avx.movnt.") ||
1448 Name.startswith(
"avx512.storent."))) {
1472 if (IsX86 && Name ==
"sse2.storel.dq") {
1489 if (IsX86 && (Name.startswith(
"sse.storeu.") ||
1490 Name.startswith(
"sse2.storeu.") ||
1491 Name.startswith(
"avx.storeu."))) {
1505 if (IsX86 && Name ==
"avx512.mask.store.ss") {
1515 if (IsX86 && (Name.startswith(
"avx512.mask.store"))) {
1517 bool Aligned = Name[17] !=
'u';
1528 if (IsX86 && (Name.startswith(
"sse2.pcmp") ||
1529 Name.startswith(
"avx2.pcmp"))) {
1531 bool CmpEq = Name[9] ==
'e';
1535 }
else if (IsX86 && (Name.startswith(
"avx512.broadcastm"))) {
1543 }
else if (IsX86 && (Name ==
"sse.sqrt.ss" ||
1544 Name ==
"sse2.sqrt.sd")) {
1548 Intrinsic::sqrt, Elt0->
getType());
1551 }
else if (IsX86 && (Name.startswith(
"avx.sqrt.p") ||
1552 Name.startswith(
"sse2.sqrt.p") ||
1553 Name.startswith(
"sse.sqrt.p"))) {
1558 }
else if (IsX86 && (Name.startswith(
"avx512.mask.sqrt.p"))) {
1561 cast<ConstantInt>(CI->
getArgOperand(3))->getZExtValue() != 4)) {
1562 Intrinsic::ID IID = Name[18] ==
's' ? Intrinsic::x86_avx512_sqrt_ps_512
1563 : Intrinsic::x86_avx512_sqrt_pd_512;
1576 }
else if (IsX86 && (Name.startswith(
"avx512.ptestm") ||
1577 Name.startswith(
"avx512.ptestnm"))) {
1588 }
else if (IsX86 && (Name.startswith(
"avx512.mask.pbroadcast"))){
1594 }
else if (IsX86 && (Name.startswith(
"avx512.kunpck"))) {
1599 for (
unsigned i = 0; i != NumElts; ++i)
1613 }
else if (IsX86 && Name ==
"avx512.kand.w") {
1618 }
else if (IsX86 && Name ==
"avx512.kandn.w") {
1624 }
else if (IsX86 && Name ==
"avx512.kor.w") {
1629 }
else if (IsX86 && Name ==
"avx512.kxor.w") {
1634 }
else if (IsX86 && Name ==
"avx512.kxnor.w") {
1640 }
else if (IsX86 && Name ==
"avx512.knot.w") {
1645 (Name ==
"avx512.kortestz.w" || Name ==
"avx512.kortestc.w")) {
1651 if (Name[14] ==
'c')
1657 }
else if (IsX86 && (Name ==
"sse.add.ss" || Name ==
"sse2.add.sd")) {
1666 }
else if (IsX86 && (Name ==
"sse.sub.ss" || Name ==
"sse2.sub.sd")) {
1675 }
else if (IsX86 && (Name ==
"sse.mul.ss" || Name ==
"sse2.mul.sd")) {
1684 }
else if (IsX86 && (Name ==
"sse.div.ss" || Name ==
"sse2.div.sd")) {
1693 }
else if (IsX86 && Name.startswith(
"avx512.mask.pcmp")) {
1695 bool CmpEq = Name[16] ==
'e';
1697 }
else if (IsX86 && Name.startswith(
"avx512.mask.fpclass.p")) {
1702 if (VecWidth == 128 && EltWidth == 32)
1703 IID = Intrinsic::x86_avx512_fpclass_ps_128;
1704 else if (VecWidth == 256 && EltWidth == 32)
1705 IID = Intrinsic::x86_avx512_fpclass_ps_256;
1706 else if (VecWidth == 512 && EltWidth == 32)
1707 IID = Intrinsic::x86_avx512_fpclass_ps_512;
1708 else if (VecWidth == 128 && EltWidth == 64)
1709 IID = Intrinsic::x86_avx512_fpclass_pd_128;
1710 else if (VecWidth == 256 && EltWidth == 64)
1711 IID = Intrinsic::x86_avx512_fpclass_pd_256;
1712 else if (VecWidth == 512 && EltWidth == 64)
1713 IID = Intrinsic::x86_avx512_fpclass_pd_512;
1720 }
else if (IsX86 && Name.startswith(
"avx512.mask.cmp.p")) {
1725 if (VecWidth == 128 && EltWidth == 32)
1726 IID = Intrinsic::x86_avx512_cmp_ps_128;
1727 else if (VecWidth == 256 && EltWidth == 32)
1728 IID = Intrinsic::x86_avx512_cmp_ps_256;
1729 else if (VecWidth == 512 && EltWidth == 32)
1730 IID = Intrinsic::x86_avx512_cmp_ps_512;
1731 else if (VecWidth == 128 && EltWidth == 64)
1732 IID = Intrinsic::x86_avx512_cmp_pd_128;
1733 else if (VecWidth == 256 && EltWidth == 64)
1734 IID = Intrinsic::x86_avx512_cmp_pd_256;
1735 else if (VecWidth == 512 && EltWidth == 64)
1736 IID = Intrinsic::x86_avx512_cmp_pd_512;
1750 }
else if (IsX86 && Name.startswith(
"avx512.mask.cmp.") &&
1753 unsigned Imm = cast<ConstantInt>(CI->
getArgOperand(2))->getZExtValue();
1755 }
else if (IsX86 && Name.startswith(
"avx512.mask.ucmp.")) {
1756 unsigned Imm = cast<ConstantInt>(CI->
getArgOperand(2))->getZExtValue();
1758 }
else if (IsX86 && (Name.startswith(
"avx512.cvtb2mask.") ||
1759 Name.startswith(
"avx512.cvtw2mask.") ||
1760 Name.startswith(
"avx512.cvtd2mask.") ||
1761 Name.startswith(
"avx512.cvtq2mask."))) {
1766 }
else if(IsX86 && (Name ==
"ssse3.pabs.b.128" ||
1767 Name ==
"ssse3.pabs.w.128" ||
1768 Name ==
"ssse3.pabs.d.128" ||
1769 Name.startswith(
"avx2.pabs") ||
1770 Name.startswith(
"avx512.mask.pabs"))) {
1772 }
else if (IsX86 && (Name ==
"sse41.pmaxsb" ||
1773 Name ==
"sse2.pmaxs.w" ||
1774 Name ==
"sse41.pmaxsd" ||
1775 Name.startswith(
"avx2.pmaxs") ||
1776 Name.startswith(
"avx512.mask.pmaxs"))) {
1778 }
else if (IsX86 && (Name ==
"sse2.pmaxu.b" ||
1779 Name ==
"sse41.pmaxuw" ||
1780 Name ==
"sse41.pmaxud" ||
1781 Name.startswith(
"avx2.pmaxu") ||
1782 Name.startswith(
"avx512.mask.pmaxu"))) {
1784 }
else if (IsX86 && (Name ==
"sse41.pminsb" ||
1785 Name ==
"sse2.pmins.w" ||
1786 Name ==
"sse41.pminsd" ||
1787 Name.startswith(
"avx2.pmins") ||
1788 Name.startswith(
"avx512.mask.pmins"))) {
1790 }
else if (IsX86 && (Name ==
"sse2.pminu.b" ||
1791 Name ==
"sse41.pminuw" ||
1792 Name ==
"sse41.pminud" ||
1793 Name.startswith(
"avx2.pminu") ||
1794 Name.startswith(
"avx512.mask.pminu"))) {
1796 }
else if (IsX86 && (Name ==
"sse2.pmulu.dq" ||
1797 Name ==
"avx2.pmulu.dq" ||
1798 Name ==
"avx512.pmulu.dq.512" ||
1799 Name.startswith(
"avx512.mask.pmulu.dq."))) {
1801 }
else if (IsX86 && (Name ==
"sse41.pmuldq" ||
1802 Name ==
"avx2.pmul.dq" ||
1803 Name ==
"avx512.pmul.dq.512" ||
1804 Name.startswith(
"avx512.mask.pmul.dq."))) {
1806 }
else if (IsX86 && (Name ==
"sse.cvtsi2ss" ||
1807 Name ==
"sse2.cvtsi2sd" ||
1808 Name ==
"sse.cvtsi642ss" ||
1809 Name ==
"sse2.cvtsi642sd")) {
1813 }
else if (IsX86 && Name ==
"avx512.cvtusi2sd") {
1817 }
else if (IsX86 && Name ==
"sse2.cvtss2sd") {
1821 }
else if (IsX86 && (Name ==
"sse2.cvtdq2pd" ||
1822 Name ==
"sse2.cvtdq2ps" ||
1823 Name ==
"avx.cvtdq2.pd.256" ||
1824 Name ==
"avx.cvtdq2.ps.256" ||
1825 Name.startswith(
"avx512.mask.cvtdq2pd.") ||
1826 Name.startswith(
"avx512.mask.cvtudq2pd.") ||
1827 Name ==
"avx512.mask.cvtdq2ps.128" ||
1828 Name ==
"avx512.mask.cvtdq2ps.256" ||
1829 Name ==
"avx512.mask.cvtudq2ps.128" ||
1830 Name ==
"avx512.mask.cvtudq2ps.256" ||
1831 Name ==
"avx512.mask.cvtqq2pd.128" ||
1832 Name ==
"avx512.mask.cvtqq2pd.256" ||
1833 Name ==
"avx512.mask.cvtuqq2pd.128" ||
1834 Name ==
"avx512.mask.cvtuqq2pd.256" ||
1835 Name ==
"sse2.cvtps2pd" ||
1836 Name ==
"avx.cvt.ps2.pd.256" ||
1837 Name ==
"avx512.mask.cvtps2pd.128" ||
1838 Name ==
"avx512.mask.cvtps2pd.256")) {
1843 if (NumDstElts < Rep->
getType()->getVectorNumElements()) {
1844 assert(NumDstElts == 2 &&
"Unexpected vector size");
1845 uint32_t ShuffleMask[2] = { 0, 1 };
1852 Rep = Builder.
CreateFPExt(Rep, DstTy,
"cvtps2pd");
1853 else if (IsUnsigned)
1861 }
else if (IsX86 && (Name.startswith(
"avx512.mask.loadu."))) {
1865 }
else if (IsX86 && (Name.startswith(
"avx512.mask.load."))) {
1869 }
else if (IsX86 && Name.startswith(
"avx512.mask.expand.load.")) {
1881 Intrinsic::masked_expandload,
1884 }
else if (IsX86 && Name.startswith(
"avx512.mask.compress.store.")) {
1896 Intrinsic::masked_compressstore,
1899 }
else if (IsX86 && Name.startswith(
"xop.vpcom")) {
1901 if (Name.endswith(
"ub"))
1902 intID = Intrinsic::x86_xop_vpcomub;
1903 else if (Name.endswith(
"uw"))
1904 intID = Intrinsic::x86_xop_vpcomuw;
1905 else if (Name.endswith(
"ud"))
1906 intID = Intrinsic::x86_xop_vpcomud;
1907 else if (Name.endswith(
"uq"))
1908 intID = Intrinsic::x86_xop_vpcomuq;
1909 else if (Name.endswith(
"b"))
1910 intID = Intrinsic::x86_xop_vpcomb;
1911 else if (Name.endswith(
"w"))
1912 intID = Intrinsic::x86_xop_vpcomw;
1913 else if (Name.endswith(
"d"))
1914 intID = Intrinsic::x86_xop_vpcomd;
1915 else if (Name.endswith(
"q"))
1916 intID = Intrinsic::x86_xop_vpcomq;
1920 Name = Name.substr(9);
1922 if (Name.startswith(
"lt"))
1924 else if (Name.startswith(
"le"))
1926 else if (Name.startswith(
"gt"))
1928 else if (Name.startswith(
"ge"))
1930 else if (Name.startswith(
"eq"))
1932 else if (Name.startswith(
"ne"))
1934 else if (Name.startswith(
"false"))
1936 else if (Name.startswith(
"true"))
1945 }
else if (IsX86 && Name.startswith(
"xop.vpcmov")) {
1950 Rep = Builder.
CreateOr(Sel0, Sel1);
1951 }
else if (IsX86 && Name ==
"sse42.crc32.64.8") {
1953 Intrinsic::x86_sse42_crc32_32_8);
1957 }
else if (IsX86 && (Name.startswith(
"avx.vbroadcast.s") ||
1958 Name.startswith(
"avx512.vbroadcast.s"))) {
1968 for (
unsigned I = 0;
I < EltNum; ++
I)
1971 }
else if (IsX86 && (Name.startswith(
"sse41.pmovsx") ||
1972 Name.startswith(
"sse41.pmovzx") ||
1973 Name.startswith(
"avx2.pmovsx") ||
1974 Name.startswith(
"avx2.pmovzx") ||
1975 Name.startswith(
"avx512.mask.pmovsx") ||
1976 Name.startswith(
"avx512.mask.pmovzx"))) {
1983 for (
unsigned i = 0; i != NumDstElts; ++i)
1996 }
else if (IsX86 && (Name.startswith(
"avx.vbroadcastf128") ||
1997 Name ==
"avx2.vbroadcasti128")) {
2005 if (NumSrcElts == 2)
2010 { 0, 1, 2, 3, 0, 1, 2, 3 });
2011 }
else if (IsX86 && (Name.startswith(
"avx512.mask.shuf.i") ||
2012 Name.startswith(
"avx512.mask.shuf.f"))) {
2013 unsigned Imm = cast<ConstantInt>(CI->
getArgOperand(2))->getZExtValue();
2017 unsigned ControlBitsMask = NumLanes - 1;
2018 unsigned NumControlBits = NumLanes / 2;
2021 for (
unsigned l = 0; l != NumLanes; ++l) {
2022 unsigned LaneMask = (Imm >> (l * NumControlBits)) & ControlBitsMask;
2024 if (l >= NumLanes / 2)
2025 LaneMask += NumLanes;
2026 for (
unsigned i = 0; i != NumElementsInLane; ++i)
2027 ShuffleMask.
push_back(LaneMask * NumElementsInLane + i);
2033 }
else if (IsX86 && (Name.startswith(
"avx512.mask.broadcastf") ||
2034 Name.startswith(
"avx512.mask.broadcasti"))) {
2035 unsigned NumSrcElts =
2040 for (
unsigned i = 0; i != NumDstElts; ++i)
2041 ShuffleMask[i] = i % NumSrcElts;
2048 }
else if (IsX86 && (Name.startswith(
"avx2.pbroadcast") ||
2049 Name.startswith(
"avx2.vbroadcast") ||
2050 Name.startswith(
"avx512.pbroadcast") ||
2051 Name.startswith(
"avx512.mask.broadcast.s"))) {
2062 }
else if (IsX86 && Name.startswith(
"avx512.mask.palignr.")) {
2069 }
else if (IsX86 && Name.startswith(
"avx512.mask.valign.")) {
2076 }
else if (IsX86 && (Name ==
"sse2.psll.dq" ||
2077 Name ==
"avx2.psll.dq")) {
2079 unsigned Shift = cast<ConstantInt>(CI->
getArgOperand(1))->getZExtValue();
2082 }
else if (IsX86 && (Name ==
"sse2.psrl.dq" ||
2083 Name ==
"avx2.psrl.dq")) {
2085 unsigned Shift = cast<ConstantInt>(CI->
getArgOperand(1))->getZExtValue();
2088 }
else if (IsX86 && (Name ==
"sse2.psll.dq.bs" ||
2089 Name ==
"avx2.psll.dq.bs" ||
2090 Name ==
"avx512.psll.dq.512")) {
2092 unsigned Shift = cast<ConstantInt>(CI->
getArgOperand(1))->getZExtValue();
2094 }
else if (IsX86 && (Name ==
"sse2.psrl.dq.bs" ||
2095 Name ==
"avx2.psrl.dq.bs" ||
2096 Name ==
"avx512.psrl.dq.512")) {
2098 unsigned Shift = cast<ConstantInt>(CI->
getArgOperand(1))->getZExtValue();
2100 }
else if (IsX86 && (Name ==
"sse41.pblendw" ||
2101 Name.startswith(
"sse41.blendp") ||
2102 Name.startswith(
"avx.blend.p") ||
2103 Name ==
"avx2.pblendw" ||
2104 Name.startswith(
"avx2.pblendd."))) {
2107 unsigned Imm = cast <ConstantInt>(CI->
getArgOperand(2))->getZExtValue();
2112 for (
unsigned i = 0; i != NumElts; ++i)
2113 Idxs[i] = ((Imm >> (i%8)) & 1) ? i + NumElts : i;
2116 }
else if (IsX86 && (Name.startswith(
"avx.vinsertf128.") ||
2117 Name ==
"avx2.vinserti128" ||
2118 Name.startswith(
"avx512.mask.insert"))) {
2121 unsigned Imm = cast<ConstantInt>(CI->
getArgOperand(2))->getZExtValue();
2124 unsigned Scale = DstNumElts / SrcNumElts;
2132 for (
unsigned i = 0; i != SrcNumElts; ++i)
2134 for (
unsigned i = SrcNumElts; i != DstNumElts; ++i)
2135 Idxs[i] = SrcNumElts;
2150 for (
unsigned i = 0; i != DstNumElts; ++i)
2153 for (
unsigned i = 0; i != SrcNumElts; ++i)
2154 Idxs[i + Imm * SrcNumElts] = i + DstNumElts;
2161 }
else if (IsX86 && (Name.startswith(
"avx.vextractf128.") ||
2162 Name ==
"avx2.vextracti128" ||
2163 Name.startswith(
"avx512.mask.vextract"))) {
2165 unsigned Imm = cast<ConstantInt>(CI->
getArgOperand(1))->getZExtValue();
2168 unsigned Scale = SrcNumElts / DstNumElts;
2175 for (
unsigned i = 0; i != DstNumElts; ++i) {
2176 Idxs[i] = i + (Imm * DstNumElts);
2184 }
else if (!IsX86 && Name ==
"stackprotectorcheck") {
2186 }
else if (IsX86 && (Name.startswith(
"avx512.mask.perm.df.") ||
2187 Name.startswith(
"avx512.mask.perm.di."))) {
2189 unsigned Imm = cast<ConstantInt>(CI->
getArgOperand(1))->getZExtValue();
2194 for (
unsigned i = 0; i != NumElts; ++i)
2195 Idxs[i] = (i & ~0x3) + ((Imm >> (2 * (i & 0x3))) & 3);
2202 }
else if (IsX86 && (Name.startswith(
"avx.vperm2f128.") ||
2203 Name ==
"avx2.vperm2i128")) {
2212 uint8_t Imm = cast<ConstantInt>(CI->
getArgOperand(2))->getZExtValue();
2215 unsigned HalfSize = NumElts / 2;
2227 unsigned StartIndex = (Imm & 0x01) ? HalfSize : 0;
2228 for (
unsigned i = 0; i < HalfSize; ++i)
2229 ShuffleMask[i] = StartIndex + i;
2232 StartIndex = (Imm & 0x10) ? HalfSize : 0;
2233 for (
unsigned i = 0; i < HalfSize; ++i)
2234 ShuffleMask[i + HalfSize] = NumElts + StartIndex + i;
2238 }
else if (IsX86 && (Name.startswith(
"avx.vpermil.") ||
2239 Name ==
"sse2.pshuf.d" ||
2240 Name.startswith(
"avx512.mask.vpermil.p") ||
2241 Name.startswith(
"avx512.mask.pshuf.d."))) {
2243 unsigned Imm = cast<ConstantInt>(CI->
getArgOperand(1))->getZExtValue();
2248 unsigned IdxMask = ((1 << IdxSize) - 1);
2254 for (
unsigned i = 0; i != NumElts; ++i)
2255 Idxs[i] = ((Imm >> ((i * IdxSize) % 8)) & IdxMask) | (i & ~IdxMask);
2262 }
else if (IsX86 && (Name ==
"sse2.pshufl.w" ||
2263 Name.startswith(
"avx512.mask.pshufl.w."))) {
2265 unsigned Imm = cast<ConstantInt>(CI->
getArgOperand(1))->getZExtValue();
2269 for (
unsigned l = 0; l != NumElts; l += 8) {
2270 for (
unsigned i = 0; i != 4; ++i)
2271 Idxs[i + l] = ((Imm >> (2 * i)) & 0x3) + l;
2272 for (
unsigned i = 4; i != 8; ++i)
2273 Idxs[i + l] = i + l;
2281 }
else if (IsX86 && (Name ==
"sse2.pshufh.w" ||
2282 Name.startswith(
"avx512.mask.pshufh.w."))) {
2284 unsigned Imm = cast<ConstantInt>(CI->
getArgOperand(1))->getZExtValue();
2288 for (
unsigned l = 0; l != NumElts; l += 8) {
2289 for (
unsigned i = 0; i != 4; ++i)
2290 Idxs[i + l] = i + l;
2291 for (
unsigned i = 0; i != 4; ++i)
2292 Idxs[i + l + 4] = ((Imm >> (2 * i)) & 0x3) + 4 + l;
2300 }
else if (IsX86 && Name.startswith(
"avx512.mask.shuf.p")) {
2303 unsigned Imm = cast<ConstantInt>(CI->
getArgOperand(2))->getZExtValue();
2307 unsigned HalfLaneElts = NumLaneElts / 2;
2310 for (
unsigned i = 0; i != NumElts; ++i) {
2312 Idxs[i] = i - (i % NumLaneElts);
2314 if ((i % NumLaneElts) >= HalfLaneElts)
2318 Idxs[i] += (Imm >> ((i * HalfLaneElts) % 8)) & ((1 << HalfLaneElts) - 1);
2325 }
else if (IsX86 && (Name.startswith(
"avx512.mask.movddup") ||
2326 Name.startswith(
"avx512.mask.movshdup") ||
2327 Name.startswith(
"avx512.mask.movsldup"))) {
2333 if (Name.startswith(
"avx512.mask.movshdup."))
2337 for (
unsigned l = 0; l != NumElts; l += NumLaneElts)
2338 for (
unsigned i = 0; i != NumLaneElts; i += 2) {
2339 Idxs[i + l + 0] = i + l +
Offset;
2340 Idxs[i + l + 1] = i + l +
Offset;
2347 }
else if (IsX86 && (Name.startswith(
"avx512.mask.punpckl") ||
2348 Name.startswith(
"avx512.mask.unpckl."))) {
2355 for (
int l = 0; l != NumElts; l += NumLaneElts)
2356 for (
int i = 0; i != NumLaneElts; ++i)
2357 Idxs[i + l] = l + (i / 2) + NumElts * (i % 2);
2363 }
else if (IsX86 && (Name.startswith(
"avx512.mask.punpckh") ||
2364 Name.startswith(
"avx512.mask.unpckh."))) {
2371 for (
int l = 0; l != NumElts; l += NumLaneElts)
2372 for (
int i = 0; i != NumLaneElts; ++i)
2373 Idxs[i + l] = (NumLaneElts / 2) + l + (i / 2) + NumElts * (i % 2);
2379 }
else if (IsX86 && Name.startswith(
"avx512.mask.pand.")) {
2383 }
else if (IsX86 && Name.startswith(
"avx512.mask.pandn.")) {
2388 }
else if (IsX86 && Name.startswith(
"avx512.mask.por.")) {
2392 }
else if (IsX86 && Name.startswith(
"avx512.mask.pxor.")) {
2396 }
else if (IsX86 && Name.startswith(
"avx512.mask.and.")) {
2404 }
else if (IsX86 && Name.startswith(
"avx512.mask.andn.")) {
2413 }
else if (IsX86 && Name.startswith(
"avx512.mask.or.")) {
2421 }
else if (IsX86 && Name.startswith(
"avx512.mask.xor.")) {
2429 }
else if (IsX86 && Name.startswith(
"avx512.mask.padd.")) {
2433 }
else if (IsX86 && Name.startswith(
"avx512.mask.psub.")) {
2437 }
else if (IsX86 && Name.startswith(
"avx512.mask.pmull.")) {
2441 }
else if (IsX86 && Name.startswith(
"avx512.mask.add.p")) {
2442 if (Name.endswith(
".512")) {
2444 if (Name[17] ==
's')
2445 IID = Intrinsic::x86_avx512_add_ps_512;
2447 IID = Intrinsic::x86_avx512_add_pd_512;
2457 }
else if (IsX86 && Name.startswith(
"avx512.mask.div.p")) {
2458 if (Name.endswith(
".512")) {
2460 if (Name[17] ==
's')
2461 IID = Intrinsic::x86_avx512_div_ps_512;
2463 IID = Intrinsic::x86_avx512_div_pd_512;
2473 }
else if (IsX86 && Name.startswith(
"avx512.mask.mul.p")) {
2474 if (Name.endswith(
".512")) {
2476 if (Name[17] ==
's')
2477 IID = Intrinsic::x86_avx512_mul_ps_512;
2479 IID = Intrinsic::x86_avx512_mul_pd_512;
2489 }
else if (IsX86 && Name.startswith(
"avx512.mask.sub.p")) {
2490 if (Name.endswith(
".512")) {
2492 if (Name[17] ==
's')
2493 IID = Intrinsic::x86_avx512_sub_ps_512;
2495 IID = Intrinsic::x86_avx512_sub_pd_512;
2505 }
else if (IsX86 && Name.startswith(
"avx512.mask.max.p") &&
2506 Name.drop_front(18) ==
".512") {
2508 if (Name[17] ==
's')
2509 IID = Intrinsic::x86_avx512_max_ps_512;
2511 IID = Intrinsic::x86_avx512_max_pd_512;
2518 }
else if (IsX86 && Name.startswith(
"avx512.mask.min.p") &&
2519 Name.drop_front(18) ==
".512") {
2521 if (Name[17] ==
's')
2522 IID = Intrinsic::x86_avx512_min_ps_512;
2524 IID = Intrinsic::x86_avx512_min_pd_512;
2531 }
else if (IsX86 && Name.startswith(
"avx512.mask.lzcnt.")) {
2538 }
else if (IsX86 && Name.startswith(
"avx512.mask.psll")) {
2539 bool IsImmediate = Name[16] ==
'i' ||
2540 (Name.size() > 18 && Name[18] ==
'i');
2541 bool IsVariable = Name[16] ==
'v';
2542 char Size = Name[16] ==
'.' ? Name[17] :
2543 Name[17] ==
'.' ? Name[18] :
2544 Name[18] ==
'.' ? Name[19] :
2548 if (IsVariable && Name[17] !=
'.') {
2549 if (Size ==
'd' && Name[17] ==
'2')
2550 IID = Intrinsic::x86_avx2_psllv_q;
2551 else if (Size ==
'd' && Name[17] ==
'4')
2552 IID = Intrinsic::x86_avx2_psllv_q_256;
2553 else if (Size ==
's' && Name[17] ==
'4')
2554 IID = Intrinsic::x86_avx2_psllv_d;
2555 else if (Size ==
's' && Name[17] ==
'8')
2556 IID = Intrinsic::x86_avx2_psllv_d_256;
2557 else if (Size ==
'h' && Name[17] ==
'8')
2558 IID = Intrinsic::x86_avx512_psllv_w_128;
2559 else if (Size ==
'h' && Name[17] ==
'1')
2560 IID = Intrinsic::x86_avx512_psllv_w_256;
2561 else if (Name[17] ==
'3' && Name[18] ==
'2')
2562 IID = Intrinsic::x86_avx512_psllv_w_512;
2565 }
else if (Name.endswith(
".128")) {
2567 IID = IsImmediate ? Intrinsic::x86_sse2_pslli_d
2568 : Intrinsic::x86_sse2_psll_d;
2569 else if (Size ==
'q')
2570 IID = IsImmediate ? Intrinsic::x86_sse2_pslli_q
2571 : Intrinsic::x86_sse2_psll_q;
2572 else if (Size ==
'w')
2573 IID = IsImmediate ? Intrinsic::x86_sse2_pslli_w
2574 : Intrinsic::x86_sse2_psll_w;
2577 }
else if (Name.endswith(
".256")) {
2579 IID = IsImmediate ? Intrinsic::x86_avx2_pslli_d
2580 : Intrinsic::x86_avx2_psll_d;
2581 else if (Size ==
'q')
2582 IID = IsImmediate ? Intrinsic::x86_avx2_pslli_q
2583 : Intrinsic::x86_avx2_psll_q;
2584 else if (Size ==
'w')
2585 IID = IsImmediate ? Intrinsic::x86_avx2_pslli_w
2586 : Intrinsic::x86_avx2_psll_w;
2591 IID = IsImmediate ? Intrinsic::x86_avx512_pslli_d_512 :
2592 IsVariable ? Intrinsic::x86_avx512_psllv_d_512 :
2593 Intrinsic::x86_avx512_psll_d_512;
2594 else if (Size ==
'q')
2595 IID = IsImmediate ? Intrinsic::x86_avx512_pslli_q_512 :
2596 IsVariable ? Intrinsic::x86_avx512_psllv_q_512 :
2597 Intrinsic::x86_avx512_psll_q_512;
2598 else if (Size ==
'w')
2599 IID = IsImmediate ? Intrinsic::x86_avx512_pslli_w_512
2600 : Intrinsic::x86_avx512_psll_w_512;
2606 }
else if (IsX86 && Name.startswith(
"avx512.mask.psrl")) {
2607 bool IsImmediate = Name[16] ==
'i' ||
2608 (Name.size() > 18 && Name[18] ==
'i');
2609 bool IsVariable = Name[16] ==
'v';
2610 char Size = Name[16] ==
'.' ? Name[17] :
2611 Name[17] ==
'.' ? Name[18] :
2612 Name[18] ==
'.' ? Name[19] :
2616 if (IsVariable && Name[17] !=
'.') {
2617 if (Size ==
'd' && Name[17] ==
'2')
2618 IID = Intrinsic::x86_avx2_psrlv_q;
2619 else if (Size ==
'd' && Name[17] ==
'4')
2620 IID = Intrinsic::x86_avx2_psrlv_q_256;
2621 else if (Size ==
's' && Name[17] ==
'4')
2622 IID = Intrinsic::x86_avx2_psrlv_d;
2623 else if (Size ==
's' && Name[17] ==
'8')
2624 IID = Intrinsic::x86_avx2_psrlv_d_256;
2625 else if (Size ==
'h' && Name[17] ==
'8')
2626 IID = Intrinsic::x86_avx512_psrlv_w_128;
2627 else if (Size ==
'h' && Name[17] ==
'1')
2628 IID = Intrinsic::x86_avx512_psrlv_w_256;
2629 else if (Name[17] ==
'3' && Name[18] ==
'2')
2630 IID = Intrinsic::x86_avx512_psrlv_w_512;
2633 }
else if (Name.endswith(
".128")) {
2635 IID = IsImmediate ? Intrinsic::x86_sse2_psrli_d
2636 : Intrinsic::x86_sse2_psrl_d;
2637 else if (Size ==
'q')
2638 IID = IsImmediate ? Intrinsic::x86_sse2_psrli_q
2639 : Intrinsic::x86_sse2_psrl_q;
2640 else if (Size ==
'w')
2641 IID = IsImmediate ? Intrinsic::x86_sse2_psrli_w
2642 : Intrinsic::x86_sse2_psrl_w;
2645 }
else if (Name.endswith(
".256")) {
2647 IID = IsImmediate ? Intrinsic::x86_avx2_psrli_d
2648 : Intrinsic::x86_avx2_psrl_d;
2649 else if (Size ==
'q')
2650 IID = IsImmediate ? Intrinsic::x86_avx2_psrli_q
2651 : Intrinsic::x86_avx2_psrl_q;
2652 else if (Size ==
'w')
2653 IID = IsImmediate ? Intrinsic::x86_avx2_psrli_w
2654 : Intrinsic::x86_avx2_psrl_w;
2659 IID = IsImmediate ? Intrinsic::x86_avx512_psrli_d_512 :
2660 IsVariable ? Intrinsic::x86_avx512_psrlv_d_512 :
2661 Intrinsic::x86_avx512_psrl_d_512;
2662 else if (Size ==
'q')
2663 IID = IsImmediate ? Intrinsic::x86_avx512_psrli_q_512 :
2664 IsVariable ? Intrinsic::x86_avx512_psrlv_q_512 :
2665 Intrinsic::x86_avx512_psrl_q_512;
2666 else if (Size ==
'w')
2667 IID = IsImmediate ? Intrinsic::x86_avx512_psrli_w_512
2668 : Intrinsic::x86_avx512_psrl_w_512;
2674 }
else if (IsX86 && Name.startswith(
"avx512.mask.psra")) {
2675 bool IsImmediate = Name[16] ==
'i' ||
2676 (Name.size() > 18 && Name[18] ==
'i');
2677 bool IsVariable = Name[16] ==
'v';
2678 char Size = Name[16] ==
'.' ? Name[17] :
2679 Name[17] ==
'.' ? Name[18] :
2680 Name[18] ==
'.' ? Name[19] :
2684 if (IsVariable && Name[17] !=
'.') {
2685 if (Size ==
's' && Name[17] ==
'4')
2686 IID = Intrinsic::x86_avx2_psrav_d;
2687 else if (Size ==
's' && Name[17] ==
'8')
2688 IID = Intrinsic::x86_avx2_psrav_d_256;
2689 else if (Size ==
'h' && Name[17] ==
'8')
2690 IID = Intrinsic::x86_avx512_psrav_w_128;
2691 else if (Size ==
'h' && Name[17] ==
'1')
2692 IID = Intrinsic::x86_avx512_psrav_w_256;
2693 else if (Name[17] ==
'3' && Name[18] ==
'2')
2694 IID = Intrinsic::x86_avx512_psrav_w_512;
2697 }
else if (Name.endswith(
".128")) {
2699 IID = IsImmediate ? Intrinsic::x86_sse2_psrai_d
2700 : Intrinsic::x86_sse2_psra_d;
2701 else if (Size ==
'q')
2702 IID = IsImmediate ? Intrinsic::x86_avx512_psrai_q_128 :
2703 IsVariable ? Intrinsic::x86_avx512_psrav_q_128 :
2704 Intrinsic::x86_avx512_psra_q_128;
2705 else if (Size ==
'w')
2706 IID = IsImmediate ? Intrinsic::x86_sse2_psrai_w
2707 : Intrinsic::x86_sse2_psra_w;
2710 }
else if (Name.endswith(
".256")) {
2712 IID = IsImmediate ? Intrinsic::x86_avx2_psrai_d
2713 : Intrinsic::x86_avx2_psra_d;
2714 else if (Size ==
'q')
2715 IID = IsImmediate ? Intrinsic::x86_avx512_psrai_q_256 :
2716 IsVariable ? Intrinsic::x86_avx512_psrav_q_256 :
2717 Intrinsic::x86_avx512_psra_q_256;
2718 else if (Size ==
'w')
2719 IID = IsImmediate ? Intrinsic::x86_avx2_psrai_w
2720 : Intrinsic::x86_avx2_psra_w;
2725 IID = IsImmediate ? Intrinsic::x86_avx512_psrai_d_512 :
2726 IsVariable ? Intrinsic::x86_avx512_psrav_d_512 :
2727 Intrinsic::x86_avx512_psra_d_512;
2728 else if (Size ==
'q')
2729 IID = IsImmediate ? Intrinsic::x86_avx512_psrai_q_512 :
2730 IsVariable ? Intrinsic::x86_avx512_psrav_q_512 :
2731 Intrinsic::x86_avx512_psra_q_512;
2732 else if (Size ==
'w')
2733 IID = IsImmediate ? Intrinsic::x86_avx512_psrai_w_512
2734 : Intrinsic::x86_avx512_psra_w_512;
2740 }
else if (IsX86 && Name.startswith(
"avx512.mask.move.s")) {
2742 }
else if (IsX86 && Name.startswith(
"avx512.cvtmask2")) {
2744 }
else if (IsX86 && Name.endswith(
".movntdqa")) {
2759 (Name.startswith(
"sse2.pavg") || Name.startswith(
"avx2.pavg") ||
2760 Name.startswith(
"avx512.mask.pavg"))) {
2766 cast<VectorType>(A->
getType()));
2777 }
else if (IsX86 && (Name.startswith(
"fma.vfmadd.") ||
2778 Name.startswith(
"fma.vfmsub.") ||
2779 Name.startswith(
"fma.vfnmadd.") ||
2780 Name.startswith(
"fma.vfnmsub."))) {
2781 bool NegMul = Name[6] ==
'n';
2782 bool NegAcc = NegMul ? Name[8] ==
's' : Name[7] ==
's';
2783 bool IsScalar = NegMul ? Name[12] ==
's' : Name[11] ==
's';
2794 if (NegMul && !IsScalar)
2796 if (NegMul && IsScalar)
2809 }
else if (IsX86 && Name.startswith(
"fma4.vfmadd.s")) {
2824 }
else if (IsX86 && (Name.startswith(
"avx512.mask.vfmadd.s") ||
2825 Name.startswith(
"avx512.maskz.vfmadd.s") ||
2826 Name.startswith(
"avx512.mask3.vfmadd.s") ||
2827 Name.startswith(
"avx512.mask3.vfmsub.s") ||
2828 Name.startswith(
"avx512.mask3.vfnmsub.s"))) {
2829 bool IsMask3 = Name[11] ==
'3';
2830 bool IsMaskZ = Name[11] ==
'z';
2832 Name = Name.drop_front(IsMask3 || IsMaskZ ? 13 : 12);
2833 bool NegMul = Name[2] ==
'n';
2834 bool NegAcc = NegMul ? Name[4] ==
's' : Name[3] ==
's';
2840 if (NegMul && (IsMask3 || IsMaskZ))
2842 if (NegMul && !(IsMask3 || IsMaskZ))
2852 cast<ConstantInt>(CI->
getArgOperand(4))->getZExtValue() != 4) {
2856 if (Name.back() ==
'd')
2857 IID = Intrinsic::x86_avx512_vfmadd_f64;
2859 IID = Intrinsic::x86_avx512_vfmadd_f32;
2874 if (NegAcc && IsMask3)
2882 }
else if (IsX86 && (Name.startswith(
"avx512.mask.vfmadd.p") ||
2883 Name.startswith(
"avx512.mask.vfnmadd.p") ||
2884 Name.startswith(
"avx512.mask.vfnmsub.p") ||
2885 Name.startswith(
"avx512.mask3.vfmadd.p") ||
2886 Name.startswith(
"avx512.mask3.vfmsub.p") ||
2887 Name.startswith(
"avx512.mask3.vfnmsub.p") ||
2888 Name.startswith(
"avx512.maskz.vfmadd.p"))) {
2889 bool IsMask3 = Name[11] ==
'3';
2890 bool IsMaskZ = Name[11] ==
'z';
2892 Name = Name.drop_front(IsMask3 || IsMaskZ ? 13 : 12);
2893 bool NegMul = Name[2] ==
'n';
2894 bool NegAcc = NegMul ? Name[4] ==
's' : Name[3] ==
's';
2900 if (NegMul && (IsMask3 || IsMaskZ))
2902 if (NegMul && !(IsMask3 || IsMaskZ))
2909 cast<ConstantInt>(CI->
getArgOperand(4))->getZExtValue() != 4)) {
2912 if (Name[Name.size()-5] ==
's')
2913 IID = Intrinsic::x86_avx512_vfmadd_ps_512;
2915 IID = Intrinsic::x86_avx512_vfmadd_pd_512;
2931 }
else if (IsX86 && (Name.startswith(
"fma.vfmaddsub.p") ||
2932 Name.startswith(
"fma.vfmsubadd.p"))) {
2933 bool IsSubAdd = Name[7] ==
's';
2949 for (
int i = 0; i != NumElts; ++i)
2950 Idxs[i] = i + (i % 2) * NumElts;
2953 }
else if (IsX86 && (Name.startswith(
"avx512.mask.vfmaddsub.p") ||
2954 Name.startswith(
"avx512.mask3.vfmaddsub.p") ||
2955 Name.startswith(
"avx512.maskz.vfmaddsub.p") ||
2956 Name.startswith(
"avx512.mask3.vfmsubadd.p"))) {
2957 bool IsMask3 = Name[11] ==
'3';
2958 bool IsMaskZ = Name[11] ==
'z';
2960 Name = Name.drop_front(IsMask3 || IsMaskZ ? 13 : 12);
2961 bool IsSubAdd = Name[3] ==
's';
2964 cast<ConstantInt>(CI->
getArgOperand(4))->getZExtValue() != 4)) {
2967 if (Name[Name.size()-5] ==
's')
2968 IID = Intrinsic::x86_avx512_vfmaddsub_ps_512;
2970 IID = Intrinsic::x86_avx512_vfmaddsub_pd_512;
2996 for (
int i = 0; i != NumElts; ++i)
2997 Idxs[i] = i + (i % 2) * NumElts;
3007 }
else if (IsX86 && (Name.startswith(
"avx512.mask.pternlog.") ||
3008 Name.startswith(
"avx512.maskz.pternlog."))) {
3009 bool ZeroMask = Name[11] ==
'z';
3013 if (VecWidth == 128 && EltWidth == 32)
3014 IID = Intrinsic::x86_avx512_pternlog_d_128;
3015 else if (VecWidth == 256 && EltWidth == 32)
3016 IID = Intrinsic::x86_avx512_pternlog_d_256;
3017 else if (VecWidth == 512 && EltWidth == 32)
3018 IID = Intrinsic::x86_avx512_pternlog_d_512;
3019 else if (VecWidth == 128 && EltWidth == 64)
3020 IID = Intrinsic::x86_avx512_pternlog_q_128;
3021 else if (VecWidth == 256 && EltWidth == 64)
3022 IID = Intrinsic::x86_avx512_pternlog_q_256;
3023 else if (VecWidth == 512 && EltWidth == 64)
3024 IID = Intrinsic::x86_avx512_pternlog_q_512;
3035 }
else if (IsX86 && (Name.startswith(
"avx512.mask.vpmadd52") ||
3036 Name.startswith(
"avx512.maskz.vpmadd52"))) {
3037 bool ZeroMask = Name[11] ==
'z';
3038 bool High = Name[20] ==
'h' || Name[21] ==
'h';
3041 if (VecWidth == 128 && !High)
3042 IID = Intrinsic::x86_avx512_vpmadd52l_uq_128;
3043 else if (VecWidth == 256 && !High)
3044 IID = Intrinsic::x86_avx512_vpmadd52l_uq_256;
3045 else if (VecWidth == 512 && !High)
3046 IID = Intrinsic::x86_avx512_vpmadd52l_uq_512;
3047 else if (VecWidth == 128 && High)
3048 IID = Intrinsic::x86_avx512_vpmadd52h_uq_128;
3049 else if (VecWidth == 256 && High)
3050 IID = Intrinsic::x86_avx512_vpmadd52h_uq_256;
3051 else if (VecWidth == 512 && High)
3052 IID = Intrinsic::x86_avx512_vpmadd52h_uq_512;
3063 }
else if (IsX86 && (Name.startswith(
"avx512.mask.vpermi2var.") ||
3064 Name.startswith(
"avx512.mask.vpermt2var.") ||
3065 Name.startswith(
"avx512.maskz.vpermt2var."))) {
3066 bool ZeroMask = Name[11] ==
'z';
3067 bool IndexForm = Name[17] ==
'i';
3072 if (VecWidth == 128 && EltWidth == 32 && IsFloat)
3073 IID = Intrinsic::x86_avx512_vpermi2var_ps_128;
3074 else if (VecWidth == 128 && EltWidth == 32 && !IsFloat)
3075 IID = Intrinsic::x86_avx512_vpermi2var_d_128;
3076 else if (VecWidth == 128 && EltWidth == 64 && IsFloat)
3077 IID = Intrinsic::x86_avx512_vpermi2var_pd_128;
3078 else if (VecWidth == 128 && EltWidth == 64 && !IsFloat)
3079 IID = Intrinsic::x86_avx512_vpermi2var_q_128;
3080 else if (VecWidth == 256 && EltWidth == 32 && IsFloat)
3081 IID = Intrinsic::x86_avx512_vpermi2var_ps_256;
3082 else if (VecWidth == 256 && EltWidth == 32 && !IsFloat)
3083 IID = Intrinsic::x86_avx512_vpermi2var_d_256;
3084 else if (VecWidth == 256 && EltWidth == 64 && IsFloat)
3085 IID = Intrinsic::x86_avx512_vpermi2var_pd_256;
3086 else if (VecWidth == 256 && EltWidth == 64 && !IsFloat)
3087 IID = Intrinsic::x86_avx512_vpermi2var_q_256;
3088 else if (VecWidth == 512 && EltWidth == 32 && IsFloat)
3089 IID = Intrinsic::x86_avx512_vpermi2var_ps_512;
3090 else if (VecWidth == 512 && EltWidth == 32 && !IsFloat)
3091 IID = Intrinsic::x86_avx512_vpermi2var_d_512;
3092 else if (VecWidth == 512 && EltWidth == 64 && IsFloat)
3093 IID = Intrinsic::x86_avx512_vpermi2var_pd_512;
3094 else if (VecWidth == 512 && EltWidth == 64 && !IsFloat)
3095 IID = Intrinsic::x86_avx512_vpermi2var_q_512;
3096 else if (VecWidth == 128 && EltWidth == 16)
3097 IID = Intrinsic::x86_avx512_vpermi2var_hi_128;
3098 else if (VecWidth == 256 && EltWidth == 16)
3099 IID = Intrinsic::x86_avx512_vpermi2var_hi_256;
3100 else if (VecWidth == 512 && EltWidth == 16)
3101 IID = Intrinsic::x86_avx512_vpermi2var_hi_512;
3102 else if (VecWidth == 128 && EltWidth == 8)
3103 IID = Intrinsic::x86_avx512_vpermi2var_qi_128;
3104 else if (VecWidth == 256 && EltWidth == 8)
3105 IID = Intrinsic::x86_avx512_vpermi2var_qi_256;
3106 else if (VecWidth == 512 && EltWidth == 8)
3107 IID = Intrinsic::x86_avx512_vpermi2var_qi_512;
3124 }
else if (IsX86 && (Name.startswith(
"avx512.mask.vpdpbusd.") ||
3125 Name.startswith(
"avx512.maskz.vpdpbusd.") ||
3126 Name.startswith(
"avx512.mask.vpdpbusds.") ||
3127 Name.startswith(
"avx512.maskz.vpdpbusds."))) {
3128 bool ZeroMask = Name[11] ==
'z';
3129 bool IsSaturating = Name[ZeroMask ? 21 : 20] ==
's';
3132 if (VecWidth == 128 && !IsSaturating)
3133 IID = Intrinsic::x86_avx512_vpdpbusd_128;
3134 else if (VecWidth == 256 && !IsSaturating)
3135 IID = Intrinsic::x86_avx512_vpdpbusd_256;
3136 else if (VecWidth == 512 && !IsSaturating)
3137 IID = Intrinsic::x86_avx512_vpdpbusd_512;
3138 else if (VecWidth == 128 && IsSaturating)
3139 IID = Intrinsic::x86_avx512_vpdpbusds_128;
3140 else if (VecWidth == 256 && IsSaturating)
3141 IID = Intrinsic::x86_avx512_vpdpbusds_256;
3142 else if (VecWidth == 512 && IsSaturating)
3143 IID = Intrinsic::x86_avx512_vpdpbusds_512;
3154 }
else if (IsX86 && (Name.startswith(
"avx512.mask.vpdpwssd.") ||
3155 Name.startswith(
"avx512.maskz.vpdpwssd.") ||
3156 Name.startswith(
"avx512.mask.vpdpwssds.") ||
3157 Name.startswith(
"avx512.maskz.vpdpwssds."))) {
3158 bool ZeroMask = Name[11] ==
'z';
3159 bool IsSaturating = Name[ZeroMask ? 21 : 20] ==
's';
3162 if (VecWidth == 128 && !IsSaturating)
3163 IID = Intrinsic::x86_avx512_vpdpwssd_128;
3164 else if (VecWidth == 256 && !IsSaturating)
3165 IID = Intrinsic::x86_avx512_vpdpwssd_256;
3166 else if (VecWidth == 512 && !IsSaturating)
3167 IID = Intrinsic::x86_avx512_vpdpwssd_512;
3168 else if (VecWidth == 128 && IsSaturating)
3169 IID = Intrinsic::x86_avx512_vpdpwssds_128;
3170 else if (VecWidth == 256 && IsSaturating)
3171 IID = Intrinsic::x86_avx512_vpdpwssds_256;
3172 else if (VecWidth == 512 && IsSaturating)
3173 IID = Intrinsic::x86_avx512_vpdpwssds_512;
3184 }
else if (IsX86 && Name.startswith(
"avx512.mask.") &&
3187 }
else if (IsNVVM && (Name ==
"abs.i" || Name ==
"abs.ll")) {
3193 }
else if (IsNVVM && (Name ==
"max.i" || Name ==
"max.ll" ||
3194 Name ==
"max.ui" || Name ==
"max.ull")) {
3197 Value *Cmp = Name.endswith(
".ui") || Name.endswith(
".ull")
3201 }
else if (IsNVVM && (Name ==
"min.i" || Name ==
"min.ll" ||
3202 Name ==
"min.ui" || Name ==
"min.ull")) {
3205 Value *Cmp = Name.endswith(
".ui") || Name.endswith(
".ull")
3209 }
else if (IsNVVM && Name ==
"clz.ll") {
3217 }
else if (IsNVVM && Name ==
"popc.ll") {
3226 }
else if (IsNVVM && Name ==
"h2f") {
3228 F->
getParent(), Intrinsic::convert_from_fp16,
3241 const auto &DefaultCase = [&NewFn, &CI]() ->
void {
3245 "Unknown function for CallInst upgrade and isn't just a name change");
3255 case Intrinsic::arm_neon_vld1:
3256 case Intrinsic::arm_neon_vld2:
3257 case Intrinsic::arm_neon_vld3:
3258 case Intrinsic::arm_neon_vld4:
3259 case Intrinsic::arm_neon_vld2lane:
3260 case Intrinsic::arm_neon_vld3lane:
3261 case Intrinsic::arm_neon_vld4lane:
3262 case Intrinsic::arm_neon_vst1:
3263 case Intrinsic::arm_neon_vst2:
3264 case Intrinsic::arm_neon_vst3:
3265 case Intrinsic::arm_neon_vst4:
3266 case Intrinsic::arm_neon_vst2lane:
3267 case Intrinsic::arm_neon_vst3lane:
3268 case Intrinsic::arm_neon_vst4lane: {
3275 case Intrinsic::bitreverse:
3279 case Intrinsic::ctlz:
3280 case Intrinsic::cttz:
3282 "Mismatch between function args and call args");
3287 case Intrinsic::objectsize: {
3296 case Intrinsic::ctpop:
3300 case Intrinsic::convert_from_fp16:
3304 case Intrinsic::dbg_value:
3309 if (
Offset->isZeroValue()) {
3318 case Intrinsic::x86_xop_vfrcz_ss:
3319 case Intrinsic::x86_xop_vfrcz_sd:
3323 case Intrinsic::x86_xop_vpermil2pd:
3324 case Intrinsic::x86_xop_vpermil2ps:
3325 case Intrinsic::x86_xop_vpermil2pd_256:
3326 case Intrinsic::x86_xop_vpermil2ps_256: {
3336 case Intrinsic::x86_sse41_ptestc:
3337 case Intrinsic::x86_sse41_ptestz:
3338 case Intrinsic::x86_sse41_ptestnzc: {
3355 NewCall = Builder.
CreateCall(NewFn, {BC0, BC1});
3359 case Intrinsic::x86_sse41_insertps:
3360 case Intrinsic::x86_sse41_dppd:
3361 case Intrinsic::x86_sse41_dpps:
3362 case Intrinsic::x86_sse41_mpsadbw:
3363 case Intrinsic::x86_avx_dp_ps_256:
3364 case Intrinsic::x86_avx2_mpsadbw: {
3376 case Intrinsic::thread_pointer: {
3381 case Intrinsic::invariant_start:
3382 case Intrinsic::invariant_end:
3383 case Intrinsic::masked_load:
3384 case Intrinsic::masked_store:
3385 case Intrinsic::masked_gather:
3386 case Intrinsic::masked_scatter: {
3393 case Intrinsic::memcpy:
3394 case Intrinsic::memmove:
3395 case Intrinsic::memset: {
3412 auto *MemCI = cast<MemIntrinsic>(NewCall);
3415 MemCI->setDestAlignment(Align->getZExtValue());
3417 if (
auto *MTI = dyn_cast<MemTransferInst>(MemCI))
3418 MTI->setSourceAlignment(Align->getZExtValue());
3422 assert(NewCall &&
"Should have either set this variable or returned through " 3423 "the default case");
3425 if (!Name.empty()) {
3434 assert(F &&
"Illegal attempt to upgrade a non-existent intrinsic.");
3443 if (
CallInst *CI = dyn_cast<CallInst>(*UI++))
3461 Metadata *Elts2[] = {ScalarType, ScalarType,
3475 if (Opc != Instruction::BitCast)
3496 if (Opc != Instruction::BitCast)
3520 bool BrokenDebugInfo =
false;
3523 if (!BrokenDebugInfo)
3542 bool Changed =
false;
3545 if (ModRetainReleaseMarker) {
3552 if (ValueComp.
size() == 2) {
3553 std::string NewValue = ValueComp[0].str() +
";" + ValueComp[1].str();
3570 bool HasObjCFlag =
false, HasClassProperties =
false, Changed =
false;
3578 if (ID->
getString() ==
"Objective-C Image Info Version")
3580 if (ID->
getString() ==
"Objective-C Class Properties")
3581 HasClassProperties =
true;
3585 if (
auto *Behavior =
3586 mdconst::dyn_extract_or_null<ConstantInt>(Op->
getOperand(0))) {
3601 if (ID->
getString() ==
"Objective-C Image Info Section") {
3604 Value->getString().split(ValueComp,
" ");
3605 if (ValueComp.
size() != 1) {
3606 std::string NewValue;
3607 for (
auto &S : ValueComp)
3608 NewValue += S.str();
3623 if (HasObjCFlag && !HasClassProperties) {
3635 Section.split(Components,
',');
3640 for (
auto Component : Components)
3641 OS <<
',' << Component.trim();
3646 for (
auto &GV : M.
globals()) {
3647 if (!GV.hasSection())
3652 if (!Section.
startswith(
"__DATA, __objc_catlist"))
3657 GV.setSection(TrimSpaces(Section));
3662 auto *
T = dyn_cast_or_null<MDTuple>(MD);
3665 if (
T->getNumOperands() < 1)
3667 auto *S = dyn_cast_or_null<MDString>(
T->getOperand(0));
3670 return S->getString().startswith(
"llvm.vectorizer.");
3674 StringRef OldPrefix =
"llvm.vectorizer.";
3677 if (OldTag ==
"llvm.vectorizer.unroll")
3686 auto *
T = dyn_cast_or_null<MDTuple>(MD);
3689 if (
T->getNumOperands() < 1)
3691 auto *OldTag = dyn_cast_or_null<MDString>(
T->getOperand(0));
3694 if (!OldTag->getString().startswith(
"llvm.vectorizer."))
3701 for (
unsigned I = 1,
E =
T->getNumOperands();
I !=
E; ++
I)
IntegerType * getInt16Ty()
Fetch the type representing a 16-bit integer.
static unsigned getBitWidth(Type *Ty, const DataLayout &DL)
Returns the bitwidth of the given scalar or pointer type.
Type * getVectorElementType() const
static bool UpgradeIntrinsicFunction1(Function *F, Function *&NewFn)
SymbolTableList< Instruction >::iterator eraseFromParent()
This method unlinks 'this' from the containing basic block and deletes it.
void push_back(const T &Elt)
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
Function * getCalledFunction() const
Return the function called, or null if this is an indirect function invocation.
Value * CreateICmp(CmpInst::Predicate P, Value *LHS, Value *RHS, const Twine &Name="")
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata *> MDs)
raw_ostream & errs()
This returns a reference to a raw_ostream for standard error.
static IntegerType * getInt1Ty(LLVMContext &C)
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
Value * CreateIsNotNull(Value *Arg, const Twine &Name="")
Return an i1 value testing if Arg is not null.
void UpgradeSectionAttributes(Module &M)
Takes the max of the two values, which are required to be integers.
MDNode * getOperand(unsigned i) const
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
Compute iterated dominance frontiers using a linear time algorithm.
Type * getParamType(unsigned i) const
Parameter type accessors.
Value * CreateXor(Value *LHS, Value *RHS, const Twine &Name="")
A Module instance is used to store all the information related to an LLVM module. ...
static MDString * get(LLVMContext &Context, StringRef Str)
bool UpgradeRetainReleaseMarker(Module &M)
This checks for objc retain release marker which should be upgraded.
static Value * upgradeAbs(IRBuilder<> &Builder, CallInst &CI)
static ConstantAggregateZero * get(Type *Ty)
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
static Value * ApplyX86MaskOn1BitsVec(IRBuilder<> &Builder, Value *Vec, Value *Mask)
This class represents a function call, abstracting a target machine's calling convention.
static Constant * getIntToPtr(Constant *C, Type *Ty, bool OnlyIfReduced=false)
void UpgradeInlineAsmString(std::string *AsmStr)
Upgrade comment in call to inline asm that represents an objc retain release marker.
unsigned getDebugMetadataVersionFromModule(const Module &M)
Return Debug Info Metadata Version by checking module flags.
LLVMContext & getContext() const
All values hold a context through their type.
A raw_ostream that writes to an SmallVector or SmallString.
Value * CreateSExt(Value *V, Type *DestTy, const Twine &Name="")
const MDOperand & getOperand(unsigned I) const
unsigned getPointerAddressSpace() const
Get the address space of this pointer or pointer vector type.
An instruction for reading from memory.
static IntegerType * getInt64Ty(LLVMContext &C)
Value * CreateICmpULE(Value *LHS, Value *RHS, const Twine &Name="")
void reserve(size_type N)
void UpgradeIntrinsicCall(CallInst *CI, Function *NewFn)
This is the complement to the above, replacing a specific call to an intrinsic function with a call t...
static Value * EmitX86Select(IRBuilder<> &Builder, Value *Mask, Value *Op0, Value *Op1)
void setOperand(unsigned I, MDNode *New)
static Value * upgradeIntMinMax(IRBuilder<> &Builder, CallInst &CI, ICmpInst::Predicate Pred)
static Constant * getNullValue(Type *Ty)
Constructor to create a '0' constant of arbitrary type.
Value * CreateNot(Value *V, const Twine &Name="")
StoreInst * CreateAlignedStore(Value *Val, Value *Ptr, unsigned Align, bool isVolatile=false)
IntegerType * getInt32Ty()
Fetch the type representing a 32-bit integer.
unsigned getBitWidth() const
Return the number of bits in the Vector type.
static Value * UpgradeX86PSRLDQIntrinsics(IRBuilder<> &Builder, Value *Op, unsigned Shift)
Value * CreateFPExt(Value *V, Type *DestTy, const Twine &Name="")
MDNode * upgradeInstructionLoopAttachment(MDNode &N)
Upgrade the loop attachment metadata node.
StringRef getName(ID id)
Return the LLVM name for an intrinsic, such as "llvm.ppc.altivec.lvx".
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
void UpgradeCallsToIntrinsic(Function *F)
This is an auto-upgrade hook for any old intrinsic function syntaxes which need to have both the func...
static Type * getFloatTy(LLVMContext &C)
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
LLVMContext & getContext() const
Get the global data context.
static bool ShouldUpgradeX86Intrinsic(Function *F, StringRef Name)
PointerType * getPointerTo(unsigned AddrSpace=0) const
Return a pointer to the current type.
bool isIntegerTy() const
True if this is an instance of IntegerType.
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
static Constant * AddOne(Constant *C)
Add one to a Constant.
bool none_of(R &&Range, UnaryPredicate P)
Provide wrappers to std::none_of which take ranges instead of having to pass begin/end explicitly...
unsigned getNumOperands() const
Value * CreateAdd(Value *LHS, Value *RHS, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)
static Value * UpgradeMaskToInt(IRBuilder<> &Builder, CallInst &CI)
void setName(const Twine &Name)
Change the name of the value.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE R Default(T Value)
uint64_t getNumElements() const
static Metadata * upgradeLoopArgument(Metadata *MD)
AttributeList getAttributes(LLVMContext &C, ID id)
Return the attributes for an intrinsic.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool startswith(StringRef Prefix) const
Check if this string starts with the given Prefix.
llvm::Optional< Function * > remangleIntrinsicFunction(Function *F)
Class to represent function types.
Value * CreateBitCast(Value *V, Type *DestTy, const Twine &Name="")
Type * getType() const
All values are typed, get the type of this value.
LLVMContext & getContext() const
bool StripDebugInfo(Module &M)
Strip debug info in the module if it exists.
NamedMDNode * getNamedMetadata(const Twine &Name) const
Return the first NamedMDNode in the module with the specified name.
static Value * EmitX86ScalarSelect(IRBuilder<> &Builder, Value *Mask, Value *Op0, Value *Op1)
Value * CreateVectorSplat(unsigned NumElts, Value *V, const Twine &Name="")
Return a vector value that contains.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
bool UpgradeIntrinsicFunction(Function *F, Function *&NewFn)
This is a more granular function that simply checks an intrinsic function for upgrading, and returns true if it requires upgrading.
Value * CreateSub(Value *LHS, Value *RHS, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)
Value * CreateSIToFP(Value *V, Type *DestTy, const Twine &Name="")
An instruction for storing to memory.
LinkageTypes getLinkage() const
void replaceAllUsesWith(Value *V)
Change all uses of this to point to a new Value.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
Value * CreateZExt(Value *V, Type *DestTy, const Twine &Name="")
Function * getDeclaration(Module *M, ID id, ArrayRef< Type *> Tys=None)
Create or insert an LLVM Function declaration for an intrinsic, and return it.
static Value * UpgradeMaskedLoad(IRBuilder<> &Builder, Value *Ptr, Value *Passthru, Value *Mask, bool Aligned)
void SetInsertPoint(BasicBlock *TheBB)
This specifies that created instructions should be appended to the end of the specified block...
Class to represent pointers.
static Value * UpgradeX86PSLLDQIntrinsics(IRBuilder<> &Builder, Value *Op, unsigned Shift)
Value * CreateOr(Value *LHS, Value *RHS, const Twine &Name="")
bool UpgradeModuleFlags(Module &M)
This checks for module flags which should be upgraded.
Value * getOperand(unsigned i_nocapture) const
StringRef getString() const
static Value * UpgradeMaskedStore(IRBuilder<> &Builder, Value *Ptr, Value *Data, Value *Mask, bool Aligned)
LoadInst * CreateLoad(Value *Ptr, const char *Name)
Provided to resolve 'CreateLoad(Ptr, "...")' correctly, instead of converting the string to 'bool' fo...
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata *> MDs)
A switch()-like statement whose cases are string literals.
Type * getReturnType() const
Returns the type of the ret val.
void getModuleFlagsMetadata(SmallVectorImpl< ModuleFlagEntry > &Flags) const
Returns the module flags in the provided vector.
Emits an error if two values disagree, otherwise the resulting value is that of the operands...
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
Value * CreateFMul(Value *L, Value *R, const Twine &Name="", MDNode *FPMD=nullptr)
Value * CreateAShr(Value *LHS, Value *RHS, const Twine &Name="", bool isExact=false)
constexpr bool isPowerOf2_32(uint32_t Value)
Return true if the argument is a power of two > 0.
The instances of the Type class are immutable: once they are created, they are never changed...
This is an important class for using LLVM in a threaded context.
ConstantInt * getInt1(bool V)
Get a constant value representing either true or false.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This is an important base class in LLVM.
This file contains the declarations for the subclasses of Constant, which represent the different fla...
Value * CreateSelect(Value *C, Value *True, Value *False, const Twine &Name="", Instruction *MDFrom=nullptr)
unsigned getNumParams() const
Return the number of fixed parameters this function type requires.
bool UpgradeDebugInfo(Module &M)
Check the debug info version number, if it is out-dated, drop the debug info.
ArrayRef< Type * > params() const
static VectorType * getInteger(VectorType *VTy)
This static method gets a VectorType with the same number of elements as the input type...
void addModuleFlag(ModFlagBehavior Behavior, StringRef Key, Metadata *Val)
Add a module-level flag to the module-level flags metadata.
Value * CreateNeg(Value *V, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)
static bool UpgradeX86IntrinsicsWith8BitMask(Function *F, Intrinsic::ID IID, Function *&NewFn)
void setCalledFunction(Value *Fn)
Set the function called.
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
Value * CreateICmpSGE(Value *LHS, Value *RHS, const Twine &Name="")
static FunctionType * get(Type *Result, ArrayRef< Type *> Params, bool isVarArg)
This static method is the primary way of constructing a FunctionType.
Value * CreateICmpEQ(Value *LHS, Value *RHS, const Twine &Name="")
self_iterator getIterator()
IntegerType * getIntNTy(unsigned N)
Fetch the type representing an N-bit integer.
Value * CreateExtractElement(Value *Vec, Value *Idx, const Twine &Name="")
static Constant * getAllOnesValue(Type *Ty)
LLVMContext & getContext() const
getContext - Return a reference to the LLVMContext associated with this function. ...
static UndefValue * get(Type *T)
Static factory methods - Return an 'undef' object of the specified type.
iterator_range< User::op_iterator > arg_operands()
Iteration adapter for range-for loops.
static wasm::ValType getType(const TargetRegisterClass *RC)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
void setMetadata(unsigned KindID, MDNode *Node)
Set the metadata of the specified kind to the specified node.
Value * CreateMul(Value *LHS, Value *RHS, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)
Value * CreateTrunc(Value *V, Type *DestTy, const Twine &Name="")
static bool UpgradeX86IntrinsicFunction(Function *F, StringRef Name, Function *&NewFn)
Value * CreateUIToFP(Value *V, Type *DestTy, const Twine &Name="")
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef drop_front(size_t N=1) const
Return a StringRef equal to 'this' but with the first N elements dropped.
static Value * getX86MaskVec(IRBuilder<> &Builder, Value *Mask, unsigned NumElts)
bool isPtrOrPtrVectorTy() const
Return true if this is a pointer type or a vector of pointer types.
static Value * UpgradeX86ALIGNIntrinsics(IRBuilder<> &Builder, Value *Op0, Value *Op1, Value *Shift, Value *Passthru, Value *Mask, bool IsVALIGN)
Instruction * UpgradeBitCastInst(unsigned Opc, Value *V, Type *DestTy, Instruction *&Temp)
This is an auto-upgrade for bitcast between pointers with different address spaces: the instruction i...
static bool upgradeAVX512MaskToSelect(StringRef Name, IRBuilder<> &Builder, CallInst &CI, Value *&Rep)
static PointerType * getUnqual(Type *ElementType)
This constructs a pointer to an object of the specified type in the generic address space (address sp...
This is the shared class of boolean and integer constants.
unsigned getScalarSizeInBits() const LLVM_READONLY
If this is a vector type, return the getPrimitiveSizeInBits value for the element type...
Value * CreateICmpUGE(Value *LHS, Value *RHS, const Twine &Name="")
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
static MDString * upgradeLoopTag(LLVMContext &C, StringRef OldTag)
Module.h This file contains the declarations for the Module class.
bool UpgradeGlobalVariable(GlobalVariable *GV)
This checks for global variables which should be upgraded.
Value * CreateInsertElement(Value *Vec, Value *NewElt, Value *Idx, const Twine &Name="")
LLVM_NODISCARD std::pair< StringRef, StringRef > split(char Separator) const
Split into two substrings around the first occurrence of a separator character.
CallInst * CreateMaskedStore(Value *Val, Value *Ptr, unsigned Align, Value *Mask)
Create a call to Masked Store intrinsic.
Value * CreateShuffleVector(Value *V1, Value *V2, Value *Mask, const Twine &Name="")
StringRef str()
Return a StringRef for the vector contents.
static Constant * get(Type *Ty, uint64_t V, bool isSigned=false)
If Ty is a vector type, return a Constant with a splat of the given value.
CallInst * CreateMaskedLoad(Value *Ptr, unsigned Align, Value *Mask, Value *PassThru=nullptr, const Twine &Name="")
Create a call to Masked Load intrinsic.
static Value * UpgradeX86MaskedShift(IRBuilder<> &Builder, CallInst &CI, Intrinsic::ID IID)
void setAttributes(AttributeList Attrs)
Set the attribute list for this Function.
static VectorType * getExtendedElementVectorType(VectorType *VTy)
This static method is like getInteger except that the element types are twice as wide as the elements...
Intrinsic::ID getIntrinsicID() const LLVM_READONLY
getIntrinsicID - This method returns the ID number of the specified function, or Intrinsic::not_intri...
Uses the specified value, regardless of the behavior or value of the other module.
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
unsigned getVectorNumElements() const
FunctionType * getFunctionType() const
Returns the FunctionType for me.
MDNode * UpgradeTBAANode(MDNode &TBAANode)
If the given TBAA tag uses the scalar TBAA format, create a new node corresponding to the upgrade to ...
Class to represent vector types.
const Module * getModule() const
Return the module owning the function this instruction belongs to or nullptr it the function does not...
Class for arbitrary precision integers.
IntegerType * getInt8Ty()
Fetch the type representing an 8-bit integer.
Value * CreateShl(Value *LHS, Value *RHS, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)
LLVM_ATTRIBUTE_ALWAYS_INLINE StringSwitch & Case(StringLiteral S, T Value)
Value * CreatePointerCast(Value *V, Type *DestTy, const Twine &Name="")
bool verifyModule(const Module &M, raw_ostream *OS=nullptr, bool *BrokenDebugInfo=nullptr)
Check a module for errors.
ConstantInt * getFalse()
Get the constant value for i1 false.
amdgpu Simplify well known AMD library false Value Value * Arg
IntegerType * getInt1Ty()
Fetch the type representing a single bit.
static CastInst * Create(Instruction::CastOps, Value *S, Type *Ty, const Twine &Name="", Instruction *InsertBefore=nullptr)
Provides a way to construct any of the CastInst subclasses using an opcode instead of the subclass's ...
static bool isOldLoopArgument(Metadata *MD)
static IntegerType * getInt32Ty(LLVMContext &C)
unsigned getIntegerBitWidth() const
unsigned getNumArgOperands() const
Return the number of call arguments.
unsigned greater or equal
StringRef getName() const
Return a constant reference to the value's name.
static Constant * getPtrToInt(Constant *C, Type *Ty, bool OnlyIfReduced=false)
Value * CreateFSub(Value *L, Value *R, const Twine &Name="", MDNode *FPMD=nullptr)
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static Value * upgradeMaskedMove(IRBuilder<> &Builder, CallInst &CI)
static void rename(GlobalValue *GV)
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
LLVM_ATTRIBUTE_ALWAYS_INLINE StringSwitch & Cases(StringLiteral S0, StringLiteral S1, T Value)
static Value * upgradeMaskedCompare(IRBuilder<> &Builder, CallInst &CI, unsigned CC, bool Signed)
void eraseFromParent()
eraseFromParent - This method unlinks 'this' from the containing module and deletes it...
Type * getFloatTy()
Fetch the type representing a 32-bit floating point value.
void diagnose(const DiagnosticInfo &DI)
Report a message to the currently installed diagnostic handler.
Value * CreateFAdd(Value *L, Value *R, const Twine &Name="", MDNode *FPMD=nullptr)
Value * CreateAnd(Value *LHS, Value *RHS, const Twine &Name="")
Value * CreateFDiv(Value *L, Value *R, const Twine &Name="", MDNode *FPMD=nullptr)
static bool UpgradePTESTIntrinsic(Function *F, Intrinsic::ID IID, Function *&NewFn)
bool isFPOrFPVectorTy() const
Return true if this is a FP type or a vector of FP.
unsigned getMDKindID(StringRef Name) const
Return a unique non-zero ID for the specified metadata kind.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
user_iterator user_begin()
Value * getArgOperand(unsigned i) const
getArgOperand/setArgOperand - Return/set the i-th call argument.
LoadInst * CreateAlignedLoad(Value *Ptr, unsigned Align, const char *Name)
Provided to resolve 'CreateAlignedLoad(Ptr, Align, "...")' correctly, instead of converting the strin...
unsigned getPrimitiveSizeInBits() const LLVM_READONLY
Return the basic size of this type if it is a primitive type.
Module * getParent()
Get the module that this global value is contained inside of...
LLVM Value Representation.
FMA - Perform a * b + c with no intermediate rounding step.
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
static VectorType * get(Type *ElementType, unsigned NumElements)
This static method is the primary way to construct an VectorType.
std::underlying_type< E >::type Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
Value * CreateLShr(Value *LHS, Value *RHS, const Twine &Name="", bool isExact=false)
bool match(StringRef String, SmallVectorImpl< StringRef > *Matches=nullptr)
matches - Match the regex against a given String.
ConstantInt * getInt8(uint8_t C)
Get a constant 8-bit value.
iterator_range< global_iterator > globals()
StringRef - Represent a constant reference to a string, i.e.
static Function * Create(FunctionType *Ty, LinkageTypes Linkage, const Twine &N="", Module *M=nullptr)
static Value * upgradePMULDQ(IRBuilder<> &Builder, CallInst &CI, bool IsSigned)
Value * UpgradeBitCastExpr(unsigned Opc, Constant *C, Type *DestTy)
This is an auto-upgrade for bitcast constant expression between pointers with different address space...
unsigned getNumOperands() const
Return number of MDNode operands.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t find(char C, size_t From=0) const
Search for the first character C in the string.
Value * CreateICmpSLE(Value *LHS, Value *RHS, const Twine &Name="")
static IntegerType * getInt8Ty(LLVMContext &C)
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
Value * CreateFNeg(Value *V, const Twine &Name="", MDNode *FPMathTag=nullptr)
const BasicBlock * getParent() const
CallInst * CreateCall(Value *Callee, ArrayRef< Value *> Args=None, const Twine &Name="", MDNode *FPMathTag=nullptr)