[llvm] [SelectionDAG] Add support for the 3-way comparison intrinsics [US]CMP (PR #91871)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 11 14:56:40 PDT 2024


================
@@ -677,6 +677,12 @@ enum NodeType {
   UMIN,
   UMAX,
 
+  /// [US]CMP - 3-way comparison of signed or unsigned integers. Returns -1, 0,
+  /// or 1 depending on whether Op0 <, ==, or > Op1. The operands can have type
+  /// different to the result.
----------------
Poseydon42 wrote:

I feel like allowing them to be different isn't that much of an issue, while potentially allowing us to emit more optimal code (maybe?). After all, if you're comparing two vectors of `i128`s you don't need the result to be a vector of i128 as well, and I'm not sure whether forcing the return type to be the same as operands in this scenario would be handled optimally by other optimizations in SDAG pipeline.

https://github.com/llvm/llvm-project/pull/91871


More information about the llvm-commits mailing list