[Mlir-commits] [mlir] [mlir][arith][spirv] Convert arith.truncf rounding mode to SPIR-V (PR #101547)
Andrea Faulds
llvmlistbot at llvm.org
Thu Aug 1 15:26:04 PDT 2024
================
@@ -807,6 +807,25 @@ struct TruncIPattern final : public OpConversionPattern<arith::TruncIOp> {
// TypeCastingOp
//===----------------------------------------------------------------------===//
+static std::optional<spirv::FPRoundingMode>
+convertArithRoundingModeToSPIRV(arith::RoundingMode roundingMode) {
+ switch (roundingMode) {
+ case arith::RoundingMode::downward:
+ return spirv::FPRoundingMode::RTN;
+ case arith::RoundingMode::to_nearest_even:
+ return spirv::FPRoundingMode::RTE;
+ case arith::RoundingMode::toward_zero:
+ return spirv::FPRoundingMode::RTZ;
+ case arith::RoundingMode::upward:
+ return spirv::FPRoundingMode::RTP;
+ case arith::RoundingMode::to_nearest_away:
+ // SPIR-V FPRoundingMode decoration has no ties-away-from-zero mode
+ // (as of SPIR-V 1.6)
+ return {};
----------------
andfau-amd wrote:
Done in a4effd454f09906021e467c24f5bc8a85bbece73.
https://github.com/llvm/llvm-project/pull/101547
More information about the Mlir-commits
mailing list