Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arm64: Use csel and ccmp for conditional moves #67894

Closed
wants to merge 6 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Allow select nodes to constant propagate
a74nh committed Jun 27, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit c65c4243e3a392010331a068ff00486a1c39565b
10 changes: 9 additions & 1 deletion src/coreclr/jit/assertionprop.cpp
Original file line number Diff line number Diff line change
@@ -5834,7 +5834,8 @@ GenTree* Compiler::optVNConstantPropOnJTrue(BasicBlock* block, GenTree* test)
Compiler::fgWalkResult Compiler::optVNConstantPropCurStmt(BasicBlock* block, Statement* stmt, GenTree* tree)
{
// Don't perform const prop on expressions marked with GTF_DONT_CSE
if (!tree->CanCSE())

if (!tree->CanCSE() && !(tree->gtFlags & GTF_DO_CONST_PROP))
{
return WALK_CONTINUE;
}
@@ -5870,6 +5871,13 @@ Compiler::fgWalkResult Compiler::optVNConstantPropCurStmt(BasicBlock* block, Sta
case GT_NEG:
case GT_CAST:
case GT_INTRINSIC:
case GT_SELECT:
case GT_CEQ:
case GT_CNE:
case GT_CLT:
case GT_CLE:
case GT_CGE:
case GT_CGT:
break;

case GT_JTRUE:
4 changes: 3 additions & 1 deletion src/coreclr/jit/gentree.h
Original file line number Diff line number Diff line change
@@ -426,6 +426,8 @@ enum GenTreeFlags : unsigned int
GTF_UNSIGNED = 0x00008000, // With GT_CAST: the source operand is an unsigned type
// With operators: the specified node is an unsigned operator
GTF_SPILL = 0x00020000, // Needs to be spilled here
GTF_DO_CONST_PROP = 0x00040000, // Always constant propegate, regardless of GTF_DONT_CSE
// Ideally replace with GTF_DONT_CONST_PROP

// The extra flag GTF_IS_IN_CSE is used to tell the consumer of the side effect flags
// that we are calling in the context of performing a CSE, thus we
@@ -436,7 +438,7 @@ enum GenTreeFlags : unsigned int

GTF_IS_IN_CSE = GTF_BOOLEAN,

GTF_COMMON_MASK = 0x0003FFFF, // mask of all the flags above
GTF_COMMON_MASK = 0x0005FFFF, // mask of all the flags above

GTF_REUSE_REG_VAL = 0x00800000, // This is set by the register allocator on nodes whose value already exists in the
// register assigned to this node, so the code generator does not have to generate
3 changes: 2 additions & 1 deletion src/coreclr/jit/optimizer.cpp
Original file line number Diff line number Diff line change
@@ -4639,7 +4639,8 @@ bool Compiler::optIfConvertSelect(GenTree* original_condition, GenTree* asg_node

// Duplicate the condition and invert it
GenTree* cond = gtCloneExpr(original_condition);
cond->gtFlags |= (GTF_RELOP_JMP_USED | GTF_DONT_CSE);
cond->gtFlags |= (GTF_DONT_CSE | GTF_DO_CONST_PROP);
cond->gtFlags ^= GTF_RELOP_JMP_USED;
cond->gtFlags ^= GTF_RELOP_NAN_UN;
switch (cond->gtOper)
{