[llvm] Spaceship intrinsic for GSoC 2024 (PR #83227)
Miguel Raz Guzmán Macedo via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 28 22:05:01 PST 2024
https://github.com/miguelraz updated https://github.com/llvm/llvm-project/pull/83227
>From bfd853a12730f8b48d7e898c5077e1a3e48d0e45 Mon Sep 17 00:00:00 2001
From: miguelraz <miguelraz at ciencias.unam.mx>
Date: Tue, 27 Feb 2024 23:41:02 -0600
Subject: [PATCH 1/3] add ISDOpcode of USTHREEWAYCMP
---
llvm/include/llvm/CodeGen/ISDOpcodes.h | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/llvm/include/llvm/CodeGen/ISDOpcodes.h b/llvm/include/llvm/CodeGen/ISDOpcodes.h
index 8cb0bc9fd98133..8e1dad95e41fc6 100644
--- a/llvm/include/llvm/CodeGen/ISDOpcodes.h
+++ b/llvm/include/llvm/CodeGen/ISDOpcodes.h
@@ -386,6 +386,13 @@ enum NodeType {
SDIVFIXSAT,
UDIVFIXSAT,
+ /// RESULT = [US]THREEWAYCMP(LHS, RHS) - Perform 3 way comparison and return
+ /// the values -1, 0, or 1 depending on whether the values compare lower,
+ /// equal
+ /// or greater.
+ UTHREEWAYCMP,
+ STHREEWAYCMP,
+
/// Simple binary floating point operators.
FADD,
FSUB,
>From ec1d57f4c38ed7bb328b9bdc95dc381c6fe5090a Mon Sep 17 00:00:00 2001
From: miguelraz <miguelraz at ciencias.unam.mx>
Date: Thu, 29 Feb 2024 00:02:34 -0600
Subject: [PATCH 2/3] add SDValue expandThreeWayCmp to TargetLowering.h
---
llvm/include/llvm/CodeGen/TargetLowering.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/llvm/include/llvm/CodeGen/TargetLowering.h b/llvm/include/llvm/CodeGen/TargetLowering.h
index f2e00aab8d5da2..cd7e12c94770e0 100644
--- a/llvm/include/llvm/CodeGen/TargetLowering.h
+++ b/llvm/include/llvm/CodeGen/TargetLowering.h
@@ -5275,6 +5275,10 @@ class TargetLowering : public TargetLoweringBase {
/// method accepts integers as its arguments.
SDValue expandAddSubSat(SDNode *Node, SelectionDAG &DAG) const;
+ /// Method for building the DAG expansion of ISD::[US]THREEWAYCMP. This
+ /// method accepts integers as its arguments.
+ SDValue expandThreeWayCmp(SDNode *Node, SelectionDAG &DAG) const;
+
/// Method for building the DAG expansion of ISD::[US]SHLSAT. This
/// method accepts integers as its arguments.
SDValue expandShlSat(SDNode *Node, SelectionDAG &DAG) const;
>From 88593faa7309c0717ba17f9f92936c35686c17f2 Mon Sep 17 00:00:00 2001
From: miguelraz <miguelraz at ciencias.unam.mx>
Date: Thu, 29 Feb 2024 00:04:17 -0600
Subject: [PATCH 3/3] add def int_[us]threewaycmp tablegen stubs
---
llvm/include/llvm/IR/Intrinsics.td | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/llvm/include/llvm/IR/Intrinsics.td b/llvm/include/llvm/IR/Intrinsics.td
index 0f13d25eb30ebf..9a799e74debec8 100644
--- a/llvm/include/llvm/IR/Intrinsics.td
+++ b/llvm/include/llvm/IR/Intrinsics.td
@@ -1527,6 +1527,12 @@ def int_umin : DefaultAttrsIntrinsic<
[llvm_anyint_ty], [LLVMMatchType<0>, LLVMMatchType<0>],
[IntrNoMem, IntrSpeculatable, IntrWillReturn]>;
+ //===------------------ Integer 3 Way Compare Intrinsics --------------------===//
+//
+def int_sthreewaycmp :
+
+def int_uthreewaycmp :
+
//===------------------------- Memory Use Markers -------------------------===//
//
def int_lifetime_start : DefaultAttrsIntrinsic<[],
More information about the llvm-commits
mailing list