[llvm] [GlobalIsel] Canonicalize G_FCMP (PR #108891)
Thorsten Schütt via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 16 21:42:41 PDT 2024
================
@@ -2008,3 +2008,43 @@ llvm::GIConstant::getConstant(Register Const, const MachineRegisterInfo &MRI) {
return GIConstant(MayBeConstant->Value, GIConstantKind::Scalar);
}
+
+APFloat llvm::GFConstant::getScalarValue() const {
+ assert(Kind == GFConstantKind::Scalar && "Expected scalar constant");
+
+ return Values[0];
+}
+
+std::optional<GFConstant>
+llvm::GFConstant::getConstant(Register Const, const MachineRegisterInfo &MRI) {
+ MachineInstr *Constant = getDefIgnoringCopies(Const, MRI);
+
+ if (GSplatVector *Splat = dyn_cast<GSplatVector>(Constant)) {
+ std::optional<FPValueAndVReg> MayBeConstant =
+ getFConstantVRegValWithLookThrough(Splat->getScalarReg(), MRI);
----------------
tschuett wrote:
There are new look-throughs with APFloat this time.
https://github.com/llvm/llvm-project/pull/108891
More information about the llvm-commits
mailing list