[llvm] [X86] Convert FP compares split by a nested logic op to FP logic (PR #226222)
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 28 06:26:09 PDT 2026
================
@@ -52669,6 +52688,73 @@ static SDValue convertIntLogicToFPLogic(unsigned Opc, const SDLoc &DL, EVT VT,
assert((Opc == ISD::OR || Opc == ISD::AND || Opc == ISD::XOR) &&
"Unexpected bit opcode");
+ using namespace SDPatternMatch;
+ auto IsLegalFPType = [&](EVT FPVT) {
+ return (Subtarget.hasSSE1() && FPVT == MVT::f32) ||
+ (Subtarget.hasSSE2() && FPVT == MVT::f64) ||
+ (Subtarget.hasFP16() && FPVT == MVT::f16);
+ };
+ // Without AVX512VL, the v8f16 compares are not legal.
+ auto IsLegalFPCmpType = [&](EVT FPVT) {
+ return IsLegalFPType(FPVT) && (FPVT != MVT::f16 || Subtarget.hasVLX());
+ };
+
+ // Look through a single-use inner logic op to pair up two FP compares that
+ // it separates, e.g. by an integer compare. The recursive call only sees
+ // SETCC or converted operands, so this is limited to one level:
+ // logic (logic (setcc X), Y), (setcc Z) -->
+ // logic (logic (setcc X), (setcc Z)), Y
+ auto FPCmp = [](SDValue &Cmp) {
----------------
RKSimon wrote:
```suggestion
auto FPCmp = [](SDValue Cmp) {
```
https://github.com/llvm/llvm-project/pull/226222
More information about the llvm-commits
mailing list