74 if (Name ==
"addcarryx.u32" ||
75 Name ==
"addcarryx.u64" ||
76 Name ==
"addcarry.u32" ||
77 Name ==
"addcarry.u64" ||
78 Name ==
"subborrow.u32" ||
79 Name ==
"subborrow.u64" ||
94 Name==
"ssse3.pabs.b.128" ||
95 Name==
"ssse3.pabs.w.128" ||
96 Name==
"ssse3.pabs.d.128" ||
121 Name ==
"sse.sqrt.ss" ||
122 Name ==
"sse2.sqrt.sd" ||
135 Name ==
"avx2.vperm2i128" ||
136 Name ==
"sse.add.ss" ||
137 Name ==
"sse2.add.sd" ||
138 Name ==
"sse.sub.ss" ||
139 Name ==
"sse2.sub.sd" ||
140 Name ==
"sse.mul.ss" ||
141 Name ==
"sse2.mul.sd" ||
142 Name ==
"sse.div.ss" ||
143 Name ==
"sse2.div.sd" ||
144 Name ==
"sse41.pmaxsb" ||
145 Name ==
"sse2.pmaxs.w" ||
146 Name ==
"sse41.pmaxsd" ||
147 Name ==
"sse2.pmaxu.b" ||
148 Name ==
"sse41.pmaxuw" ||
149 Name ==
"sse41.pmaxud" ||
150 Name ==
"sse41.pminsb" ||
151 Name ==
"sse2.pmins.w" ||
152 Name ==
"sse41.pminsd" ||
153 Name ==
"sse2.pminu.b" ||
154 Name ==
"sse41.pminuw" ||
155 Name ==
"sse41.pminud" ||
156 Name ==
"avx512.kand.w" ||
157 Name ==
"avx512.kandn.w" ||
158 Name ==
"avx512.knot.w" ||
159 Name ==
"avx512.kor.w" ||
160 Name ==
"avx512.kxor.w" ||
161 Name ==
"avx512.kxnor.w" ||
162 Name ==
"avx512.kortestc.w" ||
163 Name ==
"avx512.kortestz.w" ||
202 Name ==
"avx512.mask.cvtudq2ps.128" ||
203 Name ==
"avx512.mask.cvtudq2ps.256" ||
204 Name ==
"avx512.mask.cvtqq2pd.128" ||
205 Name ==
"avx512.mask.cvtqq2pd.256" ||
206 Name ==
"avx512.mask.cvtuqq2pd.128" ||
207 Name ==
"avx512.mask.cvtuqq2pd.256" ||
208 Name ==
"avx512.mask.cvtdq2ps.128" ||
209 Name ==
"avx512.mask.cvtdq2ps.256" ||
210 Name ==
"avx512.mask.cvtpd2dq.256" ||
211 Name ==
"avx512.mask.cvtpd2ps.256" ||
212 Name ==
"avx512.mask.cvttpd2dq.256" ||
213 Name ==
"avx512.mask.cvttps2dq.128" ||
214 Name ==
"avx512.mask.cvttps2dq.256" ||
215 Name ==
"avx512.mask.cvtps2pd.128" ||
216 Name ==
"avx512.mask.cvtps2pd.256" ||
217 Name ==
"avx512.cvtusi2sd" ||
220 Name ==
"sse2.pmulu.dq" ||
221 Name ==
"sse41.pmuldq" ||
222 Name ==
"avx2.pmulu.dq" ||
223 Name ==
"avx2.pmul.dq" ||
224 Name ==
"avx512.pmulu.dq.512" ||
225 Name ==
"avx512.pmul.dq.512" ||
276 Name.
startswith(
"avx512.maskz.vpermt2var.") ||
301 Name.
startswith(
"avx512.mask.vpshufbitqmb.") ||
302 Name.
startswith(
"avx512.mask.pmultishift.qb.") ||
303 Name ==
"sse.cvtsi2ss" ||
304 Name ==
"sse.cvtsi642ss" ||
305 Name ==
"sse2.cvtsi2sd" ||
306 Name ==
"sse2.cvtsi642sd" ||
307 Name ==
"sse2.cvtss2sd" ||
308 Name ==
"sse2.cvtdq2pd" ||
309 Name ==
"sse2.cvtdq2ps" ||
310 Name ==
"sse2.cvtps2pd" ||
311 Name ==
"avx.cvtdq2.pd.256" ||
312 Name ==
"avx.cvtdq2.ps.256" ||
313 Name ==
"avx.cvt.ps2.pd.256" ||
315 Name ==
"avx2.vinserti128" ||
318 Name ==
"avx2.vextracti128" ||
323 Name ==
"sse41.movntdqa" ||
324 Name ==
"avx2.movntdqa" ||
325 Name ==
"avx512.movntdqa" ||
326 Name ==
"sse2.storel.dq" ||
336 Name ==
"avx512.mask.store.ss" ||
339 Name.
startswith(
"avx512.mask.expand.load.") ||
340 Name.
startswith(
"avx512.mask.compress.store.") ||
341 Name ==
"sse42.crc32.64.8" ||
352 Name ==
"sse41.pblendw" ||
355 Name ==
"avx2.pblendw" ||
358 Name ==
"avx2.vbroadcasti128" ||
361 Name ==
"xop.vpcmov" ||
362 Name ==
"xop.vpcmov.256" ||
397 if (Name ==
"rdtscp") {
410 if (Name.
substr(11) ==
"c")
412 if (Name.
substr(11) ==
"z")
414 if (Name.
substr(11) ==
"nzc")
419 if (Name ==
"sse41.insertps")
422 if (Name ==
"sse41.dppd")
425 if (Name ==
"sse41.dpps")
428 if (Name ==
"sse41.mpsadbw")
431 if (Name ==
"avx.dp.ps.256")
434 if (Name ==
"avx2.mpsadbw")
454 if (Idx->isFPOrFPVectorTy()) {
456 unsigned IdxSize = Idx->getPrimitiveSizeInBits();
457 unsigned EltSize = Idx->getScalarSizeInBits();
459 if (EltSize == 64 && IdxSize == 128)
461 else if (EltSize == 32 && IdxSize == 128)
463 else if (EltSize == 64 && IdxSize == 256)
472 if (Name ==
"seh.recoverfp") {
481 assert(F &&
"Illegal to upgrade a non-existent Function.");
515 Regex vldRegex(
"^arm\\.neon\\.vld([1234]|[234]lane)\\.v[a-z0-9]*$");
516 if (vldRegex.
match(Name)) {
523 "llvm." + Name +
".p0i8", F->
getParent());
526 Regex vstRegex(
"^arm\\.neon\\.vst([1234]|[234]lane)\\.v[a-z0-9]*$");
527 if (vstRegex.
match(Name)) {
539 Type *Tys[] = {fArgs[0], fArgs[1]};
542 StoreInts[fArgs.size() - 3], Tys);
545 StoreLaneInts[fArgs.size() - 5], Tys);
548 if (Name ==
"aarch64.thread.pointer" || Name ==
"arm.thread.pointer") {
571 if (Name ==
"dbg.value" && F->
arg_size() == 4) {
580 bool IsLifetimeStart = Name.
startswith(
"lifetime.start");
581 if (IsLifetimeStart || Name.
startswith(
"invariant.start")) {
593 bool IsLifetimeEnd = Name.
startswith(
"lifetime.end");
594 if (IsLifetimeEnd || Name.
startswith(
"invariant.end")) {
599 Type* ObjectPtr[1] = {
Args[IsLifetimeEnd ? 1 : 2]};
606 if (Name.
startswith(
"invariant.group.barrier")) {
685 Type *ParamTypes[2] = {
716 .Cases(
"abs.i",
"abs.ll",
true)
717 .
Cases(
"clz.ll",
"popc.ll",
"h2f",
true)
718 .
Cases(
"max.i",
"max.ll",
"max.ui",
"max.ull",
true)
719 .
Cases(
"min.i",
"min.ll",
"min.ui",
"min.ull",
true)
744 if (Name ==
"stackprotectorcheck") {
756 if (Result !=
None) {
757 NewFn = Result.getValue();
771 assert(F != NewFn &&
"Intrinsic function upgraded to the same function");
805 for (
unsigned l = 0; l != NumElts; l += 16)
806 for (
unsigned i = 0; i != 16; ++i) {
807 unsigned Idx = NumElts + i - Shift;
810 Idxs[l + i] = Idx + l;
839 for (
unsigned l = 0; l != NumElts; l += 16)
840 for (
unsigned i = 0; i != 16; ++i) {
841 unsigned Idx = i + Shift;
844 Idxs[l + i] = Idx + l;
864 for (
unsigned i = 0; i != NumElts; ++i)
877 if (
const auto *
C = dyn_cast<Constant>(Mask))
878 if (
C->isAllOnesValue())
888 if (
const auto *
C = dyn_cast<Constant>(Mask))
889 if (
C->isAllOnesValue())
907 unsigned ShiftVal = cast<llvm::ConstantInt>(Shift)->getZExtValue();
910 assert((IsVALIGN || NumElts % 16 == 0) &&
"Illegal NumElts for PALIGNR!");
911 assert((!IsVALIGN || NumElts <= 16) &&
"NumElts too large for VALIGN!");
916 ShiftVal &= (NumElts - 1);
933 for (
unsigned l = 0; l < NumElts; l += 16) {
934 for (
unsigned i = 0; i != 16; ++i) {
935 unsigned Idx = ShiftVal + i;
936 if (!IsVALIGN && Idx >= 16)
938 Indices[l + i] = Idx + l;
950 bool ZeroMask,
bool IndexForm) {
956 if (VecWidth == 128 && EltWidth == 32 && IsFloat)
958 else if (VecWidth == 128 && EltWidth == 32 && !IsFloat)
960 else if (VecWidth == 128 && EltWidth == 64 && IsFloat)
962 else if (VecWidth == 128 && EltWidth == 64 && !IsFloat)
964 else if (VecWidth == 256 && EltWidth == 32 && IsFloat)
966 else if (VecWidth == 256 && EltWidth == 32 && !IsFloat)
968 else if (VecWidth == 256 && EltWidth == 64 && IsFloat)
970 else if (VecWidth == 256 && EltWidth == 64 && !IsFloat)
972 else if (VecWidth == 512 && EltWidth == 32 && IsFloat)
974 else if (VecWidth == 512 && EltWidth == 32 && !IsFloat)
976 else if (VecWidth == 512 && EltWidth == 64 && IsFloat)
978 else if (VecWidth == 512 && EltWidth == 64 && !IsFloat)
980 else if (VecWidth == 128 && EltWidth == 16)
982 else if (VecWidth == 256 && EltWidth == 16)
984 else if (VecWidth == 512 && EltWidth == 16)
986 else if (VecWidth == 128 && EltWidth == 8)
988 else if (VecWidth == 256 && EltWidth == 8)
990 else if (VecWidth == 512 && EltWidth == 8)
1011 bool IsSigned,
bool IsAddition) {
1031 bool IsRotateRight) {
1058 bool IsShiftRight,
bool ZeroMask) {
1101 if (
const auto *
C = dyn_cast<Constant>(Mask))
1102 if (
C->isAllOnesValue())
1121 if (
const auto *
C = dyn_cast<Constant>(Mask))
1122 if (
C->isAllOnesValue())
1193 if (!
C || !
C->isAllOnesValue())
1199 for (
unsigned i = 0; i != NumElts; ++i)
1201 for (
unsigned i = NumElts; i != 8; ++i)
1202 Indices[i] = NumElts + i % NumElts;
1211 unsigned CC,
bool Signed) {
1218 }
else if (CC == 7) {
1268 return Builder.
CreateSExt(Mask, ReturnOp,
"vpmovm2");
1280 if (VecWidth == 128 && EltWidth == 32)
1282 else if (VecWidth == 128 && EltWidth == 64)
1284 else if (VecWidth == 256 && EltWidth == 32)
1286 else if (VecWidth == 256 && EltWidth == 64)
1291 if (VecWidth == 128 && EltWidth == 32)
1293 else if (VecWidth == 128 && EltWidth == 64)
1295 else if (VecWidth == 256 && EltWidth == 32)
1297 else if (VecWidth == 256 && EltWidth == 64)
1302 if (VecWidth == 128)
1304 else if (VecWidth == 256)
1306 else if (VecWidth == 512)
1311 if (VecWidth == 128)
1313 else if (VecWidth == 256)
1315 else if (VecWidth == 512)
1320 if (VecWidth == 128)
1322 else if (VecWidth == 256)
1324 else if (VecWidth == 512)
1329 if (VecWidth == 128)
1331 else if (VecWidth == 256)
1333 else if (VecWidth == 512)
1338 if (VecWidth == 128)
1340 else if (VecWidth == 256)
1342 else if (VecWidth == 512)
1347 if (VecWidth == 128)
1349 else if (VecWidth == 256)
1351 else if (VecWidth == 512)
1356 if (VecWidth == 128)
1358 else if (VecWidth == 256)
1360 else if (VecWidth == 512)
1365 if (VecWidth == 128)
1367 else if (VecWidth == 256)
1369 else if (VecWidth == 512)
1374 if (VecWidth == 128)
1376 else if (VecWidth == 256)
1378 else if (VecWidth == 512)
1383 if (VecWidth == 128)
1385 else if (VecWidth == 256)
1387 else if (VecWidth == 512)
1392 if (VecWidth == 128 && EltWidth == 32)
1394 else if (VecWidth == 128 && EltWidth == 64)
1396 else if (VecWidth == 256 && EltWidth == 32)
1398 else if (VecWidth == 256 && EltWidth == 64)
1400 else if (VecWidth == 512 && EltWidth == 32)
1402 else if (VecWidth == 512 && EltWidth == 64)
1406 }
else if (Name ==
"cvtpd2dq.256") {
1408 }
else if (Name ==
"cvtpd2ps.256") {
1410 }
else if (Name ==
"cvttpd2dq.256") {
1412 }
else if (Name ==
"cvttps2dq.128") {
1414 }
else if (Name ==
"cvttps2dq.256") {
1418 if (VecWidth == 256 && EltWidth == 32 && IsFloat)
1420 else if (VecWidth == 256 && EltWidth == 32 && !IsFloat)
1422 else if (VecWidth == 256 && EltWidth == 64 && IsFloat)
1424 else if (VecWidth == 256 && EltWidth == 64 && !IsFloat)
1426 else if (VecWidth == 512 && EltWidth == 32 && IsFloat)
1428 else if (VecWidth == 512 && EltWidth == 32 && !IsFloat)
1430 else if (VecWidth == 512 && EltWidth == 64 && IsFloat)
1432 else if (VecWidth == 512 && EltWidth == 64 && !IsFloat)
1434 else if (VecWidth == 128 && EltWidth == 16)
1436 else if (VecWidth == 256 && EltWidth == 16)
1438 else if (VecWidth == 512 && EltWidth == 16)
1440 else if (VecWidth == 128 && EltWidth == 8)
1442 else if (VecWidth == 256 && EltWidth == 8)
1444 else if (VecWidth == 512 && EltWidth == 8)
1449 if (VecWidth == 128)
1451 else if (VecWidth == 256)
1453 else if (VecWidth == 512)
1457 }
else if (Name.
startswith(
"pmultishift.qb.")) {
1458 if (VecWidth == 128)
1460 else if (VecWidth == 256)
1462 else if (VecWidth == 512)
1485 if (AsmStr->find(
"mov\tfp") == 0 &&
1486 AsmStr->find(
"objc_retainAutoreleaseReturnValue") != std::string::npos &&
1487 (Pos = AsmStr->find(
"# marker")) != std::string::npos) {
1488 AsmStr->replace(Pos, 1,
";");
1501 assert(F &&
"Intrinsic call is not direct?");
1507 assert(Name.
startswith(
"llvm.") &&
"Intrinsic doesn't start with 'llvm.'");
1512 Name = Name.substr(4);
1513 bool IsNVVM = Name.startswith(
"nvvm.");
1515 Name = Name.substr(5);
1517 if (IsX86 && Name.startswith(
"sse4a.movnt.")) {
1529 Type *SrcEltTy = cast<VectorType>(Arg1->
getType())->getElementType();
1543 if (IsX86 && (Name.startswith(
"avx.movnt.") ||
1544 Name.startswith(
"avx512.storent."))) {
1568 if (IsX86 && Name ==
"sse2.storel.dq") {
1585 if (IsX86 && (Name.startswith(
"sse.storeu.") ||
1586 Name.startswith(
"sse2.storeu.") ||
1587 Name.startswith(
"avx.storeu."))) {
1601 if (IsX86 && Name ==
"avx512.mask.store.ss") {
1611 if (IsX86 && (Name.startswith(
"avx512.mask.store"))) {
1613 bool Aligned = Name[17] !=
'u';
1624 if (IsX86 && (Name.startswith(
"sse2.pcmp") ||
1625 Name.startswith(
"avx2.pcmp"))) {
1627 bool CmpEq = Name[9] ==
'e';
1631 }
else if (IsX86 && (Name.startswith(
"avx512.broadcastm"))) {
1639 }
else if (IsX86 && (Name ==
"sse.sqrt.ss" ||
1640 Name ==
"sse2.sqrt.sd")) {
1647 }
else if (IsX86 && (Name.startswith(
"avx.sqrt.p") ||
1648 Name.startswith(
"sse2.sqrt.p") ||
1649 Name.startswith(
"sse.sqrt.p"))) {
1654 }
else if (IsX86 && (Name.startswith(
"avx512.mask.sqrt.p"))) {
1657 cast<ConstantInt>(CI->
getArgOperand(3))->getZExtValue() != 4)) {
1672 }
else if (IsX86 && (Name.startswith(
"avx512.ptestm") ||
1673 Name.startswith(
"avx512.ptestnm"))) {
1684 }
else if (IsX86 && (Name.startswith(
"avx512.mask.pbroadcast"))){
1690 }
else if (IsX86 && (Name.startswith(
"avx512.kunpck"))) {
1695 for (
unsigned i = 0; i != NumElts; ++i)
1709 }
else if (IsX86 && Name ==
"avx512.kand.w") {
1714 }
else if (IsX86 && Name ==
"avx512.kandn.w") {
1720 }
else if (IsX86 && Name ==
"avx512.kor.w") {
1725 }
else if (IsX86 && Name ==
"avx512.kxor.w") {
1730 }
else if (IsX86 && Name ==
"avx512.kxnor.w") {
1736 }
else if (IsX86 && Name ==
"avx512.knot.w") {
1741 (Name ==
"avx512.kortestz.w" || Name ==
"avx512.kortestc.w")) {
1747 if (Name[14] ==
'c')
1753 }
else if (IsX86 && (Name ==
"sse.add.ss" || Name ==
"sse2.add.sd" ||
1754 Name ==
"sse.sub.ss" || Name ==
"sse2.sub.sd" ||
1755 Name ==
"sse.mul.ss" || Name ==
"sse2.mul.sd" ||
1756 Name ==
"sse.div.ss" || Name ==
"sse2.div.sd")) {
1763 if (Name.contains(
".add."))
1765 else if (Name.contains(
".sub."))
1767 else if (Name.contains(
".mul."))
1773 }
else if (IsX86 && Name.startswith(
"avx512.mask.pcmp")) {
1775 bool CmpEq = Name[16] ==
'e';
1777 }
else if (IsX86 && Name.startswith(
"avx512.mask.vpshufbitqmb.")) {
1791 }
else if (IsX86 && Name.startswith(
"avx512.mask.fpclass.p")) {
1796 if (VecWidth == 128 && EltWidth == 32)
1798 else if (VecWidth == 256 && EltWidth == 32)
1800 else if (VecWidth == 512 && EltWidth == 32)
1802 else if (VecWidth == 128 && EltWidth == 64)
1804 else if (VecWidth == 256 && EltWidth == 64)
1806 else if (VecWidth == 512 && EltWidth == 64)
1814 }
else if (IsX86 && Name.startswith(
"avx512.mask.cmp.p")) {
1819 if (VecWidth == 128 && EltWidth == 32)
1821 else if (VecWidth == 256 && EltWidth == 32)
1823 else if (VecWidth == 512 && EltWidth == 32)
1825 else if (VecWidth == 128 && EltWidth == 64)
1827 else if (VecWidth == 256 && EltWidth == 64)
1829 else if (VecWidth == 512 && EltWidth == 64)
1844 }
else if (IsX86 && Name.startswith(
"avx512.mask.cmp.") &&
1847 unsigned Imm = cast<ConstantInt>(CI->
getArgOperand(2))->getZExtValue();
1849 }
else if (IsX86 && Name.startswith(
"avx512.mask.ucmp.")) {
1850 unsigned Imm = cast<ConstantInt>(CI->
getArgOperand(2))->getZExtValue();
1852 }
else if (IsX86 && (Name.startswith(
"avx512.cvtb2mask.") ||
1853 Name.startswith(
"avx512.cvtw2mask.") ||
1854 Name.startswith(
"avx512.cvtd2mask.") ||
1855 Name.startswith(
"avx512.cvtq2mask."))) {
1860 }
else if(IsX86 && (Name ==
"ssse3.pabs.b.128" ||
1861 Name ==
"ssse3.pabs.w.128" ||
1862 Name ==
"ssse3.pabs.d.128" ||
1863 Name.startswith(
"avx2.pabs") ||
1864 Name.startswith(
"avx512.mask.pabs"))) {
1866 }
else if (IsX86 && (Name ==
"sse41.pmaxsb" ||
1867 Name ==
"sse2.pmaxs.w" ||
1868 Name ==
"sse41.pmaxsd" ||
1869 Name.startswith(
"avx2.pmaxs") ||
1870 Name.startswith(
"avx512.mask.pmaxs"))) {
1872 }
else if (IsX86 && (Name ==
"sse2.pmaxu.b" ||
1873 Name ==
"sse41.pmaxuw" ||
1874 Name ==
"sse41.pmaxud" ||
1875 Name.startswith(
"avx2.pmaxu") ||
1876 Name.startswith(
"avx512.mask.pmaxu"))) {
1878 }
else if (IsX86 && (Name ==
"sse41.pminsb" ||
1879 Name ==
"sse2.pmins.w" ||
1880 Name ==
"sse41.pminsd" ||
1881 Name.startswith(
"avx2.pmins") ||
1882 Name.startswith(
"avx512.mask.pmins"))) {
1884 }
else if (IsX86 && (Name ==
"sse2.pminu.b" ||
1885 Name ==
"sse41.pminuw" ||
1886 Name ==
"sse41.pminud" ||
1887 Name.startswith(
"avx2.pminu") ||
1888 Name.startswith(
"avx512.mask.pminu"))) {
1890 }
else if (IsX86 && (Name ==
"sse2.pmulu.dq" ||
1891 Name ==
"avx2.pmulu.dq" ||
1892 Name ==
"avx512.pmulu.dq.512" ||
1893 Name.startswith(
"avx512.mask.pmulu.dq."))) {
1895 }
else if (IsX86 && (Name ==
"sse41.pmuldq" ||
1896 Name ==
"avx2.pmul.dq" ||
1897 Name ==
"avx512.pmul.dq.512" ||
1898 Name.startswith(
"avx512.mask.pmul.dq."))) {
1900 }
else if (IsX86 && (Name ==
"sse.cvtsi2ss" ||
1901 Name ==
"sse2.cvtsi2sd" ||
1902 Name ==
"sse.cvtsi642ss" ||
1903 Name ==
"sse2.cvtsi642sd")) {
1907 }
else if (IsX86 && Name ==
"avx512.cvtusi2sd") {
1911 }
else if (IsX86 && Name ==
"sse2.cvtss2sd") {
1915 }
else if (IsX86 && (Name ==
"sse2.cvtdq2pd" ||
1916 Name ==
"sse2.cvtdq2ps" ||
1917 Name ==
"avx.cvtdq2.pd.256" ||
1918 Name ==
"avx.cvtdq2.ps.256" ||
1919 Name.startswith(
"avx512.mask.cvtdq2pd.") ||
1920 Name.startswith(
"avx512.mask.cvtudq2pd.") ||
1921 Name ==
"avx512.mask.cvtdq2ps.128" ||
1922 Name ==
"avx512.mask.cvtdq2ps.256" ||
1923 Name ==
"avx512.mask.cvtudq2ps.128" ||
1924 Name ==
"avx512.mask.cvtudq2ps.256" ||
1925 Name ==
"avx512.mask.cvtqq2pd.128" ||
1926 Name ==
"avx512.mask.cvtqq2pd.256" ||
1927 Name ==
"avx512.mask.cvtuqq2pd.128" ||
1928 Name ==
"avx512.mask.cvtuqq2pd.256" ||
1929 Name ==
"sse2.cvtps2pd" ||
1930 Name ==
"avx.cvt.ps2.pd.256" ||
1931 Name ==
"avx512.mask.cvtps2pd.128" ||
1932 Name ==
"avx512.mask.cvtps2pd.256")) {
1937 if (NumDstElts < Rep->
getType()->getVectorNumElements()) {
1938 assert(NumDstElts == 2 &&
"Unexpected vector size");
1939 uint32_t ShuffleMask[2] = { 0, 1 };
1946 Rep = Builder.
CreateFPExt(Rep, DstTy,
"cvtps2pd");
1947 else if (IsUnsigned)
1955 }
else if (IsX86 && (Name.startswith(
"avx512.mask.loadu."))) {
1959 }
else if (IsX86 && (Name.startswith(
"avx512.mask.load."))) {
1963 }
else if (IsX86 && Name.startswith(
"avx512.mask.expand.load.")) {
1978 }
else if (IsX86 && Name.startswith(
"avx512.mask.compress.store.")) {
1993 }
else if (IsX86 && Name.startswith(
"xop.vpcom")) {
1995 if (Name.endswith(
"ub"))
1997 else if (Name.endswith(
"uw"))
1999 else if (Name.endswith(
"ud"))
2001 else if (Name.endswith(
"uq"))
2003 else if (Name.endswith(
"b"))
2005 else if (Name.endswith(
"w"))
2007 else if (Name.endswith(
"d"))
2009 else if (Name.endswith(
"q"))
2014 Name = Name.substr(9);
2016 if (Name.startswith(
"lt"))
2018 else if (Name.startswith(
"le"))
2020 else if (Name.startswith(
"gt"))
2022 else if (Name.startswith(
"ge"))
2024 else if (Name.startswith(
"eq"))
2026 else if (Name.startswith(
"ne"))
2028 else if (Name.startswith(
"false"))
2030 else if (Name.startswith(
"true"))
2039 }
else if (IsX86 && Name.startswith(
"xop.vpcmov")) {
2044 Rep = Builder.
CreateOr(Sel0, Sel1);
2045 }
else if (IsX86 && (Name.startswith(
"xop.vprot") ||
2046 Name.startswith(
"avx512.prol") ||
2047 Name.startswith(
"avx512.mask.prol"))) {
2049 }
else if (IsX86 && (Name.startswith(
"avx512.pror") ||
2050 Name.startswith(
"avx512.mask.pror"))) {
2052 }
else if (IsX86 && (Name.startswith(
"avx512.vpshld.") ||
2053 Name.startswith(
"avx512.mask.vpshld") ||
2054 Name.startswith(
"avx512.maskz.vpshld"))) {
2055 bool ZeroMask = Name[11] ==
'z';
2057 }
else if (IsX86 && (Name.startswith(
"avx512.vpshrd.") ||
2058 Name.startswith(
"avx512.mask.vpshrd") ||
2059 Name.startswith(
"avx512.maskz.vpshrd"))) {
2060 bool ZeroMask = Name[11] ==
'z';
2062 }
else if (IsX86 && Name ==
"sse42.crc32.64.8") {
2068 }
else if (IsX86 && (Name.startswith(
"avx.vbroadcast.s") ||
2069 Name.startswith(
"avx512.vbroadcast.s"))) {
2079 for (
unsigned I = 0;
I < EltNum; ++
I)
2082 }
else if (IsX86 && (Name.startswith(
"sse41.pmovsx") ||
2083 Name.startswith(
"sse41.pmovzx") ||
2084 Name.startswith(
"avx2.pmovsx") ||
2085 Name.startswith(
"avx2.pmovzx") ||
2086 Name.startswith(
"avx512.mask.pmovsx") ||
2087 Name.startswith(
"avx512.mask.pmovzx"))) {
2094 for (
unsigned i = 0; i != NumDstElts; ++i)
2107 }
else if (IsX86 && (Name.startswith(
"avx.vbroadcastf128") ||
2108 Name ==
"avx2.vbroadcasti128")) {
2116 if (NumSrcElts == 2)
2121 { 0, 1, 2, 3, 0, 1, 2, 3 });
2122 }
else if (IsX86 && (Name.startswith(
"avx512.mask.shuf.i") ||
2123 Name.startswith(
"avx512.mask.shuf.f"))) {
2124 unsigned Imm = cast<ConstantInt>(CI->
getArgOperand(2))->getZExtValue();
2128 unsigned ControlBitsMask = NumLanes - 1;
2129 unsigned NumControlBits = NumLanes / 2;
2132 for (
unsigned l = 0; l != NumLanes; ++l) {
2133 unsigned LaneMask = (Imm >> (l * NumControlBits)) & ControlBitsMask;
2135 if (l >= NumLanes / 2)
2136 LaneMask += NumLanes;
2137 for (
unsigned i = 0; i != NumElementsInLane; ++i)
2138 ShuffleMask.
push_back(LaneMask * NumElementsInLane + i);
2144 }
else if (IsX86 && (Name.startswith(
"avx512.mask.broadcastf") ||
2145 Name.startswith(
"avx512.mask.broadcasti"))) {
2146 unsigned NumSrcElts =
2151 for (
unsigned i = 0; i != NumDstElts; ++i)
2152 ShuffleMask[i] = i % NumSrcElts;
2159 }
else if (IsX86 && (Name.startswith(
"avx2.pbroadcast") ||
2160 Name.startswith(
"avx2.vbroadcast") ||
2161 Name.startswith(
"avx512.pbroadcast") ||
2162 Name.startswith(
"avx512.mask.broadcast.s"))) {
2173 }
else if (IsX86 && (Name.startswith(
"sse2.padds.") ||
2174 Name.startswith(
"sse2.psubs.") ||
2175 Name.startswith(
"avx2.padds.") ||
2176 Name.startswith(
"avx2.psubs.") ||
2177 Name.startswith(
"avx512.padds.") ||
2178 Name.startswith(
"avx512.psubs.") ||
2179 Name.startswith(
"avx512.mask.padds.") ||
2180 Name.startswith(
"avx512.mask.psubs."))) {
2181 bool IsAdd = Name.contains(
".padds");
2183 }
else if (IsX86 && (Name.startswith(
"sse2.paddus.") ||
2184 Name.startswith(
"sse2.psubus.") ||
2185 Name.startswith(
"avx2.paddus.") ||
2186 Name.startswith(
"avx2.psubus.") ||
2187 Name.startswith(
"avx512.mask.paddus.") ||
2188 Name.startswith(
"avx512.mask.psubus."))) {
2189 bool IsAdd = Name.contains(
".paddus");
2191 }
else if (IsX86 && Name.startswith(
"avx512.mask.palignr.")) {
2198 }
else if (IsX86 && Name.startswith(
"avx512.mask.valign.")) {
2205 }
else if (IsX86 && (Name ==
"sse2.psll.dq" ||
2206 Name ==
"avx2.psll.dq")) {
2208 unsigned Shift = cast<ConstantInt>(CI->
getArgOperand(1))->getZExtValue();
2211 }
else if (IsX86 && (Name ==
"sse2.psrl.dq" ||
2212 Name ==
"avx2.psrl.dq")) {
2214 unsigned Shift = cast<ConstantInt>(CI->
getArgOperand(1))->getZExtValue();
2217 }
else if (IsX86 && (Name ==
"sse2.psll.dq.bs" ||
2218 Name ==
"avx2.psll.dq.bs" ||
2219 Name ==
"avx512.psll.dq.512")) {
2221 unsigned Shift = cast<ConstantInt>(CI->
getArgOperand(1))->getZExtValue();
2223 }
else if (IsX86 && (Name ==
"sse2.psrl.dq.bs" ||
2224 Name ==
"avx2.psrl.dq.bs" ||
2225 Name ==
"avx512.psrl.dq.512")) {
2227 unsigned Shift = cast<ConstantInt>(CI->
getArgOperand(1))->getZExtValue();
2229 }
else if (IsX86 && (Name ==
"sse41.pblendw" ||
2230 Name.startswith(
"sse41.blendp") ||
2231 Name.startswith(
"avx.blend.p") ||
2232 Name ==
"avx2.pblendw" ||
2233 Name.startswith(
"avx2.pblendd."))) {
2236 unsigned Imm = cast <ConstantInt>(CI->
getArgOperand(2))->getZExtValue();
2241 for (
unsigned i = 0; i != NumElts; ++i)
2242 Idxs[i] = ((Imm >> (i%8)) & 1) ? i + NumElts : i;
2245 }
else if (IsX86 && (Name.startswith(
"avx.vinsertf128.") ||
2246 Name ==
"avx2.vinserti128" ||
2247 Name.startswith(
"avx512.mask.insert"))) {
2250 unsigned Imm = cast<ConstantInt>(CI->
getArgOperand(2))->getZExtValue();
2253 unsigned Scale = DstNumElts / SrcNumElts;
2261 for (
unsigned i = 0; i != SrcNumElts; ++i)
2263 for (
unsigned i = SrcNumElts; i != DstNumElts; ++i)
2264 Idxs[i] = SrcNumElts;
2279 for (
unsigned i = 0; i != DstNumElts; ++i)
2282 for (
unsigned i = 0; i != SrcNumElts; ++i)
2283 Idxs[i + Imm * SrcNumElts] = i + DstNumElts;
2290 }
else if (IsX86 && (Name.startswith(
"avx.vextractf128.") ||
2291 Name ==
"avx2.vextracti128" ||
2292 Name.startswith(
"avx512.mask.vextract"))) {
2294 unsigned Imm = cast<ConstantInt>(CI->
getArgOperand(1))->getZExtValue();
2297 unsigned Scale = SrcNumElts / DstNumElts;
2304 for (
unsigned i = 0; i != DstNumElts; ++i) {
2305 Idxs[i] = i + (Imm * DstNumElts);
2313 }
else if (!IsX86 && Name ==
"stackprotectorcheck") {
2315 }
else if (IsX86 && (Name.startswith(
"avx512.mask.perm.df.") ||
2316 Name.startswith(
"avx512.mask.perm.di."))) {
2318 unsigned Imm = cast<ConstantInt>(CI->
getArgOperand(1))->getZExtValue();
2323 for (
unsigned i = 0; i != NumElts; ++i)
2324 Idxs[i] = (i & ~0x3) + ((Imm >> (2 * (i & 0x3))) & 3);
2331 }
else if (IsX86 && (Name.startswith(
"avx.vperm2f128.") ||
2332 Name ==
"avx2.vperm2i128")) {
2341 uint8_t Imm = cast<ConstantInt>(CI->
getArgOperand(2))->getZExtValue();
2344 unsigned HalfSize = NumElts / 2;
2356 unsigned StartIndex = (Imm & 0x01) ? HalfSize : 0;
2357 for (
unsigned i = 0; i < HalfSize; ++i)
2358 ShuffleMask[i] = StartIndex + i;
2361 StartIndex = (Imm & 0x10) ? HalfSize : 0;
2362 for (
unsigned i = 0; i < HalfSize; ++i)
2363 ShuffleMask[i + HalfSize] = NumElts + StartIndex + i;
2367 }
else if (IsX86 && (Name.startswith(
"avx.vpermil.") ||
2368 Name ==
"sse2.pshuf.d" ||
2369 Name.startswith(
"avx512.mask.vpermil.p") ||
2370 Name.startswith(
"avx512.mask.pshuf.d."))) {
2372 unsigned Imm = cast<ConstantInt>(CI->
getArgOperand(1))->getZExtValue();
2377 unsigned IdxMask = ((1 << IdxSize) - 1);
2383 for (
unsigned i = 0; i != NumElts; ++i)
2384 Idxs[i] = ((Imm >> ((i * IdxSize) % 8)) & IdxMask) | (i & ~IdxMask);
2391 }
else if (IsX86 && (Name ==
"sse2.pshufl.w" ||
2392 Name.startswith(
"avx512.mask.pshufl.w."))) {
2394 unsigned Imm = cast<ConstantInt>(CI->
getArgOperand(1))->getZExtValue();
2398 for (
unsigned l = 0; l != NumElts; l += 8) {
2399 for (
unsigned i = 0; i != 4; ++i)
2400 Idxs[i + l] = ((Imm >> (2 * i)) & 0x3) + l;
2401 for (
unsigned i = 4; i != 8; ++i)
2402 Idxs[i + l] = i + l;
2410 }
else if (IsX86 && (Name ==
"sse2.pshufh.w" ||
2411 Name.startswith(
"avx512.mask.pshufh.w."))) {
2413 unsigned Imm = cast<ConstantInt>(CI->
getArgOperand(1))->getZExtValue();
2417 for (
unsigned l = 0; l != NumElts; l += 8) {
2418 for (
unsigned i = 0; i != 4; ++i)
2419 Idxs[i + l] = i + l;
2420 for (
unsigned i = 0; i != 4; ++i)
2421 Idxs[i + l + 4] = ((Imm >> (2 * i)) & 0x3) + 4 + l;
2429 }
else if (IsX86 && Name.startswith(
"avx512.mask.shuf.p")) {
2432 unsigned Imm = cast<ConstantInt>(CI->
getArgOperand(2))->getZExtValue();
2436 unsigned HalfLaneElts = NumLaneElts / 2;
2439 for (
unsigned i = 0; i != NumElts; ++i) {
2441 Idxs[i] = i - (i % NumLaneElts);
2443 if ((i % NumLaneElts) >= HalfLaneElts)
2447 Idxs[i] += (Imm >> ((i * HalfLaneElts) % 8)) & ((1 << HalfLaneElts) - 1);
2454 }
else if (IsX86 && (Name.startswith(
"avx512.mask.movddup") ||
2455 Name.startswith(
"avx512.mask.movshdup") ||
2456 Name.startswith(
"avx512.mask.movsldup"))) {
2462 if (Name.startswith(
"avx512.mask.movshdup."))
2466 for (
unsigned l = 0; l != NumElts; l += NumLaneElts)
2467 for (
unsigned i = 0; i != NumLaneElts; i += 2) {
2468 Idxs[i + l + 0] = i + l +
Offset;
2469 Idxs[i + l + 1] = i + l +
Offset;
2476 }
else if (IsX86 && (Name.startswith(
"avx512.mask.punpckl") ||
2477 Name.startswith(
"avx512.mask.unpckl."))) {
2484 for (
int l = 0; l != NumElts; l += NumLaneElts)
2485 for (
int i = 0; i != NumLaneElts; ++i)
2486 Idxs[i + l] = l + (i / 2) + NumElts * (i % 2);
2492 }
else if (IsX86 && (Name.startswith(
"avx512.mask.punpckh") ||
2493 Name.startswith(
"avx512.mask.unpckh."))) {
2500 for (
int l = 0; l != NumElts; l += NumLaneElts)
2501 for (
int i = 0; i != NumLaneElts; ++i)
2502 Idxs[i + l] = (NumLaneElts / 2) + l + (i / 2) + NumElts * (i % 2);
2508 }
else if (IsX86 && (Name.startswith(
"avx512.mask.and.") ||
2509 Name.startswith(
"avx512.mask.pand."))) {
2517 }
else if (IsX86 && (Name.startswith(
"avx512.mask.andn.") ||
2518 Name.startswith(
"avx512.mask.pandn."))) {
2527 }
else if (IsX86 && (Name.startswith(
"avx512.mask.or.") ||
2528 Name.startswith(
"avx512.mask.por."))) {
2536 }
else if (IsX86 && (Name.startswith(
"avx512.mask.xor.") ||
2537 Name.startswith(
"avx512.mask.pxor."))) {
2545 }
else if (IsX86 && Name.startswith(
"avx512.mask.padd.")) {
2549 }
else if (IsX86 && Name.startswith(
"avx512.mask.psub.")) {
2553 }
else if (IsX86 && Name.startswith(
"avx512.mask.pmull.")) {
2557 }
else if (IsX86 && Name.startswith(
"avx512.mask.add.p")) {
2558 if (Name.endswith(
".512")) {
2560 if (Name[17] ==
's')
2573 }
else if (IsX86 && Name.startswith(
"avx512.mask.div.p")) {
2574 if (Name.endswith(
".512")) {
2576 if (Name[17] ==
's')
2589 }
else if (IsX86 && Name.startswith(
"avx512.mask.mul.p")) {
2590 if (Name.endswith(
".512")) {
2592 if (Name[17] ==
's')
2605 }
else if (IsX86 && Name.startswith(
"avx512.mask.sub.p")) {
2606 if (Name.endswith(
".512")) {
2608 if (Name[17] ==
's')
2621 }
else if (IsX86 && (Name.startswith(
"avx512.mask.max.p") ||
2622 Name.startswith(
"avx512.mask.min.p")) &&
2623 Name.drop_front(18) ==
".512") {
2624 bool IsDouble = Name[17] ==
'd';
2625 bool IsMin = Name[13] ==
'i';
2637 }
else if (IsX86 && Name.startswith(
"avx512.mask.lzcnt.")) {
2644 }
else if (IsX86 && Name.startswith(
"avx512.mask.psll")) {
2645 bool IsImmediate = Name[16] ==
'i' ||
2646 (Name.size() > 18 && Name[18] ==
'i');
2647 bool IsVariable = Name[16] ==
'v';
2648 char Size = Name[16] ==
'.' ? Name[17] :
2649 Name[17] ==
'.' ? Name[18] :
2650 Name[18] ==
'.' ? Name[19] :
2654 if (IsVariable && Name[17] !=
'.') {
2655 if (Size ==
'd' && Name[17] ==
'2')
2657 else if (Size ==
'd' && Name[17] ==
'4')
2659 else if (Size ==
's' && Name[17] ==
'4')
2661 else if (Size ==
's' && Name[17] ==
'8')
2663 else if (Size ==
'h' && Name[17] ==
'8')
2665 else if (Size ==
'h' && Name[17] ==
'1')
2667 else if (Name[17] ==
'3' && Name[18] ==
'2')
2671 }
else if (Name.endswith(
".128")) {
2675 else if (Size ==
'q')
2678 else if (Size ==
'w')
2683 }
else if (Name.endswith(
".256")) {
2687 else if (Size ==
'q')
2690 else if (Size ==
'w')
2700 else if (Size ==
'q')
2704 else if (Size ==
'w')
2712 }
else if (IsX86 && Name.startswith(
"avx512.mask.psrl")) {
2713 bool IsImmediate = Name[16] ==
'i' ||
2714 (Name.size() > 18 && Name[18] ==
'i');
2715 bool IsVariable = Name[16] ==
'v';
2716 char Size = Name[16] ==
'.' ? Name[17] :
2717 Name[17] ==
'.' ? Name[18] :
2718 Name[18] ==
'.' ? Name[19] :
2722 if (IsVariable && Name[17] !=
'.') {
2723 if (Size ==
'd' && Name[17] ==
'2')
2725 else if (Size ==
'd' && Name[17] ==
'4')
2727 else if (Size ==
's' && Name[17] ==
'4')
2729 else if (Size ==
's' && Name[17] ==
'8')
2731 else if (Size ==
'h' && Name[17] ==
'8')
2733 else if (Size ==
'h' && Name[17] ==
'1')
2735 else if (Name[17] ==
'3' && Name[18] ==
'2')
2739 }
else if (Name.endswith(
".128")) {
2743 else if (Size ==
'q')
2746 else if (Size ==
'w')
2751 }
else if (Name.endswith(
".256")) {
2755 else if (Size ==
'q')
2758 else if (Size ==
'w')
2768 else if (Size ==
'q')
2772 else if (Size ==
'w')
2780 }
else if (IsX86 && Name.startswith(
"avx512.mask.psra")) {
2781 bool IsImmediate = Name[16] ==
'i' ||
2782 (Name.size() > 18 && Name[18] ==
'i');
2783 bool IsVariable = Name[16] ==
'v';
2784 char Size = Name[16] ==
'.' ? Name[17] :
2785 Name[17] ==
'.' ? Name[18] :
2786 Name[18] ==
'.' ? Name[19] :
2790 if (IsVariable && Name[17] !=
'.') {
2791 if (Size ==
's' && Name[17] ==
'4')
2793 else if (Size ==
's' && Name[17] ==
'8')
2795 else if (Size ==
'h' && Name[17] ==
'8')
2797 else if (Size ==
'h' && Name[17] ==
'1')
2799 else if (Name[17] ==
'3' && Name[18] ==
'2')
2803 }
else if (Name.endswith(
".128")) {
2807 else if (Size ==
'q')
2811 else if (Size ==
'w')
2816 }
else if (Name.endswith(
".256")) {
2820 else if (Size ==
'q')
2824 else if (Size ==
'w')
2834 else if (Size ==
'q')
2838 else if (Size ==
'w')
2846 }
else if (IsX86 && Name.startswith(
"avx512.mask.move.s")) {
2848 }
else if (IsX86 && Name.startswith(
"avx512.cvtmask2")) {
2850 }
else if (IsX86 && Name.endswith(
".movntdqa")) {
2865 (Name.startswith(
"sse2.pavg") || Name.startswith(
"avx2.pavg") ||
2866 Name.startswith(
"avx512.mask.pavg"))) {
2872 cast<VectorType>(A->
getType()));
2883 }
else if (IsX86 && (Name.startswith(
"fma.vfmadd.") ||
2884 Name.startswith(
"fma.vfmsub.") ||
2885 Name.startswith(
"fma.vfnmadd.") ||
2886 Name.startswith(
"fma.vfnmsub."))) {
2887 bool NegMul = Name[6] ==
'n';
2888 bool NegAcc = NegMul ? Name[8] ==
's' : Name[7] ==
's';
2889 bool IsScalar = NegMul ? Name[12] ==
's' : Name[11] ==
's';
2900 if (NegMul && !IsScalar)
2902 if (NegMul && IsScalar)
2915 }
else if (IsX86 && Name.startswith(
"fma4.vfmadd.s")) {
2930 }
else if (IsX86 && (Name.startswith(
"avx512.mask.vfmadd.s") ||
2931 Name.startswith(
"avx512.maskz.vfmadd.s") ||
2932 Name.startswith(
"avx512.mask3.vfmadd.s") ||
2933 Name.startswith(
"avx512.mask3.vfmsub.s") ||
2934 Name.startswith(
"avx512.mask3.vfnmsub.s"))) {
2935 bool IsMask3 = Name[11] ==
'3';
2936 bool IsMaskZ = Name[11] ==
'z';
2938 Name = Name.drop_front(IsMask3 || IsMaskZ ? 13 : 12);
2939 bool NegMul = Name[2] ==
'n';
2940 bool NegAcc = NegMul ? Name[4] ==
's' : Name[3] ==
's';
2946 if (NegMul && (IsMask3 || IsMaskZ))
2948 if (NegMul && !(IsMask3 || IsMaskZ))
2958 cast<ConstantInt>(CI->
getArgOperand(4))->getZExtValue() != 4) {
2962 if (Name.back() ==
'd')
2980 if (NegAcc && IsMask3)
2988 }
else if (IsX86 && (Name.startswith(
"avx512.mask.vfmadd.p") ||
2989 Name.startswith(
"avx512.mask.vfnmadd.p") ||
2990 Name.startswith(
"avx512.mask.vfnmsub.p") ||
2991 Name.startswith(
"avx512.mask3.vfmadd.p") ||
2992 Name.startswith(
"avx512.mask3.vfmsub.p") ||
2993 Name.startswith(
"avx512.mask3.vfnmsub.p") ||
2994 Name.startswith(
"avx512.maskz.vfmadd.p"))) {
2995 bool IsMask3 = Name[11] ==
'3';
2996 bool IsMaskZ = Name[11] ==
'z';
2998 Name = Name.drop_front(IsMask3 || IsMaskZ ? 13 : 12);
2999 bool NegMul = Name[2] ==
'n';
3000 bool NegAcc = NegMul ? Name[4] ==
's' : Name[3] ==
's';
3006 if (NegMul && (IsMask3 || IsMaskZ))
3008 if (NegMul && !(IsMask3 || IsMaskZ))
3015 cast<ConstantInt>(CI->
getArgOperand(4))->getZExtValue() != 4)) {
3018 if (Name[Name.size()-5] ==
's')
3037 }
else if (IsX86 && (Name.startswith(
"fma.vfmaddsub.p") ||
3038 Name.startswith(
"fma.vfmsubadd.p"))) {
3039 bool IsSubAdd = Name[7] ==
's';
3055 for (
int i = 0; i != NumElts; ++i)
3056 Idxs[i] = i + (i % 2) * NumElts;
3059 }
else if (IsX86 && (Name.startswith(
"avx512.mask.vfmaddsub.p") ||
3060 Name.startswith(
"avx512.mask3.vfmaddsub.p") ||
3061 Name.startswith(
"avx512.maskz.vfmaddsub.p") ||
3062 Name.startswith(
"avx512.mask3.vfmsubadd.p"))) {
3063 bool IsMask3 = Name[11] ==
'3';
3064 bool IsMaskZ = Name[11] ==
'z';
3066 Name = Name.drop_front(IsMask3 || IsMaskZ ? 13 : 12);
3067 bool IsSubAdd = Name[3] ==
's';
3070 cast<ConstantInt>(CI->
getArgOperand(4))->getZExtValue() != 4)) {
3073 if (Name[Name.size()-5] ==
's')
3102 for (
int i = 0; i != NumElts; ++i)
3103 Idxs[i] = i + (i % 2) * NumElts;
3113 }
else if (IsX86 && (Name.startswith(
"avx512.mask.pternlog.") ||
3114 Name.startswith(
"avx512.maskz.pternlog."))) {
3115 bool ZeroMask = Name[11] ==
'z';
3119 if (VecWidth == 128 && EltWidth == 32)
3121 else if (VecWidth == 256 && EltWidth == 32)
3123 else if (VecWidth == 512 && EltWidth == 32)
3125 else if (VecWidth == 128 && EltWidth == 64)
3127 else if (VecWidth == 256 && EltWidth == 64)
3129 else if (VecWidth == 512 && EltWidth == 64)
3141 }
else if (IsX86 && (Name.startswith(
"avx512.mask.vpmadd52") ||
3142 Name.startswith(
"avx512.maskz.vpmadd52"))) {
3143 bool ZeroMask = Name[11] ==
'z';
3144 bool High = Name[20] ==
'h' || Name[21] ==
'h';
3147 if (VecWidth == 128 && !High)
3149 else if (VecWidth == 256 && !High)
3151 else if (VecWidth == 512 && !High)
3153 else if (VecWidth == 128 && High)
3155 else if (VecWidth == 256 && High)
3157 else if (VecWidth == 512 && High)
3169 }
else if (IsX86 && (Name.startswith(
"avx512.mask.vpermi2var.") ||
3170 Name.startswith(
"avx512.mask.vpermt2var.") ||
3171 Name.startswith(
"avx512.maskz.vpermt2var."))) {
3172 bool ZeroMask = Name[11] ==
'z';
3173 bool IndexForm = Name[17] ==
'i';
3175 }
else if (IsX86 && (Name.startswith(
"avx512.mask.vpdpbusd.") ||
3176 Name.startswith(
"avx512.maskz.vpdpbusd.") ||
3177 Name.startswith(
"avx512.mask.vpdpbusds.") ||
3178 Name.startswith(
"avx512.maskz.vpdpbusds."))) {
3179 bool ZeroMask = Name[11] ==
'z';
3180 bool IsSaturating = Name[ZeroMask ? 21 : 20] ==
's';
3183 if (VecWidth == 128 && !IsSaturating)
3185 else if (VecWidth == 256 && !IsSaturating)
3187 else if (VecWidth == 512 && !IsSaturating)
3189 else if (VecWidth == 128 && IsSaturating)
3191 else if (VecWidth == 256 && IsSaturating)
3193 else if (VecWidth == 512 && IsSaturating)
3205 }
else if (IsX86 && (Name.startswith(
"avx512.mask.vpdpwssd.") ||
3206 Name.startswith(
"avx512.maskz.vpdpwssd.") ||
3207 Name.startswith(
"avx512.mask.vpdpwssds.") ||
3208 Name.startswith(
"avx512.maskz.vpdpwssds."))) {
3209 bool ZeroMask = Name[11] ==
'z';
3210 bool IsSaturating = Name[ZeroMask ? 21 : 20] ==
's';
3213 if (VecWidth == 128 && !IsSaturating)
3215 else if (VecWidth == 256 && !IsSaturating)
3217 else if (VecWidth == 512 && !IsSaturating)
3219 else if (VecWidth == 128 && IsSaturating)
3221 else if (VecWidth == 256 && IsSaturating)
3223 else if (VecWidth == 512 && IsSaturating)
3235 }
else if (IsX86 && (Name ==
"addcarryx.u32" || Name ==
"addcarryx.u64" ||
3236 Name ==
"addcarry.u32" || Name ==
"addcarry.u64" ||
3237 Name ==
"subborrow.u32" || Name ==
"subborrow.u64")) {
3239 if (Name[0] ==
'a' && Name.back() ==
'2')
3241 else if (Name[0] ==
'a' && Name.back() ==
'4')
3243 else if (Name[0] ==
's' && Name.back() ==
'2')
3245 else if (Name[0] ==
's' && Name.back() ==
'4')
3268 }
else if (IsX86 && Name.startswith(
"avx512.mask.") &&
3271 }
else if (IsNVVM && (Name ==
"abs.i" || Name ==
"abs.ll")) {
3277 }
else if (IsNVVM && (Name ==
"max.i" || Name ==
"max.ll" ||
3278 Name ==
"max.ui" || Name ==
"max.ull")) {
3281 Value *Cmp = Name.endswith(
".ui") || Name.endswith(
".ull")
3285 }
else if (IsNVVM && (Name ==
"min.i" || Name ==
"min.ll" ||
3286 Name ==
"min.ui" || Name ==
"min.ull")) {
3289 Value *Cmp = Name.endswith(
".ui") || Name.endswith(
".ull")
3293 }
else if (IsNVVM && Name ==
"clz.ll") {
3301 }
else if (IsNVVM && Name ==
"popc.ll") {
3310 }
else if (IsNVVM && Name ==
"h2f") {
3325 const auto &DefaultCase = [&NewFn, &CI]() ->
void {
3329 "Unknown function for CallInst upgrade and isn't just a name change");
3366 "Mismatch between function args and call args");
3393 if (
Offset->isZeroValue()) {
3439 NewCall = Builder.
CreateCall(NewFn, {BC0, BC1});
3460 if (!Name.empty()) {
3462 NewCall->setName(Name);
3522 auto *MemCI = cast<MemIntrinsic>(NewCall);
3525 MemCI->setDestAlignment(Align->getZExtValue());
3527 if (
auto *MTI = dyn_cast<MemTransferInst>(MemCI))
3528 MTI->setSourceAlignment(Align->getZExtValue());
3532 assert(NewCall &&
"Should have either set this variable or returned through " 3533 "the default case");
3535 if (!Name.empty()) {
3544 assert(F &&
"Illegal attempt to upgrade a non-existent intrinsic.");
3553 if (
CallInst *CI = dyn_cast<CallInst>(*UI++))
3571 Metadata *Elts2[] = {ScalarType, ScalarType,
3585 if (Opc != Instruction::BitCast)
3606 if (Opc != Instruction::BitCast)
3630 bool BrokenDebugInfo =
false;
3633 if (!BrokenDebugInfo)
3652 bool Changed =
false;
3655 if (ModRetainReleaseMarker) {
3662 if (ValueComp.
size() == 2) {
3663 std::string NewValue = ValueComp[0].str() +
";" + ValueComp[1].str();
3680 bool HasObjCFlag =
false, HasClassProperties =
false, Changed =
false;
3688 if (ID->
getString() ==
"Objective-C Image Info Version")
3690 if (ID->
getString() ==
"Objective-C Class Properties")
3691 HasClassProperties =
true;
3695 if (
auto *Behavior =
3696 mdconst::dyn_extract_or_null<ConstantInt>(Op->
getOperand(0))) {
3711 if (ID->
getString() ==
"Objective-C Image Info Section") {
3714 Value->getString().split(ValueComp,
" ");
3715 if (ValueComp.
size() != 1) {
3716 std::string NewValue;
3717 for (
auto &S : ValueComp)
3718 NewValue += S.str();
3733 if (HasObjCFlag && !HasClassProperties) {
3745 Section.split(Components,
',');
3750 for (
auto Component : Components)
3751 OS <<
',' << Component.trim();
3756 for (
auto &GV : M.
globals()) {
3757 if (!GV.hasSection())
3762 if (!Section.
startswith(
"__DATA, __objc_catlist"))
3767 GV.setSection(TrimSpaces(Section));
3772 auto *
T = dyn_cast_or_null<MDTuple>(MD);
3775 if (
T->getNumOperands() < 1)
3777 auto *S = dyn_cast_or_null<MDString>(
T->getOperand(0));
3780 return S->getString().startswith(
"llvm.vectorizer.");
3784 StringRef OldPrefix =
"llvm.vectorizer.";
3787 if (OldTag ==
"llvm.vectorizer.unroll")
3796 auto *
T = dyn_cast_or_null<MDTuple>(MD);
3799 if (
T->getNumOperands() < 1)
3801 auto *OldTag = dyn_cast_or_null<MDString>(
T->getOperand(0));
3804 if (!OldTag->getString().startswith(
"llvm.vectorizer."))
3811 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.
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
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.
This class represents lattice values for constants.
Type * getParamType(unsigned i) const
Parameter type accessors.
static Value * UpgradeX86VPERMT2Intrinsics(IRBuilder<> &Builder, CallInst &CI, bool ZeroMask, bool IndexForm)
LoadInst * CreateLoad(Type *Ty, Value *Ptr, const char *Name)
Provided to resolve 'CreateLoad(Ty, Ptr, "...")' correctly, instead of converting the string to 'bool...
Value * CreateXor(Value *LHS, Value *RHS, const Twine &Name="")
A Module instance is used to store all the information related to an LLVM module. ...
LoadInst * CreateAlignedLoad(Type *Ty, Value *Ptr, unsigned Align, const char *Name)
Provided to resolve 'CreateAlignedLoad(Ptr, Align, "...")' correctly, instead of converting the strin...
static MDString * get(LLVMContext &Context, StringRef Str)
bool UpgradeRetainReleaseMarker(Module &M)
This checks for objc retain release marker which should be upgraded.
void push_back(const T &Elt)
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)
static Value * upgradeX86ConcatShift(IRBuilder<> &Builder, CallInst &CI, bool IsShiftRight, bool ZeroMask)
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.
Value * getArgOperand(unsigned i) const
unsigned getBitWidth() const
Return the number of bits in the Vector type.
amdgpu Simplify well known AMD library false Value Value const Twine & Name
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...
void setCalledFunction(Value *Fn)
Sets the function called, including updating the function type.
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.
iterator_range< User::op_iterator > arg_operands()
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...
Value * getOperand(unsigned i) const
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.
Type * getScalarType() const
If this is a vector type, return the element type, otherwise return 'this'.
StringRef getString() const
static Value * UpgradeMaskedStore(IRBuilder<> &Builder, Value *Ptr, Value *Data, Value *Mask, bool Aligned)
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.
static Function * Create(FunctionType *Ty, LinkageTypes Linkage, unsigned AddrSpace, const Twine &N="", Module *M=nullptr)
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)
unsigned getAddressSpace() const
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 Value * UpgradeX86AddSubSatIntrinsics(IRBuilder<> &Builder, CallInst &CI, bool IsSigned, bool IsAddition)
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.
Value * CreateExtractValue(Value *Agg, ArrayRef< unsigned > Idxs, const Twine &Name="")
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)
unsigned getNumOperands() const
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 * CreateIntCast(Value *V, Type *DestTy, bool isSigned, const Twine &Name="")
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 ...
unsigned getNumArgOperands() const
static bool isOldLoopArgument(Metadata *MD)
static IntegerType * getInt32Ty(LLVMContext &C)
unsigned getIntegerBitWidth() const
unsigned greater or equal
StringRef getName() const
Return a constant reference to the value's name.
Function * getCalledFunction() const
Returns the function called, or null if this is an indirect function invocation.
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)
CallInst * CreateCall(FunctionType *FTy, Value *Callee, ArrayRef< Value *> Args=None, const Twine &Name="", MDNode *FPMathTag=nullptr)
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()
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.
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 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)
static Value * upgradeX86Rotate(IRBuilder<> &Builder, CallInst &CI, bool IsRotateRight)
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
Value * CreateFNeg(Value *V, const Twine &Name="", MDNode *FPMathTag=nullptr)
const BasicBlock * getParent() const