reference, declaration → definition definition → references, declarations, derived classes, virtual overrides reference to multiple definitions → definitions unreferenced |
62 typedef llvm::AMDGPULibFunc FuncInfo; 393 static bool HasNative(AMDGPULibFunc::EFuncId id) { 395 case AMDGPULibFunc::EI_DIVIDE: 396 case AMDGPULibFunc::EI_COS: 397 case AMDGPULibFunc::EI_EXP: 398 case AMDGPULibFunc::EI_EXP2: 399 case AMDGPULibFunc::EI_EXP10: 400 case AMDGPULibFunc::EI_LOG: 401 case AMDGPULibFunc::EI_LOG2: 402 case AMDGPULibFunc::EI_LOG10: 403 case AMDGPULibFunc::EI_POWR: 404 case AMDGPULibFunc::EI_RECIP: 405 case AMDGPULibFunc::EI_RSQRT: 406 case AMDGPULibFunc::EI_SIN: 407 case AMDGPULibFunc::EI_SINCOS: 408 case AMDGPULibFunc::EI_SQRT: 409 case AMDGPULibFunc::EI_TAN: 426 static TableRef getOptTable(AMDGPULibFunc::EFuncId id) { 428 case AMDGPULibFunc::EI_ACOS: return TableRef(tbl_acos); 429 case AMDGPULibFunc::EI_ACOSH: return TableRef(tbl_acosh); 430 case AMDGPULibFunc::EI_ACOSPI: return TableRef(tbl_acospi); 431 case AMDGPULibFunc::EI_ASIN: return TableRef(tbl_asin); 432 case AMDGPULibFunc::EI_ASINH: return TableRef(tbl_asinh); 433 case AMDGPULibFunc::EI_ASINPI: return TableRef(tbl_asinpi); 434 case AMDGPULibFunc::EI_ATAN: return TableRef(tbl_atan); 435 case AMDGPULibFunc::EI_ATANH: return TableRef(tbl_atanh); 436 case AMDGPULibFunc::EI_ATANPI: return TableRef(tbl_atanpi); 437 case AMDGPULibFunc::EI_CBRT: return TableRef(tbl_cbrt); 438 case AMDGPULibFunc::EI_NCOS: 439 case AMDGPULibFunc::EI_COS: return TableRef(tbl_cos); 440 case AMDGPULibFunc::EI_COSH: return TableRef(tbl_cosh); 441 case AMDGPULibFunc::EI_COSPI: return TableRef(tbl_cospi); 442 case AMDGPULibFunc::EI_ERFC: return TableRef(tbl_erfc); 443 case AMDGPULibFunc::EI_ERF: return TableRef(tbl_erf); 444 case AMDGPULibFunc::EI_EXP: return TableRef(tbl_exp); 445 case AMDGPULibFunc::EI_NEXP2: 446 case AMDGPULibFunc::EI_EXP2: return TableRef(tbl_exp2); 447 case AMDGPULibFunc::EI_EXP10: return TableRef(tbl_exp10); 448 case AMDGPULibFunc::EI_EXPM1: return TableRef(tbl_expm1); 449 case AMDGPULibFunc::EI_LOG: return TableRef(tbl_log); 450 case AMDGPULibFunc::EI_NLOG2: 451 case AMDGPULibFunc::EI_LOG2: return TableRef(tbl_log2); 452 case AMDGPULibFunc::EI_LOG10: return TableRef(tbl_log10); 453 case AMDGPULibFunc::EI_NRSQRT: 454 case AMDGPULibFunc::EI_RSQRT: return TableRef(tbl_rsqrt); 455 case AMDGPULibFunc::EI_NSIN: 456 case AMDGPULibFunc::EI_SIN: return TableRef(tbl_sin); 457 case AMDGPULibFunc::EI_SINH: return TableRef(tbl_sinh); 458 case AMDGPULibFunc::EI_SINPI: return TableRef(tbl_sinpi); 459 case AMDGPULibFunc::EI_NSQRT: 460 case AMDGPULibFunc::EI_SQRT: return TableRef(tbl_sqrt); 461 case AMDGPULibFunc::EI_TAN: return TableRef(tbl_tan); 462 case AMDGPULibFunc::EI_TANH: return TableRef(tbl_tanh); 463 case AMDGPULibFunc::EI_TANPI: return TableRef(tbl_tanpi); 464 case AMDGPULibFunc::EI_TGAMMA: return TableRef(tbl_tgamma); 470 static inline int getVecSize(const AMDGPULibFunc& FInfo) { 474 static inline AMDGPULibFunc::EType getArgType(const AMDGPULibFunc& FInfo) { 474 static inline AMDGPULibFunc::EType getArgType(const AMDGPULibFunc& FInfo) { 482 return EnablePreLink ? AMDGPULibFunc::getOrInsertFunction(M, fInfo) 483 : AMDGPULibFunc::getFunction(M, fInfo); 488 return AMDGPULibFunc::parse(FMangledName, *FInfo); 519 AMDGPULibFunc nf; 523 nf.setPrefix(AMDGPULibFunc::NATIVE); 524 nf.setId(AMDGPULibFunc::EI_SIN); 527 nf.setPrefix(AMDGPULibFunc::NATIVE); 528 nf.setId(AMDGPULibFunc::EI_COS); 551 FInfo.getPrefix() != AMDGPULibFunc::NOPFX || 552 getArgType(FInfo) == AMDGPULibFunc::F64 || !HasNative(FInfo.getId()) || 557 if (FInfo.getId() == AMDGPULibFunc::EI_SINCOS) 560 FInfo.setPrefix(AMDGPULibFunc::NATIVE); 618 AMDGPULibFunc NewLibFunc(Name, FTy); 619 FunctionCallee F = AMDGPULibFunc::getOrInsertFunction(M, NewLibFunc); 683 case AMDGPULibFunc::EI_RECIP: 690 case AMDGPULibFunc::EI_DIVIDE: 697 case AMDGPULibFunc::EI_POW: 698 case AMDGPULibFunc::EI_POWR: 699 case AMDGPULibFunc::EI_POWN: 702 case AMDGPULibFunc::EI_ROOTN: 706 case AMDGPULibFunc::EI_FMA: 707 case AMDGPULibFunc::EI_MAD: 708 case AMDGPULibFunc::EI_NFMA: 712 case AMDGPULibFunc::EI_SQRT: 714 case AMDGPULibFunc::EI_COS: 715 case AMDGPULibFunc::EI_SIN: 716 if ((getArgType(FInfo) == AMDGPULibFunc::F32 || 717 getArgType(FInfo) == AMDGPULibFunc::F64) 718 && (FInfo.getPrefix() == AMDGPULibFunc::NOPFX)) 722 case AMDGPULibFunc::EI_READ_PIPE_2: 723 case AMDGPULibFunc::EI_READ_PIPE_4: 724 case AMDGPULibFunc::EI_WRITE_PIPE_2: 725 case AMDGPULibFunc::EI_WRITE_PIPE_4: 767 if (getArgType(FInfo) == AMDGPULibFunc::F32) { 801 if (getArgType(FInfo) != AMDGPULibFunc::F32 || 802 FInfo.getPrefix() != AMDGPULibFunc::NOPFX || 806 AMDGPULibFunc nf = FInfo; 807 nf.setPrefix(AMDGPULibFunc::NATIVE); 847 (CF1 && (getArgType(FInfo) == AMDGPULibFunc::F32))) 948 getFunction(M, AMDGPULibFunc(issqrt ? AMDGPULibFunc::EI_SQRT 949 : AMDGPULibFunc::EI_RSQRT, 967 double dval = (getArgType(FInfo) == AMDGPULibFunc::F32) 1018 getFunction(M, AMDGPULibFunc(AMDGPULibFunc::EI_EXP2, FInfo)); 1030 double V = (getArgType(FInfo) == AMDGPULibFunc::F32) 1036 needcopysign = (FInfo.getId() != AMDGPULibFunc::EI_POWR) && 1040 needcopysign = needabs = FInfo.getId() != AMDGPULibFunc::EI_POWR && 1048 needcopysign = needabs = FInfo.getId() != AMDGPULibFunc::EI_POWR; 1055 double V = (getArgType(FInfo) == AMDGPULibFunc::F32) 1062 if (getArgType(FInfo) == AMDGPULibFunc::F32) { 1076 if (needcopysign && (FInfo.getId() == AMDGPULibFunc::EI_POW)) { 1081 double y = (getArgType(FInfo) == AMDGPULibFunc::F32) 1091 double y = (getArgType(FInfo) == AMDGPULibFunc::F32) 1105 getFunction(M, AMDGPULibFunc(AMDGPULibFunc::EI_FABS, FInfo)); 1114 getFunction(M, AMDGPULibFunc(AMDGPULibFunc::EI_LOG2, FInfo)); 1120 if (FInfo.getId() == AMDGPULibFunc::EI_POWN) { 1172 getFunction(M, AMDGPULibFunc(AMDGPULibFunc::EI_SQRT, FInfo))) { 1181 getFunction(M, AMDGPULibFunc(AMDGPULibFunc::EI_CBRT, FInfo))) { 1197 getFunction(M, AMDGPULibFunc(AMDGPULibFunc::EI_RSQRT, FInfo))) { 1255 if (getArgType(FInfo) == AMDGPULibFunc::F64 || !HasNative(FInfo.getId())) 1258 nf.setPrefix(AMDGPULibFunc::NATIVE); 1265 if (getArgType(FInfo) == AMDGPULibFunc::F32 && (getVecSize(FInfo) == 1) && 1266 (FInfo.getPrefix() != AMDGPULibFunc::NATIVE)) { 1268 CI->getModule(), AMDGPULibFunc(AMDGPULibFunc::EI_SQRT, FInfo))) { 1283 AMDGPULibFunc fInfo; 1284 if (!AMDGPULibFunc::parse(CI->getCalledFunction()->getName(), fInfo)) 1289 bool const isSin = fInfo.getId() == AMDGPULibFunc::EI_SIN; 1311 fInfo.setId(isSin ? AMDGPULibFunc::EI_COS : AMDGPULibFunc::EI_SIN); 1311 fInfo.setId(isSin ? AMDGPULibFunc::EI_COS : AMDGPULibFunc::EI_SIN); 1343 AMDGPULibFunc nf(AMDGPULibFunc::EI_SINCOS, fInfo); 1343 AMDGPULibFunc nf(AMDGPULibFunc::EI_SINCOS, fInfo); 1344 nf.getLeads()[0].PtrKind = AMDGPULibFunc::getEPtrKindFromAddrSpace(AMDGPUAS::FLAT_ADDRESS); 1439 opr0 = (getArgType(FInfo) == AMDGPULibFunc::F64) 1445 opr1 = (getArgType(FInfo) == AMDGPULibFunc::F64) 1451 opr2 = (getArgType(FInfo) == AMDGPULibFunc::F64) 1459 case AMDGPULibFunc::EI_ACOS: 1463 case AMDGPULibFunc::EI_ACOSH: 1468 case AMDGPULibFunc::EI_ACOSPI: 1472 case AMDGPULibFunc::EI_ASIN: 1476 case AMDGPULibFunc::EI_ASINH: 1481 case AMDGPULibFunc::EI_ASINPI: 1485 case AMDGPULibFunc::EI_ATAN: 1489 case AMDGPULibFunc::EI_ATANH: 1494 case AMDGPULibFunc::EI_ATANPI: 1498 case AMDGPULibFunc::EI_CBRT: 1502 case AMDGPULibFunc::EI_COS: 1506 case AMDGPULibFunc::EI_COSH: 1510 case AMDGPULibFunc::EI_COSPI: 1514 case AMDGPULibFunc::EI_EXP: 1518 case AMDGPULibFunc::EI_EXP2: 1522 case AMDGPULibFunc::EI_EXP10: 1526 case AMDGPULibFunc::EI_EXPM1: 1530 case AMDGPULibFunc::EI_LOG: 1534 case AMDGPULibFunc::EI_LOG2: 1538 case AMDGPULibFunc::EI_LOG10: 1542 case AMDGPULibFunc::EI_RSQRT: 1546 case AMDGPULibFunc::EI_SIN: 1550 case AMDGPULibFunc::EI_SINH: 1554 case AMDGPULibFunc::EI_SINPI: 1558 case AMDGPULibFunc::EI_SQRT: 1562 case AMDGPULibFunc::EI_TAN: 1566 case AMDGPULibFunc::EI_TANH: 1570 case AMDGPULibFunc::EI_TANPI: 1574 case AMDGPULibFunc::EI_RECIP: 1579 case AMDGPULibFunc::EI_DIVIDE: 1583 case AMDGPULibFunc::EI_POW: 1584 case AMDGPULibFunc::EI_POWR: 1588 case AMDGPULibFunc::EI_POWN: { 1597 case AMDGPULibFunc::EI_ROOTN: { 1607 case AMDGPULibFunc::EI_SINCOS: 1613 case AMDGPULibFunc::EI_FMA: 1614 case AMDGPULibFunc::EI_MAD: 1637 if (FInfo.getId() != AMDGPULibFunc::EI_SINCOS) 1651 bool hasTwoResults = (FInfo.getId() == AMDGPULibFunc::EI_SINCOS); 1679 if (getArgType(FInfo) == AMDGPULibFunc::F32) {lib/Target/AMDGPU/AMDGPULibFunc.cpp
84 using ID = AMDGPULibFunc::EFuncId; 94 static_cast<unsigned>(AMDGPULibFunc::EI_LAST_MANGLED); 100 Index + 1 + static_cast<unsigned>(AMDGPULibFunc::EI_LAST_MANGLED)); 348 static AMDGPULibFunc::Param getRetType(AMDGPULibFunc::EFuncId id, 348 static AMDGPULibFunc::Param getRetType(AMDGPULibFunc::EFuncId id, 349 const AMDGPULibFunc::Param (&Leads)[2]) { 350 AMDGPULibFunc::Param Res = Leads[0]; 353 case AMDGPULibFunc::EI_SINCOS: 354 Res.PtrKind = AMDGPULibFunc::BYVALUE; 363 const AMDGPULibFunc::Param (&Leads)[2]; 367 ParamIterator(const AMDGPULibFunc::Param (&leads)[2], 371 AMDGPULibFunc::Param getNextParam(); 374 AMDGPULibFunc::Param ParamIterator::getNextParam() { 375 AMDGPULibFunc::Param P; 382 P.ArgType = AMDGPULibFunc::U32; break; 384 P.ArgType = AMDGPULibFunc::I32; P.VectorSize = 4; break; 386 P.ArgType = AMDGPULibFunc::U32; P.VectorSize = 4; break; 388 P.ArgType = AMDGPULibFunc::F32; P.VectorSize = 4; break; 390 P.ArgType = AMDGPULibFunc::U64; break; 392 P.ArgType = AMDGPULibFunc::EVENT; break; 394 P.ArgType = AMDGPULibFunc::SAMPLER; break; 405 P.PtrKind = AMDGPULibFunc::BYVALUE; break; 407 P.VectorSize = 2; P.PtrKind = AMDGPULibFunc::BYVALUE; break; 409 P.VectorSize = 3; P.PtrKind = AMDGPULibFunc::BYVALUE; break; 411 P.VectorSize = 4; P.PtrKind = AMDGPULibFunc::BYVALUE; break; 413 P.VectorSize = 8; P.PtrKind = AMDGPULibFunc::BYVALUE; break; 415 P.VectorSize = 16; P.PtrKind = AMDGPULibFunc::BYVALUE; break; 417 P.PtrKind |= AMDGPULibFunc::CONST; break; 419 P.PtrKind |= AMDGPULibFunc::VOLATILE; break; 421 P.ArgType = AMDGPULibFunc::I32; break; 423 P.ArgType = AMDGPULibFunc::U32; break; 426 P.ArgType &= ~AMDGPULibFunc::BASE_TYPE_MASK; 427 P.ArgType |= AMDGPULibFunc::UINT; 432 case AMDGPULibFunc::IMG1DA: P.VectorSize = 2; break; 433 case AMDGPULibFunc::IMG1DB: P.VectorSize = 1; break; 434 case AMDGPULibFunc::IMG2DA: P.VectorSize = 4; break; 435 case AMDGPULibFunc::IMG1D: P.VectorSize = 1; break; 436 case AMDGPULibFunc::IMG2D: P.VectorSize = 2; break; 437 case AMDGPULibFunc::IMG3D: P.VectorSize = 4; break; 439 P.PtrKind = AMDGPULibFunc::BYVALUE; 440 P.ArgType = AMDGPULibFunc::I32; 444 unsigned AS = AMDGPULibFunc::getAddrSpaceFromEPtrKind(P.PtrKind); 449 P.PtrKind = AMDGPULibFunc::getEPtrKindFromAddrSpace(AS); 450 P.PtrKind |= AMDGPULibFunc::CONST; 540 static AMDGPULibFunc::ENamePrefix parseNamePrefix(StringRef& mangledName) { 542 AMDGPULibFunc::ENamePrefix Pfx = 544 .Case("native", AMDGPULibFunc::NATIVE) 545 .Case("half" , AMDGPULibFunc::HALF) 546 .Default(AMDGPULibFunc::NOPFX); 548 if (Pfx != AMDGPULibFunc::NOPFX) 574 AMDGPULibFunc::Param Prev; 575 bool parseItaniumParam(StringRef& param, AMDGPULibFunc::Param &res); 580 AMDGPULibFunc::Param &res) { 586 if (eatTerm(param, 'K')) res.PtrKind |= AMDGPULibFunc::CONST; 587 if (eatTerm(param, 'V')) res.PtrKind |= AMDGPULibFunc::VOLATILE; 597 res.PtrKind = AMDGPULibFunc::BYVALUE; 611 .Case("ocl_image1darray" , AMDGPULibFunc::IMG1DA) 612 .Case("ocl_image1dbuffer", AMDGPULibFunc::IMG1DB) 613 .Case("ocl_image2darray" , AMDGPULibFunc::IMG2DA) 614 .Case("ocl_image1d" , AMDGPULibFunc::IMG1D) 615 .Case("ocl_image2d" , AMDGPULibFunc::IMG2D) 616 .Case("ocl_image3d" , AMDGPULibFunc::IMG3D) 617 .Case("ocl_event" , AMDGPULibFunc::DUMMY) 618 .Case("ocl_sampler" , AMDGPULibFunc::DUMMY) 619 .Default(AMDGPULibFunc::DUMMY); 623 case 'h': res.ArgType = AMDGPULibFunc::U8; break; 624 case 't': res.ArgType = AMDGPULibFunc::U16; break; 625 case 'j': res.ArgType = AMDGPULibFunc::U32; break; 626 case 'm': res.ArgType = AMDGPULibFunc::U64; break; 627 case 'c': res.ArgType = AMDGPULibFunc::I8; break; 628 case 's': res.ArgType = AMDGPULibFunc::I16; break; 629 case 'i': res.ArgType = AMDGPULibFunc::I32; break; 630 case 'l': res.ArgType = AMDGPULibFunc::I64; break; 631 case 'f': res.ArgType = AMDGPULibFunc::F32; break; 632 case 'd': res.ArgType = AMDGPULibFunc::F64; break; 634 res.ArgType = AMDGPULibFunc::F16; break; 678 bool AMDGPULibFunc::parse(StringRef FuncName, AMDGPULibFunc &F) { 727 static const char *getItaniumTypeName(AMDGPULibFunc::EType T) { 729 case AMDGPULibFunc::U8: return "h"; 730 case AMDGPULibFunc::U16: return "t"; 731 case AMDGPULibFunc::U32: return "j"; 732 case AMDGPULibFunc::U64: return "m"; 733 case AMDGPULibFunc::I8: return "c"; 734 case AMDGPULibFunc::I16: return "s"; 735 case AMDGPULibFunc::I32: return "i"; 736 case AMDGPULibFunc::I64: return "l"; 737 case AMDGPULibFunc::F16: return "Dh"; 738 case AMDGPULibFunc::F32: return "f"; 739 case AMDGPULibFunc::F64: return "d"; 740 case AMDGPULibFunc::IMG1DA: return "16ocl_image1darray"; 741 case AMDGPULibFunc::IMG1DB: return "17ocl_image1dbuffer"; 742 case AMDGPULibFunc::IMG2DA: return "16ocl_image2darray"; 743 case AMDGPULibFunc::IMG1D: return "11ocl_image1d"; 744 case AMDGPULibFunc::IMG2D: return "11ocl_image2d"; 745 case AMDGPULibFunc::IMG3D: return "11ocl_image3d"; 746 case AMDGPULibFunc::SAMPLER: return "11ocl_sampler"; 747 case AMDGPULibFunc::EVENT: return "9ocl_event"; 779 SmallVector<AMDGPULibFunc::Param, 10> Str; // list of accumulated substituions 782 int findSubst(const AMDGPULibFunc::Param& P) const { 784 const AMDGPULibFunc::Param& T = Str[I]; 795 bool trySubst(Stream& os, const AMDGPULibFunc::Param& p) { 811 void operator()(Stream& os, AMDGPULibFunc::Param p) { 823 AMDGPULibFunc::Param Ptr; 828 if (p.PtrKind & AMDGPULibFunc::CONST) os << 'K'; 829 if (p.PtrKind & AMDGPULibFunc::VOLATILE) os << 'V'; 874 const AMDGPULibFunc::Param& P, 878 case AMDGPULibFunc::U8: 879 case AMDGPULibFunc::I8: T = Type::getInt8Ty(C); break; 880 case AMDGPULibFunc::U16: 881 case AMDGPULibFunc::I16: T = Type::getInt16Ty(C); break; 882 case AMDGPULibFunc::U32: 883 case AMDGPULibFunc::I32: T = Type::getInt32Ty(C); break; 884 case AMDGPULibFunc::U64: 885 case AMDGPULibFunc::I64: T = Type::getInt64Ty(C); break; 886 case AMDGPULibFunc::F16: T = Type::getHalfTy(C); break; 887 case AMDGPULibFunc::F32: T = Type::getFloatTy(C); break; 888 case AMDGPULibFunc::F64: T = Type::getDoubleTy(C); break; 890 case AMDGPULibFunc::IMG1DA: 891 case AMDGPULibFunc::IMG1DB: 892 case AMDGPULibFunc::IMG2DA: 893 case AMDGPULibFunc::IMG1D: 894 case AMDGPULibFunc::IMG2D: 895 case AMDGPULibFunc::IMG3D: 897 case AMDGPULibFunc::SAMPLER: 899 case AMDGPULibFunc::EVENT: 907 if (P.PtrKind != AMDGPULibFunc::BYVALUE) 908 T = useAddrSpace ? T->getPointerTo((P.PtrKind & AMDGPULibFunc::ADDR_SPACE) 942 Function *AMDGPULibFunc::getFunction(Module *M, const AMDGPULibFunc &fInfo) { 957 const AMDGPULibFunc &fInfo) { 1014 Id = AMDGPULibFunc::EI_NONE; 1018 AMDGPULibFunc::AMDGPULibFunc(const AMDGPULibFunc &F) { 1027 AMDGPULibFunc &AMDGPULibFunc::operator=(const AMDGPULibFunc &F) { 1027 AMDGPULibFunc &AMDGPULibFunc::operator=(const AMDGPULibFunc &F) { 1030 new (this) AMDGPULibFunc(F); 1034 AMDGPULibFunc::AMDGPULibFunc(EFuncId Id, const AMDGPULibFunc &CopyFrom) { 1047 AMDGPULibFunc::Param *AMDGPULibFunc::getLeads() { 1053 const AMDGPULibFunc::Param *AMDGPULibFunc::getLeads() const {lib/Target/AMDGPU/AMDGPULibFunc.h
359 AMDGPULibFunc(const AMDGPULibFunc &F); 362 explicit AMDGPULibFunc(EFuncId Id, const AMDGPULibFunc &CopyFrom); 366 AMDGPULibFunc &operator=(const AMDGPULibFunc &F); 366 AMDGPULibFunc &operator=(const AMDGPULibFunc &F); 394 static Function *getFunction(llvm::Module *M, const AMDGPULibFunc &fInfo); 397 const AMDGPULibFunc &fInfo); 398 static bool parse(StringRef MangledName, AMDGPULibFunc &Ptr);