[llvm-branch-commits] [llvm] InstCombine: Handle fmul in SimplifyDemandedFPClass (PR #173872)
Matt Arsenault via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Jan 5 04:51:30 PST 2026
================
@@ -2086,6 +2091,131 @@ Value *InstCombinerImpl::SimplifyDemandedUseFPClass(Value *V,
Known.fneg();
break;
}
+ case Instruction::FMul: {
+ KnownFPClass KnownLHS, KnownRHS;
+
+ Value *X = I->getOperand(0);
+ Value *Y = I->getOperand(1);
+
+ FPClassTest SrcDemandedMask =
+ DemandedMask & (fcNan | fcZero | fcSubnormal | fcNormal);
+
+ if (DemandedMask & fcInf) {
+ // mul x, inf = inf
+ // mul large_x, large_y = inf
+ SrcDemandedMask |= fcSubnormal | fcNormal | fcInf;
+ }
+
+ if (DemandedMask & fcNan) {
+ // mul +/-inf, 0 => nan
+ SrcDemandedMask |= fcZero | fcInf;
+
+ // TODO: Mode check
+ // mul +/-inf, sub => nan if daz
+ SrcDemandedMask |= fcSubnormal;
+ }
+
+ const SimplifyQuery &SQ = getSimplifyQuery();
+ if (X == Y && isGuaranteedNotToBeUndef(X, SQ.AC, CxtI, SQ.DT, Depth + 1)) {
+
----------------
arsenm wrote:
```suggestion
```
https://github.com/llvm/llvm-project/pull/173872
More information about the llvm-branch-commits
mailing list