Lines Matching full:create

124   Value result = rewriter.create<arith::ConstantOp>(
132 rewriter.create<vector::ExtractOp>(loc, input, positions));
134 rewriter.create<Op>(loc, vecType.getElementType(), operands);
136 rewriter.create<vector::InsertOp>(loc, scalarOp, result, positions);
154 /// Create linkonce_odr function to implement the power function with
198 auto funcOp = builder.create<func::FuncOp>(funcName, funcType);
211 Value zeroValue = builder.create<arith::ConstantOp>(
213 Value oneValue = builder.create<arith::ConstantOp>(
215 Value minusOneValue = builder.create<arith::ConstantOp>(
224 builder.create<arith::CmpIOp>(arith::CmpIPredicate::eq, pArg, zeroValue);
226 builder.create<func::ReturnOp>(oneValue);
230 builder.create<cf::CondBranchOp>(pIsZero, thenBlock, fallthroughBlock);
235 builder.create<arith::CmpIOp>(arith::CmpIPredicate::sle, pArg, zeroValue);
239 builder.create<arith::CmpIOp>(arith::CmpIPredicate::eq, bArg, zeroValue);
242 builder.create<func::ReturnOp>(
243 builder.create<arith::DivSIOp>(oneValue, zeroValue).getResult());
247 builder.create<cf::CondBranchOp>(bIsZero, thenBlock, fallthroughBlock);
252 builder.create<arith::CmpIOp>(arith::CmpIPredicate::eq, bArg, oneValue);
255 builder.create<func::ReturnOp>(oneValue);
259 builder.create<cf::CondBranchOp>(bIsOne, thenBlock, fallthroughBlock);
263 auto bIsMinusOne = builder.create<arith::CmpIOp>(arith::CmpIPredicate::eq,
267 auto pIsOdd = builder.create<arith::CmpIOp>(
268 arith::CmpIPredicate::ne, builder.create<arith::AndIOp>(pArg, oneValue),
272 builder.create<func::ReturnOp>(minusOneValue);
276 builder.create<cf::CondBranchOp>(pIsOdd, thenBlock, fallthroughBlock);
281 builder.create<func::ReturnOp>(oneValue);
285 builder.create<cf::CondBranchOp>(bIsMinusOne, pIsOdd->getBlock(),
291 builder.create<func::ReturnOp>(zeroValue);
298 builder.create<cf::CondBranchOp>(pIsNeg, bIsZero->getBlock(), loopHeader,
316 auto powerTmpIsOdd = builder.create<arith::CmpIOp>(
318 builder.create<arith::AndIOp>(powerTmp, oneValue), zeroValue);
321 Value newResultTmp = builder.create<arith::MulIOp>(resultTmp, baseTmp);
325 builder.create<cf::BranchOp>(newResultTmp, fallthroughBlock);
328 builder.create<cf::CondBranchOp>(powerTmpIsOdd, thenBlock, fallthroughBlock,
335 Value newPowerTmp = builder.create<arith::ShRUIOp>(powerTmp, oneValue);
338 auto newPowerIsZero = builder.create<arith::CmpIOp>(arith::CmpIPredicate::eq,
342 builder.create<func::ReturnOp>(newResultTmp);
346 builder.create<cf::CondBranchOp>(newPowerIsZero, thenBlock, fallthroughBlock);
351 Value newBaseTmp = builder.create<arith::MulIOp>(baseTmp, baseTmp);
353 builder.create<cf::BranchOp>(
379 /// Create linkonce_odr function to implement the power function with
423 auto funcOp = builder.create<func::FuncOp>(funcName, funcType);
436 Value oneBValue = builder.create<arith::ConstantOp>(
438 Value zeroPValue = builder.create<arith::ConstantOp>(
440 Value onePValue = builder.create<arith::ConstantOp>(
442 Value minPValue = builder.create<arith::ConstantOp>(
445 Value maxPValue = builder.create<arith::ConstantOp>(
452 builder.create<arith::CmpIOp>(arith::CmpIPredicate::eq, pArg, zeroPValue);
454 builder.create<func::ReturnOp>(oneBValue);
458 builder.create<cf::CondBranchOp>(pIsZero, thenBlock, fallthroughBlock);
462 auto pIsNeg = builder.create<arith::CmpIOp>(arith::CmpIPredicate::sle, pArg,
466 builder.create<arith::CmpIOp>(arith::CmpIPredicate::eq, pArg, minPValue);
473 Value negP = builder.create<arith::SubIOp>(zeroPValue, pArg);
474 auto pInit = builder.create<arith::SelectOp>(pIsNeg, negP, pArg);
475 pInit = builder.create<arith::SelectOp>(pIsMin, maxPValue, pInit);
492 builder.create<cf::BranchOp>(loopHeader, ValueRange{oneBValue, bArg, pInit});
494 // Create loop body.
501 auto powerTmpIsOdd = builder.create<arith::CmpIOp>(
503 builder.create<arith::AndIOp>(powerTmp, onePValue), zeroPValue);
506 Value newResultTmp = builder.create<arith::MulFOp>(resultTmp, baseTmp);
510 builder.create<cf::BranchOp>(newResultTmp, fallthroughBlock);
513 builder.create<cf::CondBranchOp>(powerTmpIsOdd, thenBlock, fallthroughBlock,
520 Value newPowerTmp = builder.create<arith::ShRUIOp>(powerTmp, onePValue);
523 auto newPowerIsZero = builder.create<arith::CmpIOp>(arith::CmpIPredicate::eq,
534 Value newBaseTmp = builder.create<arith::MulFOp>(baseTmp, baseTmp);
536 builder.create<cf::BranchOp>(
545 builder.create<cf::CondBranchOp>(newPowerIsZero, loopExit, newResultTmp,
556 builder.create<cf::CondBranchOp>(pIsMin, thenBlock, fallthroughBlock,
559 newResultTmp = builder.create<arith::MulFOp>(newResultTmp, bArg);
560 builder.create<cf::BranchOp>(newResultTmp, fallthroughBlock);
570 builder.create<cf::CondBranchOp>(pIsNeg, thenBlock, returnBlock,
573 newResultTmp = builder.create<arith::DivFOp>(oneBValue, newResultTmp);
574 builder.create<cf::BranchOp>(newResultTmp, returnBlock);
578 builder.create<func::ReturnOp>(returnBlock->getArgument(0));
604 /// Create function to implement the ctlz function the given \p elementType type
670 auto funcOp = builder.create<func::FuncOp>(funcName, funcType);
686 Value bitWidthValue = builder.create<arith::ConstantOp>(
688 Value zeroValue = builder.create<arith::ConstantOp>(
692 builder.create<arith::CmpIOp>(arith::CmpIPredicate::eq, arg, zeroValue);
695 scf::IfOp ifOp = builder.create<scf::IfOp>(
697 ifOp.getThenBodyBuilder().create<scf::YieldOp>(loc, bitWidthValue);
702 Value oneIndex = elseBuilder.create<arith::ConstantOp>(
704 Value oneValue = elseBuilder.create<arith::ConstantOp>(
706 Value bitWidthIndex = elseBuilder.create<arith::ConstantOp>(
708 Value nValue = elseBuilder.create<arith::ConstantOp>(
711 auto loop = elseBuilder.create<scf::ForOp>(
728 Value argIsNonNegative = b.create<arith::CmpIOp>(
730 scf::IfOp ifOp = b.create<scf::IfOp>(
734 b.create<scf::YieldOp>(loc, ValueRange{argIter, nIter});
738 Value nNext = b.create<arith::AddIOp>(loc, nIter, oneValue);
739 Value argNext = b.create<arith::ShLIOp>(loc, argIter, oneValue);
740 b.create<scf::YieldOp>(loc, ValueRange{argNext, nNext});
742 b.create<scf::YieldOp>(loc, ifOp.getResults());
744 elseBuilder.create<scf::YieldOp>(loop.getResult(1));
746 builder.create<func::ReturnOp>(ifOp.getResult(0));
859 // Create outlined implementations for power operations.