Lines Matching refs:rewriter

64                   ConversionPatternRewriter &rewriter) const override {  in matchAndRewrite()
80 Type intType = rewriter.getIntegerType(bitwidth); in matchAndRewrite()
83 Value signMask = rewriter.create<spirv::ConstantOp>( in matchAndRewrite()
84 loc, intType, rewriter.getIntegerAttr(intType, intValue)); in matchAndRewrite()
85 Value valueMask = rewriter.create<spirv::ConstantOp>( in matchAndRewrite()
86 loc, intType, rewriter.getIntegerAttr(intType, intValue - 1u)); in matchAndRewrite()
95 rewriter.create<spirv::CompositeConstructOp>(loc, intType, signSplat); in matchAndRewrite()
98 valueMask = rewriter.create<spirv::CompositeConstructOp>(loc, intType, in matchAndRewrite()
103 rewriter.create<spirv::BitcastOp>(loc, intType, adaptor.getLhs()); in matchAndRewrite()
105 rewriter.create<spirv::BitcastOp>(loc, intType, adaptor.getRhs()); in matchAndRewrite()
107 Value value = rewriter.create<spirv::BitwiseAndOp>( in matchAndRewrite()
109 Value sign = rewriter.create<spirv::BitwiseAndOp>( in matchAndRewrite()
112 Value result = rewriter.create<spirv::BitwiseOrOp>(loc, intType, in matchAndRewrite()
114 rewriter.replaceOpWithNewOp<spirv::BitcastOp>(copySignOp, type, result); in matchAndRewrite()
130 ConversionPatternRewriter &rewriter) const override { in matchAndRewrite()
146 Value val1 = getScalarOrVectorI32Constant(type, 1, rewriter, loc); in matchAndRewrite()
147 Value val31 = getScalarOrVectorI32Constant(type, 31, rewriter, loc); in matchAndRewrite()
148 Value val32 = getScalarOrVectorI32Constant(type, 32, rewriter, loc); in matchAndRewrite()
150 Value msb = rewriter.create<spirv::GLFindUMsbOp>(loc, input); in matchAndRewrite()
155 Value subMsb = rewriter.create<spirv::ISubOp>(loc, val31, msb); in matchAndRewrite()
160 Value subInput = rewriter.create<spirv::ISubOp>(loc, val32, input); in matchAndRewrite()
161 Value cmp = rewriter.create<spirv::ULessThanEqualOp>(loc, input, val1); in matchAndRewrite()
162 rewriter.replaceOpWithNewOp<spirv::SelectOp>(countOp, cmp, subInput, in matchAndRewrite()
178 ConversionPatternRewriter &rewriter) const override { in matchAndRewrite()
182 auto exp = rewriter.create<ExpOp>(loc, type, adaptor.getOperand()); in matchAndRewrite()
183 auto one = spirv::ConstantOp::getOne(type, loc, rewriter); in matchAndRewrite()
184 rewriter.replaceOpWithNewOp<spirv::FSubOp>(operation, exp, one); in matchAndRewrite()
199 ConversionPatternRewriter &rewriter) const override { in matchAndRewrite()
203 auto one = spirv::ConstantOp::getOne(type, operation.getLoc(), rewriter); in matchAndRewrite()
205 rewriter.create<spirv::FAddOp>(loc, one, adaptor.getOperand()); in matchAndRewrite()
206 rewriter.replaceOpWithNewOp<LogOp>(operation, type, onePlus); in matchAndRewrite()
217 ConversionPatternRewriter &rewriter) const override { in matchAndRewrite()
226 spirv::ConstantOp::getZero(adaptor.getLhs().getType(), loc, rewriter); in matchAndRewrite()
228 rewriter.create<spirv::FOrdLessThanOp>(loc, adaptor.getLhs(), zero); in matchAndRewrite()
229 Value abs = rewriter.create<spirv::GLFAbsOp>(loc, adaptor.getLhs()); in matchAndRewrite()
230 Value pow = rewriter.create<spirv::GLPowOp>(loc, abs, adaptor.getRhs()); in matchAndRewrite()
231 Value negate = rewriter.create<spirv::FNegateOp>(loc, pow); in matchAndRewrite()
232 rewriter.replaceOpWithNewOp<spirv::SelectOp>(powfOp, lessThan, negate, pow); in matchAndRewrite()
243 ConversionPatternRewriter &rewriter) const override { in matchAndRewrite()
249 auto zero = spirv::ConstantOp::getZero(ty, loc, rewriter); in matchAndRewrite()
250 auto one = spirv::ConstantOp::getOne(ty, loc, rewriter); in matchAndRewrite()
253 half = rewriter.create<spirv::ConstantOp>( in matchAndRewrite()
256 rewriter.getFloatAttr(ety, 0.5).getValue())); in matchAndRewrite()
258 half = rewriter.create<spirv::ConstantOp>( in matchAndRewrite()
259 loc, ty, rewriter.getFloatAttr(ety, 0.5)); in matchAndRewrite()
262 auto abs = rewriter.create<spirv::GLFAbsOp>(loc, operand); in matchAndRewrite()
263 auto floor = rewriter.create<spirv::GLFloorOp>(loc, abs); in matchAndRewrite()
264 auto sub = rewriter.create<spirv::FSubOp>(loc, abs, floor); in matchAndRewrite()
266 rewriter.create<spirv::FOrdGreaterThanEqualOp>(loc, sub, half); in matchAndRewrite()
267 auto select = rewriter.create<spirv::SelectOp>(loc, greater, one, zero); in matchAndRewrite()
268 auto add = rewriter.create<spirv::FAddOp>(loc, floor, select); in matchAndRewrite()
269 rewriter.replaceOpWithNewOp<math::CopySignOp>(roundOp, add, operand); in matchAndRewrite()