[PATCH] D140135: AMDGPU: Try to unfold fneg source when matching legacy fmin/fmax

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 23 03:47:07 PST 2023


foad added inline comments.


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp:1487
+
+  // Undo the combine foldFreeOpFromSelect does if it helps us match the min/max
+  if (LHS == NegTrue && CFalse && CRHS) {
----------------
foad wrote:
> It's very unclear what you're trying to match here. I think it's something like this, depending on whether NegTrue actually stripped a neg or not:
> 
>     // LHS op RHS ? LHS : -RHS -> -min/max(LHS, RHS)
>     // LHS op RHS ? -LHS : -RHS -> -min/max(LHS, RHS)
> 
> The first one doesn't make any sense to me. For the second one don't you need to flip the condition code?
I still don't understand this


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

https://reviews.llvm.org/D140135



More information about the llvm-commits mailing list