Skip to content

Commit f0fe7b1

Browse files
committed
first changes for ValueTrackingTest.cpp and SelectionDAG for s/ucmp
1 parent 416d5bb commit f0fe7b1

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

llvm/include/llvm/CodeGen/ISDOpcodes.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,11 @@ enum NodeType {
676676
UMIN,
677677
UMAX,
678678

679+
/// [US]CMP - Three way integer comparison - returns -1, 0, or 1 if
680+
/// Op1 < Op2, Op1 == Op2, Op1 > Op2, respectively.
681+
SCMP,
682+
UCMP,
683+
679684
/// Bitwise operators - logical and, logical or, logical xor.
680685
AND,
681686
OR,

llvm/include/llvm/CodeGen/TargetLowering.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5314,6 +5314,10 @@ class TargetLowering : public TargetLoweringBase {
53145314
/// method accepts integers as its arguments.
53155315
SDValue expandIntMINMAX(SDNode *Node, SelectionDAG &DAG) const;
53165316

5317+
/// Method for building the DAG expansion of ISD::[US]CMP. This
5318+
/// method accepts integers as its arguments.
5319+
SDValue expandCMP(SDNode *Node, SelectionDAG &DAG) const;
5320+
53175321
/// Method for building the DAG expansion of ISD::[US][ADD|SUB]SAT. This
53185322
/// method accepts integers as its arguments.
53195323
SDValue expandAddSubSat(SDNode *Node, SelectionDAG &DAG) const;

llvm/unittests/Analysis/ValueTrackingTest.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -891,6 +891,8 @@ TEST(ValueTracking, propagatesPoison) {
891891
{true, "call i32 @llvm.smin.i32(i32 %x, i32 %y)", 0},
892892
{true, "call i32 @llvm.umax.i32(i32 %x, i32 %y)", 0},
893893
{true, "call i32 @llvm.umin.i32(i32 %x, i32 %y)", 0},
894+
{true, "call i32 @llvm.scmp.i32(i32 %x, i32 %y)", 0},
895+
{true, "call i32 @llvm.ucmp.i32(i32 %x, i32 %y)", 0},
894896
{true, "call i32 @llvm.bitreverse.i32(i32 %x)", 0},
895897
{true, "call i32 @llvm.bswap.i32(i32 %x)", 0},
896898
{false, "call i32 @llvm.fshl.i32(i32 %x, i32 %y, i32 %shamt)", 0},

0 commit comments

Comments
 (0)