|
46 | 46 | #include "mlir/Transforms/DialectConversion.h"
|
47 | 47 | #include "clang/CIR/Dialect/IR/CIRDialect.h"
|
48 | 48 | #include "clang/CIR/Dialect/IR/CIRTypes.h"
|
49 |
| -#include "clang/CIR/LoweringHelpers.h" |
50 | 49 | #include "clang/CIR/LowerToMLIR.h"
|
| 50 | +#include "clang/CIR/LoweringHelpers.h" |
51 | 51 | #include "clang/CIR/Passes.h"
|
52 | 52 | #include "llvm/ADT/STLExtras.h"
|
53 | 53 | #include "llvm/ADT/Sequence.h"
|
@@ -244,6 +244,17 @@ class CIRFAbsOpLowering : public mlir::OpConversionPattern<mlir::cir::FAbsOp> {
|
244 | 244 | return mlir::LogicalResult::success();
|
245 | 245 | }
|
246 | 246 | };
|
| 247 | +class CIRAbsOpLowering : public mlir::OpConversionPattern<mlir::cir::AbsOp> { |
| 248 | +public: |
| 249 | + using mlir::OpConversionPattern<mlir::cir::AbsOp>::OpConversionPattern; |
| 250 | + |
| 251 | + mlir::LogicalResult |
| 252 | + matchAndRewrite(mlir::cir::AbsOp op, OpAdaptor adaptor, |
| 253 | + mlir::ConversionPatternRewriter &rewriter) const override { |
| 254 | + rewriter.replaceOpWithNewOp<mlir::math::AbsIOp>(op, adaptor.getSrc()); |
| 255 | + return mlir::LogicalResult::success(); |
| 256 | + } |
| 257 | +}; |
247 | 258 |
|
248 | 259 | class CIRFloorOpLowering
|
249 | 260 | : public mlir::OpConversionPattern<mlir::cir::FloorOp> {
|
@@ -1324,12 +1335,12 @@ void populateCIRToMLIRConversionPatterns(mlir::RewritePatternSet &patterns,
|
1324 | 1335 | CIRCosOpLowering, CIRGlobalOpLowering, CIRGetGlobalOpLowering,
|
1325 | 1336 | CIRCastOpLowering, CIRPtrStrideOpLowering, CIRSqrtOpLowering,
|
1326 | 1337 | CIRCeilOpLowering, CIRExp2OpLowering, CIRExpOpLowering, CIRFAbsOpLowering,
|
1327 |
| - CIRFloorOpLowering, CIRLog10OpLowering, CIRLog2OpLowering, |
1328 |
| - CIRLogOpLowering, CIRRoundOpLowering, CIRPtrStrideOpLowering, |
1329 |
| - CIRSinOpLowering, CIRShiftOpLowering, CIRBitClzOpLowering, |
1330 |
| - CIRBitCtzOpLowering, CIRBitPopcountOpLowering, CIRBitClrsbOpLowering, |
1331 |
| - CIRBitFfsOpLowering, CIRBitParityOpLowering, CIRIfOpLowering, |
1332 |
| - CIRVectorCreateLowering, CIRVectorInsertLowering, |
| 1338 | + CIRAbsOpLowering, CIRFloorOpLowering, CIRLog10OpLowering, |
| 1339 | + CIRLog2OpLowering, CIRLogOpLowering, CIRRoundOpLowering, |
| 1340 | + CIRPtrStrideOpLowering, CIRSinOpLowering, CIRShiftOpLowering, |
| 1341 | + CIRBitClzOpLowering, CIRBitCtzOpLowering, CIRBitPopcountOpLowering, |
| 1342 | + CIRBitClrsbOpLowering, CIRBitFfsOpLowering, CIRBitParityOpLowering, |
| 1343 | + CIRIfOpLowering, CIRVectorCreateLowering, CIRVectorInsertLowering, |
1333 | 1344 | CIRVectorExtractLowering, CIRVectorCmpOpLowering>(converter,
|
1334 | 1345 | patterns.getContext());
|
1335 | 1346 | }
|
|
0 commit comments