[PATCH] D134277: [RISCV] Combine comparison and logic ops.

Ilya Andreev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 27 03:40:59 PDT 2022


iabg-sc added inline comments.


================
Comment at: llvm/test/CodeGen/RISCV/zbb-cmp-combine.ll:241
+; CHECK-RV64IF-NEXT:    ret
+  %l0 = fcmp ult float %a, %c
+  %l1 = fcmp ult float %b, %c
----------------
craig.topper wrote:
> I don't think this is correct for FP. "fcmp ult" returns true if either operand is a nan. fmin will return a non-nan input unless both are nan.  So for this code, if %a is nan, %b and %c are non-nan the original code returned true. But the rewritten code will only compare %b and %c and ignore %a.
Yes, indeed. Since the behavior with NaNs cannot be preserved these cases should be prohibited.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D134277/new/

https://reviews.llvm.org/D134277



More information about the llvm-commits mailing list