[PATCH] D151358: [LegalizeTypes] Improve expansion of wide SMIN/SMAX/UMIN/UMAX

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 20 16:02:30 PDT 2023


efriedma added a reviewer: efocht.
efriedma added a comment.
Herald added subscribers: davidegrohmann, wangpc.

As far as I can tell, the issue for VE is just that an i128 icmp is lowered in an extremely inefficient way. There's no add-with-carry, and no custom lowering, so we end up using the generic expansion.  And the generic expansion is expensive because setcc is relatively expensive.  Looking at the instruction set, though, it should be possible to compute the flags for a 128-bit compare in three instructions: cmpu+cmpu+cmov; if that were implemented, the new expansion would actually be an improvement.

Given that, I think it makes sense to just move forward with this as-is.  The regression will be automatically fixed when someone adds appropriate custom lowering for 128-bit math on VE.  It would be nice to get feedback from someone more familiar with the VE instruction set, though.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151358



More information about the llvm-commits mailing list