[PATCH] D140088: Add LLVM type support for fp8
Matt Arsenault via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 16 05:45:13 PST 2022
arsenm added inline comments.
================
Comment at: llvm/lib/IR/Constants.cpp:1543-1555
+ case Type::FP8E4M3TyID: {
+ if (&Val2.getSemantics() == &APFloat::Float8E4M3FN())
+ return true;
+ Val2.convert(APFloat::Float8E4M3FN(), APFloat::rmNearestTiesToEven,
+ &losesInfo);
+ return !losesInfo;
+ }
----------------
This isn't tested
================
Comment at: llvm/lib/IR/Constants.cpp:3165-3172
+ case Type::FP8E4M3TyID: {
+ auto EltVal = *reinterpret_cast<const uint8_t *>(EltPtr);
+ return APFloat(APFloat::Float8E4M3FN(), APInt(8, EltVal));
+ }
+ case Type::FP8E5M2TyID: {
+ auto EltVal = *reinterpret_cast<const uint8_t *>(EltPtr);
+ return APFloat(APFloat::Float8E5M2(), APInt(8, EltVal));
----------------
Not tested
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D140088/new/
https://reviews.llvm.org/D140088
More information about the llvm-commits
mailing list