Lines Matching full:create
76 return shape ? builder.create<BroadcastOp>(type, value) : value;
134 builder.create<vector::ShapeCastOp>(expandedType, operand);
152 builder.create<vector::ExtractOp>(tuple.value(), offsets);
160 Value result = builder.create<arith::ConstantOp>(
164 result = builder.create<vector::InsertOp>(results[i], result,
168 return builder.create<vector::ShapeCastOp>(
173 // Helper functions to create constants.
180 return builder.create<arith::ConstantOp>(
185 return builder.create<arith::ConstantOp>(builder.getF32FloatAttr(value));
189 return builder.create<arith::ConstantOp>(builder.getI32IntegerAttr(value));
194 return builder.create<arith::BitcastOp>(builder.getF32Type(), i32Value);
203 return builder.create<arith::SelectOp>(
204 builder.create<arith::CmpFOp>(arith::CmpFPredicate::ULT, value, bound),
210 return builder.create<arith::SelectOp>(
211 builder.create<arith::CmpFOp>(arith::CmpFPredicate::UGT, value, bound),
241 Value i32Half = builder.create<arith::BitcastOp>(i32, cstHalf);
242 Value i32InvMantMask = builder.create<arith::BitcastOp>(i32, cstInvMantMask);
243 Value i32Arg = builder.create<arith::BitcastOp>(i32Vec, arg);
246 Value tmp0 = builder.create<arith::AndIOp>(i32Arg, bcast(i32InvMantMask));
247 Value tmp1 = builder.create<arith::OrIOp>(tmp0, bcast(i32Half));
248 Value normalizedFraction = builder.create<arith::BitcastOp>(f32Vec, tmp1);
251 Value arg0 = isPositive ? arg : builder.create<math::AbsFOp>(arg);
252 Value biasedExponentBits = builder.create<arith::ShRUIOp>(
253 builder.create<arith::BitcastOp>(i32Vec, arg0),
256 builder.create<arith::SIToFPOp>(f32Vec, biasedExponentBits);
258 builder.create<arith::SubFOp>(biasedExponent, bcast(cst126f));
278 Value biasedArg = builder.create<arith::AddIOp>(arg, bias);
280 builder.create<arith::ShLIOp>(biasedArg, exponetBitLocation);
281 Value exp2ValueF32 = builder.create<arith::BitcastOp>(f32Vec, exp2ValueInt);
300 Value res = builder.create<math::FmaOp>(x, coeffs[coeffs.size() - 1],
303 res = builder.create<math::FmaOp>(x, res, coeffs[i]);
329 // Create F32 equivalent type.
343 operands.push_back(rewriter.create<arith::ExtFOp>(loc, newType, operand));
345 rewriter.create<T>(loc, TypeRange{newType}, operands, op->getAttrs());
393 Value abs = builder.create<math::AbsFOp>(operand);
400 builder.create<arith::CmpFOp>(arith::CmpFPredicate::OGT, abs, twoThirds);
401 Value addone = builder.create<arith::AddFOp>(abs, one);
402 Value subone = builder.create<arith::SubFOp>(abs, one);
403 Value xnum = builder.create<arith::SelectOp>(cmp2, subone, abs);
404 Value xden = builder.create<arith::SelectOp>(cmp2, addone, one);
413 builder.create<arith::CmpFOp>(arith::CmpFPredicate::OGT, abs, tan3pio8);
414 xnum = builder.create<arith::SelectOp>(cmp1, one, xnum);
415 xden = builder.create<arith::SelectOp>(cmp1, abs, xden);
417 Value x = builder.create<arith::DivFOp>(xnum, xden);
418 Value xx = builder.create<arith::MulFOp>(x, x);
435 n = builder.create<math::FmaOp>(xx, n, p1);
436 n = builder.create<math::FmaOp>(xx, n, p2);
437 n = builder.create<math::FmaOp>(xx, n, p3);
438 n = builder.create<math::FmaOp>(xx, n, p4);
439 n = builder.create<arith::MulFOp>(n, xx);
443 d = builder.create<math::FmaOp>(xx, d, q1);
444 d = builder.create<math::FmaOp>(xx, d, q2);
445 d = builder.create<math::FmaOp>(xx, d, q3);
446 d = builder.create<math::FmaOp>(xx, d, q4);
449 Value ans0 = builder.create<arith::DivFOp>(n, d);
450 ans0 = builder.create<math::FmaOp>(ans0, x, x);
454 Value ans2 = builder.create<arith::AddFOp>(mpi4, ans0);
455 Value ans = builder.create<arith::SelectOp>(cmp2, ans2, ans0);
458 Value ans1 = builder.create<arith::SubFOp>(mpi2, ans0);
459 ans = builder.create<arith::SelectOp>(cmp1, ans1, ans);
492 auto div = builder.create<arith::DivFOp>(y, x);
493 auto atan = builder.create<math::AtanOp>(div);
498 auto addPi = builder.create<arith::AddFOp>(atan, pi);
499 auto subPi = builder.create<arith::SubFOp>(atan, pi);
501 builder.create<arith::CmpFOp>(arith::CmpFPredicate::OGT, atan, zero);
502 auto flippedAtan = builder.create<arith::SelectOp>(atanGt, subPi, addPi);
505 auto xGt = builder.create<arith::CmpFOp>(arith::CmpFPredicate::OGT, x, zero);
506 Value result = builder.create<arith::SelectOp>(xGt, atan, flippedAtan);
510 builder.create<arith::CmpFOp>(arith::CmpFPredicate::OEQ, x, zero);
511 Value yGt = builder.create<arith::CmpFOp>(arith::CmpFPredicate::OGT, y, zero);
512 Value isHalfPi = builder.create<arith::AndIOp>(xZero, yGt);
514 result = builder.create<arith::SelectOp>(isHalfPi, halfPi, result);
517 Value yLt = builder.create<arith::CmpFOp>(arith::CmpFPredicate::OLT, y, zero);
518 Value isNegativeHalfPiPi = builder.create<arith::AndIOp>(xZero, yLt);
521 result = builder.create<arith::SelectOp>(isNegativeHalfPiPi, negativeHalfPiPi,
526 builder.create<arith::CmpFOp>(arith::CmpFPredicate::OEQ, y, zero);
527 Value isNan = builder.create<arith::AndIOp>(xZero, yZero);
529 result = builder.create<arith::SelectOp>(isNan, cstNan, result);
569 Value tinyMask = builder.create<arith::CmpFOp>(
570 arith::CmpFPredicate::OLT, builder.create<math::AbsFOp>(op.getOperand()),
589 Value x2 = builder.create<arith::MulFOp>(x, x);
592 Value p = builder.create<math::FmaOp>(x2, alpha13, alpha11);
593 p = builder.create<math::FmaOp>(x2, p, alpha9);
594 p = builder.create<math::FmaOp>(x2, p, alpha7);
595 p = builder.create<math::FmaOp>(x2, p, alpha5);
596 p = builder.create<math::FmaOp>(x2, p, alpha3);
597 p = builder.create<math::FmaOp>(x2, p, alpha1);
598 p = builder.create<arith::MulFOp>(x, p);
601 Value q = builder.create<math::FmaOp>(x2, beta6, beta4);
602 q = builder.create<math::FmaOp>(x2, q, beta2);
603 q = builder.create<math::FmaOp>(x2, q, beta0);
606 Value res = builder.create<arith::SelectOp>(
607 tinyMask, x, builder.create<arith::DivFOp>(p, q));
690 Value mask = builder.create<arith::CmpFOp>(arith::CmpFPredicate::OLT, x,
692 Value tmp = builder.create<arith::SelectOp>(mask, x, cstZero);
694 x = builder.create<arith::SubFOp>(x, cstOne);
695 e = builder.create<arith::SubFOp>(
696 e, builder.create<arith::SelectOp>(mask, cstOne, cstZero));
697 x = builder.create<arith::AddFOp>(x, tmp);
699 Value x2 = builder.create<arith::MulFOp>(x, x);
700 Value x3 = builder.create<arith::MulFOp>(x2, x);
704 y0 = builder.create<math::FmaOp>(cstCephesLogP0, x, cstCephesLogP1);
705 y1 = builder.create<math::FmaOp>(cstCephesLogP3, x, cstCephesLogP4);
706 y2 = builder.create<math::FmaOp>(cstCephesLogP6, x, cstCephesLogP7);
707 y0 = builder.create<math::FmaOp>(y0, x, cstCephesLogP2);
708 y1 = builder.create<math::FmaOp>(y1, x, cstCephesLogP5);
709 y2 = builder.create<math::FmaOp>(y2, x, cstCephesLogP8);
710 y0 = builder.create<math::FmaOp>(y0, x3, y1);
711 y0 = builder.create<math::FmaOp>(y0, x3, y2);
712 y0 = builder.create<arith::MulFOp>(y0, x3);
714 y0 = builder.create<math::FmaOp>(cstNegHalf, x2, y0);
715 x = builder.create<arith::AddFOp>(x, y0);
719 x = builder.create<math::FmaOp>(x, cstLog2e, e);
722 x = builder.create<math::FmaOp>(e, cstLn2, x);
725 Value invalidMask = builder.create<arith::CmpFOp>(arith::CmpFPredicate::ULT,
727 Value zeroMask = builder.create<arith::CmpFOp>(arith::CmpFPredicate::OEQ,
729 Value posInfMask = builder.create<arith::CmpFOp>(arith::CmpFPredicate::OEQ,
736 Value aproximation = builder.create<arith::SelectOp>(
738 builder.create<arith::SelectOp>(
740 builder.create<arith::SelectOp>(posInfMask, cstPosInf, x)));
805 Value u = builder.create<arith::AddFOp>(x, cstOne);
807 builder.create<arith::CmpFOp>(arith::CmpFPredicate::OEQ, u, cstOne);
808 Value logU = builder.create<math::LogOp>(u);
810 builder.create<arith::CmpFOp>(arith::CmpFPredicate::OEQ, u, logU);
811 Value logLarge = builder.create<arith::MulFOp>(
812 x, builder.create<arith::DivFOp>(
813 logU, builder.create<arith::SubFOp>(u, cstOne)));
814 Value approximation = builder.create<arith::SelectOp>(
815 builder.create<arith::OrIOp>(uSmall, uInf), x, logLarge);
853 return builder.create<math::FmaOp>(a, b, c);
857 return builder.create<arith::MulFOp>(a, b);
861 return builder.create<arith::SubFOp>(a, b);
864 auto abs = [&](Value a) -> Value { return builder.create<math::AbsFOp>(a); };
866 auto sqrt = [&](Value a) -> Value { return builder.create<math::SqrtOp>(a); };
869 return builder.create<math::CopySignOp>(a, b);
873 return builder.create<arith::SelectOp>(a, b, c);
881 builder.create<arith::CmpFOp>(arith::CmpFPredicate::OGT, aa,
948 return builder.create<math::FmaOp>(a, b, c);
952 return builder.create<arith::MulFOp>(a, b);
955 Value negOperand = builder.create<arith::NegFOp>(operand);
960 builder.create<arith::CmpFOp>(arith::CmpFPredicate::OGT, operand, zero);
961 Value r = builder.create<arith::SelectOp>(selR, negOperand, operand);
964 builder.create<arith::CmpFOp>(arith::CmpFPredicate::OGT, r, chkConst);
969 builder.create<math::AsinOp>(r));
971 Value falseVal = builder.create<math::SqrtOp>(fma(half, r, half));
972 falseVal = builder.create<math::AsinOp>(falseVal);
975 r = builder.create<arith::SelectOp>(firstPred, trueVal, falseVal);
979 builder.create<arith::CmpFOp>(arith::CmpFPredicate::OGE, operand, negOne);
982 builder.create<arith::CmpFOp>(arith::CmpFPredicate::OLT, operand, zero);
985 builder.create<arith::AndIOp>(greaterThanNegOne, lessThanZero);
989 builder.create<arith::NegFOp>(r));
992 builder.create<arith::SelectOp>(betweenNegOneZero, trueVal, r);
1075 builder.create<arith::CmpFOp>(arith::CmpFPredicate::OLT, operand, zero);
1076 Value negArg = builder.create<arith::NegFOp>(operand);
1077 Value x = builder.create<arith::SelectOp>(isNegativeArg, negArg, operand);
1091 builder.create<arith::CmpFOp>(arith::CmpFPredicate::OLT, x, bounds[j]);
1093 p[i] = builder.create<arith::SelectOp>(isLessThanBound[j], p[i],
1095 q[i] = builder.create<arith::SelectOp>(isLessThanBound[j], q[i],
1098 offset = builder.create<arith::SelectOp>(isLessThanBound[j], offset,
1101 isLessThanBound[intervalsCount - 1] = builder.create<arith::CmpFOp>(
1106 Value rationalPoly = builder.create<arith::DivFOp>(pPoly, qPoly);
1107 Value formula = builder.create<arith::AddFOp>(offset, rationalPoly);
1108 formula = builder.create<arith::SelectOp>(isLessThanBound[intervalsCount - 1],
1112 Value negFormula = builder.create<arith::NegFOp>(formula);
1114 builder.create<arith::SelectOp>(isNegativeArg, negFormula, formula);
1138 return builder.create<arith::SelectOp>(
1139 builder.create<arith::CmpFOp>(pred, value, bound), value, bound);
1171 return builder.create<arith::AddFOp>(a, b);
1176 auto floor = [&](Value a) { return builder.create<math::FloorOp>(a); };
1178 return builder.create<math::FmaOp>(a, b, c);
1181 return builder.create<arith::MulFOp>(a, b);
1285 Value nI32 = builder.create<arith::FPToSIOp>(i32Vec, n);
1333 Value u = builder.create<math::ExpOp>(x);
1335 builder.create<arith::CmpFOp>(arith::CmpFPredicate::UEQ, u, cstOne);
1336 Value uMinusOne = builder.create<arith::SubFOp>(u, cstOne);
1337 Value uMinusOneEqNegOne = builder.create<arith::CmpFOp>(
1340 Value logU = builder.create<math::LogOp>(u);
1344 builder.create<arith::CmpFOp>(arith::CmpFPredicate::OEQ, logU, u);
1347 Value expm1 = builder.create<arith::MulFOp>(
1348 uMinusOne, builder.create<arith::DivFOp>(x, logU));
1349 expm1 = builder.create<arith::SelectOp>(isInf, u, expm1);
1350 Value approximation = builder.create<arith::SelectOp>(
1352 builder.create<arith::SelectOp>(uMinusOneEqNegOne, cstNegOne, expm1));
1397 return builder.create<arith::MulFOp>(a, b);
1400 return builder.create<arith::SubFOp>(a, b);
1402 auto floor = [&](Value a) { return builder.create<math::FloorOp>(a); };
1406 return builder.create<arith::FPToSIOp>(i32Vec, a);
1410 return builder.create<arith::AndIOp>(a, bcast(i32Cst(builder, 3)));
1414 return builder.create<arith::CmpIOp>(arith::CmpIPredicate::eq, a, b);
1418 return builder.create<arith::CmpIOp>(arith::CmpIPredicate::sgt, a, b);
1422 return builder.create<arith::SelectOp>(cond, t, f);
1426 return builder.create<math::FmaOp>(a, b, c);
1430 return builder.create<arith::OrIOp>(a, b);
1527 Value value = b.create<arith::ConstantOp>(attr);
1544 Value absValue = b.create<math::AbsFOp>(operand);
1545 Value intValue = b.create<arith::BitcastOp>(intTy, absValue);
1546 Value divideBy4 = b.create<arith::ShRSIOp>(intValue, intTwo);
1547 Value divideBy16 = b.create<arith::ShRSIOp>(intValue, intFour);
1548 intValue = b.create<arith::AddIOp>(divideBy4, divideBy16);
1551 divideBy16 = b.create<arith::ShRSIOp>(intValue, intFour);
1552 intValue = b.create<arith::AddIOp>(intValue, divideBy16);
1555 Value divideBy256 = b.create<arith::ShRSIOp>(intValue, intEight);
1556 intValue = b.create<arith::AddIOp>(intValue, divideBy256);
1559 intValue = b.create<arith::AddIOp>(intValue, intMagic);
1563 Value floatValue = b.create<arith::BitcastOp>(floatTy, intValue);
1564 Value squared = b.create<arith::MulFOp>(floatValue, floatValue);
1565 Value mulTwo = b.create<arith::MulFOp>(floatValue, fpTwo);
1566 Value divSquared = b.create<arith::DivFOp>(absValue, squared);
1567 floatValue = b.create<arith::AddFOp>(mulTwo, divSquared);
1568 floatValue = b.create<arith::MulFOp>(floatValue, fpThird);
1571 squared = b.create<arith::MulFOp>(floatValue, floatValue);
1572 mulTwo = b.create<arith::MulFOp>(floatValue, fpTwo);
1573 divSquared = b.create<arith::DivFOp>(absValue, squared);
1574 floatValue = b.create<arith::AddFOp>(mulTwo, divSquared);
1575 floatValue = b.create<arith::MulFOp>(floatValue, fpThird);
1579 b.create<arith::CmpFOp>(arith::CmpFPredicate::OEQ, absValue, fpZero);
1580 floatValue = b.create<arith::SelectOp>(isZero, fpZero, floatValue);
1581 floatValue = b.create<math::CopySignOp>(floatValue, operand);
1622 Value negHalf = builder.create<arith::MulFOp>(op.getOperand(), cstNegHalf);
1626 Value ltMinMask = builder.create<arith::CmpFOp>(
1628 Value infMask = builder.create<arith::CmpFOp>(arith::CmpFPredicate::OEQ,
1630 Value notNormalFiniteMask = builder.create<arith::OrIOp>(ltMinMask, infMask);
1635 return builder.create<x86vector::RsqrtOp>(operands);
1642 Value inner = builder.create<arith::MulFOp>(negHalf, yApprox);
1643 Value fma = builder.create<math::FmaOp>(yApprox, inner, cstOnePointFive);
1644 Value yNewton = builder.create<arith::MulFOp>(yApprox, fma);
1652 builder.create<arith::SelectOp>(notNormalFiniteMask, yApprox, yNewton);