[PATCH] D116702: [GlobalISel] Combine select + fcmp to fminnum/fmaxnum/fminimum/fmaximum

Jessica Paquette via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 10 16:49:16 PST 2022


paquette added inline comments.


================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:5376-5379
+    if (isLegalOrBeforeLegalizer({TargetOpcode::G_FMINNUM, {DstTy}}))
+      return TargetOpcode::G_FMINNUM;
+    else if (isLegalOrBeforeLegalizer({TargetOpcode::G_FMINIMUM, {DstTy}}))
+      return TargetOpcode::G_FMINIMUM;
----------------
aemerson wrote:
> What's the reason for choosing this particular ordering of legality checks such that we prefer G_FMINNUM?
 I was just matching the behaviour in SelectionDAGBuilder so I'm not entirely sure:

```
      case SPNB_RETURNS_ANY: {
        if (TLI.isOperationLegalOrCustom(ISD::FMINNUM, VT))
          Opc = ISD::FMINNUM;
        else if (TLI.isOperationLegalOrCustom(ISD::FMINIMUM, VT))
          Opc = ISD::FMINIMUM;
```

Maybe @arsenm knows better since I think he wrote the original code. (https://reviews.llvm.org/rGfabab4b7dd7d4ccefec2bb6cd405044429637ba6)


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

https://reviews.llvm.org/D116702



More information about the llvm-commits mailing list