@@ -36,20 +36,23 @@ namespace {
3636// / attribute.
3737template <typename SourceOp, typename TargetOp, bool Constrained,
3838 template <typename , typename > typename AttrConvert =
39- AttrConvertPassThrough>
39+ AttrConvertPassThrough,
40+ bool FailOnUnsupportedFP = false >
4041struct ConstrainedVectorConvertToLLVMPattern
41- : public VectorConvertToLLVMPattern<SourceOp, TargetOp, AttrConvert> {
42- using VectorConvertToLLVMPattern<SourceOp, TargetOp,
43- AttrConvert>::VectorConvertToLLVMPattern;
42+ : public VectorConvertToLLVMPattern<SourceOp, TargetOp, AttrConvert,
43+ FailOnUnsupportedFP> {
44+ using VectorConvertToLLVMPattern<
45+ SourceOp, TargetOp, AttrConvert,
46+ FailOnUnsupportedFP>::VectorConvertToLLVMPattern;
4447
4548 LogicalResult
4649 matchAndRewrite (SourceOp op, typename SourceOp::Adaptor adaptor,
4750 ConversionPatternRewriter &rewriter) const override {
4851 if (Constrained != static_cast <bool >(op.getRoundingModeAttr ()))
4952 return failure ();
50- return VectorConvertToLLVMPattern<SourceOp, TargetOp,
51- AttrConvert>:: matchAndRewrite (op, adaptor ,
52- rewriter);
53+ return VectorConvertToLLVMPattern<
54+ SourceOp, TargetOp, AttrConvert ,
55+ FailOnUnsupportedFP>:: matchAndRewrite (op, adaptor, rewriter);
5356 }
5457};
5558
@@ -78,7 +81,8 @@ struct IdentityBitcastLowering final
7881
7982using AddFOpLowering =
8083 VectorConvertToLLVMPattern<arith::AddFOp, LLVM::FAddOp,
81- arith::AttrConvertFastMathToLLVM>;
84+ arith::AttrConvertFastMathToLLVM,
85+ /* FailOnUnsupportedFP=*/ true >;
8286using AddIOpLowering =
8387 VectorConvertToLLVMPattern<arith::AddIOp, LLVM::AddOp,
8488 arith::AttrConvertOverflowToLLVM>;
@@ -87,53 +91,67 @@ using BitcastOpLowering =
8791 VectorConvertToLLVMPattern<arith::BitcastOp, LLVM::BitcastOp>;
8892using DivFOpLowering =
8993 VectorConvertToLLVMPattern<arith::DivFOp, LLVM::FDivOp,
90- arith::AttrConvertFastMathToLLVM>;
94+ arith::AttrConvertFastMathToLLVM,
95+ /* FailOnUnsupportedFP=*/ true >;
9196using DivSIOpLowering =
9297 VectorConvertToLLVMPattern<arith::DivSIOp, LLVM::SDivOp>;
9398using DivUIOpLowering =
9499 VectorConvertToLLVMPattern<arith::DivUIOp, LLVM::UDivOp>;
95- using ExtFOpLowering = VectorConvertToLLVMPattern<arith::ExtFOp, LLVM::FPExtOp>;
100+ using ExtFOpLowering = VectorConvertToLLVMPattern<arith::ExtFOp, LLVM::FPExtOp,
101+ AttrConvertPassThrough,
102+ /* FailOnUnsupportedFP=*/ true >;
96103using ExtSIOpLowering =
97104 VectorConvertToLLVMPattern<arith::ExtSIOp, LLVM::SExtOp>;
98105using ExtUIOpLowering =
99106 VectorConvertToLLVMPattern<arith::ExtUIOp, LLVM::ZExtOp>;
100107using FPToSIOpLowering =
101- VectorConvertToLLVMPattern<arith::FPToSIOp, LLVM::FPToSIOp>;
108+ VectorConvertToLLVMPattern<arith::FPToSIOp, LLVM::FPToSIOp,
109+ AttrConvertPassThrough,
110+ /* FailOnUnsupportedFP=*/ true >;
102111using FPToUIOpLowering =
103- VectorConvertToLLVMPattern<arith::FPToUIOp, LLVM::FPToUIOp>;
112+ VectorConvertToLLVMPattern<arith::FPToUIOp, LLVM::FPToUIOp,
113+ AttrConvertPassThrough,
114+ /* FailOnUnsupportedFP=*/ true >;
104115using MaximumFOpLowering =
105116 VectorConvertToLLVMPattern<arith::MaximumFOp, LLVM::MaximumOp,
106- arith::AttrConvertFastMathToLLVM>;
117+ arith::AttrConvertFastMathToLLVM,
118+ /* FailOnUnsupportedFP=*/ true >;
107119using MaxNumFOpLowering =
108120 VectorConvertToLLVMPattern<arith::MaxNumFOp, LLVM::MaxNumOp,
109- arith::AttrConvertFastMathToLLVM>;
121+ arith::AttrConvertFastMathToLLVM,
122+ /* FailOnUnsupportedFP=*/ true >;
110123using MaxSIOpLowering =
111124 VectorConvertToLLVMPattern<arith::MaxSIOp, LLVM::SMaxOp>;
112125using MaxUIOpLowering =
113126 VectorConvertToLLVMPattern<arith::MaxUIOp, LLVM::UMaxOp>;
114127using MinimumFOpLowering =
115128 VectorConvertToLLVMPattern<arith::MinimumFOp, LLVM::MinimumOp,
116- arith::AttrConvertFastMathToLLVM>;
129+ arith::AttrConvertFastMathToLLVM,
130+ /* FailOnUnsupportedFP=*/ true >;
117131using MinNumFOpLowering =
118132 VectorConvertToLLVMPattern<arith::MinNumFOp, LLVM::MinNumOp,
119- arith::AttrConvertFastMathToLLVM>;
133+ arith::AttrConvertFastMathToLLVM,
134+ /* FailOnUnsupportedFP=*/ true >;
120135using MinSIOpLowering =
121136 VectorConvertToLLVMPattern<arith::MinSIOp, LLVM::SMinOp>;
122137using MinUIOpLowering =
123138 VectorConvertToLLVMPattern<arith::MinUIOp, LLVM::UMinOp>;
124139using MulFOpLowering =
125140 VectorConvertToLLVMPattern<arith::MulFOp, LLVM::FMulOp,
126- arith::AttrConvertFastMathToLLVM>;
141+ arith::AttrConvertFastMathToLLVM,
142+ /* FailOnUnsupportedFP=*/ true >;
127143using MulIOpLowering =
128144 VectorConvertToLLVMPattern<arith::MulIOp, LLVM::MulOp,
129145 arith::AttrConvertOverflowToLLVM>;
130146using NegFOpLowering =
131147 VectorConvertToLLVMPattern<arith::NegFOp, LLVM::FNegOp,
132- arith::AttrConvertFastMathToLLVM>;
148+ arith::AttrConvertFastMathToLLVM,
149+ /* FailOnUnsupportedFP=*/ true >;
133150using OrIOpLowering = VectorConvertToLLVMPattern<arith::OrIOp, LLVM::OrOp>;
134151using RemFOpLowering =
135152 VectorConvertToLLVMPattern<arith::RemFOp, LLVM::FRemOp,
136- arith::AttrConvertFastMathToLLVM>;
153+ arith::AttrConvertFastMathToLLVM,
154+ /* FailOnUnsupportedFP=*/ true >;
137155using RemSIOpLowering =
138156 VectorConvertToLLVMPattern<arith::RemSIOp, LLVM::SRemOp>;
139157using RemUIOpLowering =
@@ -151,21 +169,25 @@ using SIToFPOpLowering =
151169 VectorConvertToLLVMPattern<arith::SIToFPOp, LLVM::SIToFPOp>;
152170using SubFOpLowering =
153171 VectorConvertToLLVMPattern<arith::SubFOp, LLVM::FSubOp,
154- arith::AttrConvertFastMathToLLVM>;
172+ arith::AttrConvertFastMathToLLVM,
173+ /* FailOnUnsupportedFP=*/ true >;
155174using SubIOpLowering =
156175 VectorConvertToLLVMPattern<arith::SubIOp, LLVM::SubOp,
157176 arith::AttrConvertOverflowToLLVM>;
158177using TruncFOpLowering =
159178 ConstrainedVectorConvertToLLVMPattern<arith::TruncFOp, LLVM::FPTruncOp,
160- false >;
179+ false , AttrConvertPassThrough,
180+ /* FailOnUnsupportedFP=*/ true >;
161181using ConstrainedTruncFOpLowering = ConstrainedVectorConvertToLLVMPattern<
162182 arith::TruncFOp, LLVM::ConstrainedFPTruncIntr, true ,
163- arith::AttrConverterConstrainedFPToLLVM>;
183+ arith::AttrConverterConstrainedFPToLLVM, /* FailOnUnsupportedFP= */ true >;
164184using TruncIOpLowering =
165185 VectorConvertToLLVMPattern<arith::TruncIOp, LLVM::TruncOp,
166186 arith::AttrConvertOverflowToLLVM>;
167187using UIToFPOpLowering =
168- VectorConvertToLLVMPattern<arith::UIToFPOp, LLVM::UIToFPOp>;
188+ VectorConvertToLLVMPattern<arith::UIToFPOp, LLVM::UIToFPOp,
189+ AttrConvertPassThrough,
190+ /* FailOnUnsupportedFP=*/ true >;
169191using XOrIOpLowering = VectorConvertToLLVMPattern<arith::XOrIOp, LLVM::XOrOp>;
170192
171193// ===----------------------------------------------------------------------===//
0 commit comments