Skip to content

Commit d1cf232

Browse files
author
Hamlin Li
committed
8352248: Check if CMoveX is supported
Reviewed-by: chagedorn, luhenry, rehn
1 parent 2b55979 commit d1cf232

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

src/hotspot/share/opto/loopopts.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -843,7 +843,7 @@ Node *PhaseIdealLoop::conditional_move( Node *region ) {
843843
break;
844844
}
845845
}
846-
if (phi == nullptr || _igvn.type(phi) == Type::TOP) {
846+
if (phi == nullptr || _igvn.type(phi) == Type::TOP || !CMoveNode::supported(_igvn.type(phi))) {
847847
break;
848848
}
849849
// Move speculative ops

src/hotspot/share/opto/movenode.cpp

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ const Type* CMoveNode::Value(PhaseGVN* phase) const {
186186
// Make a correctly-flavored CMove. Since _type is directly determined
187187
// from the inputs we do not need to specify it here.
188188
CMoveNode* CMoveNode::make(Node* bol, Node* left, Node* right, const Type* t) {
189-
switch( t->basic_type() ) {
189+
switch (t->basic_type()) {
190190
case T_INT: return new CMoveINode(bol, left, right, t->is_int());
191191
case T_FLOAT: return new CMoveFNode(bol, left, right, t);
192192
case T_DOUBLE: return new CMoveDNode(bol, left, right, t);
@@ -195,8 +195,23 @@ CMoveNode* CMoveNode::make(Node* bol, Node* left, Node* right, const Type* t) {
195195
case T_ADDRESS: return new CMovePNode(bol, left, right, t->is_ptr());
196196
case T_NARROWOOP: return new CMoveNNode(bol, left, right, t);
197197
default:
198-
ShouldNotReachHere();
199-
return nullptr;
198+
ShouldNotReachHere();
199+
return nullptr;
200+
}
201+
}
202+
203+
bool CMoveNode::supported(const Type* t) {
204+
switch (t->basic_type()) {
205+
case T_INT: return Matcher::match_rule_supported(Op_CMoveI);
206+
case T_FLOAT: return Matcher::match_rule_supported(Op_CMoveF);
207+
case T_DOUBLE: return Matcher::match_rule_supported(Op_CMoveD);
208+
case T_LONG: return Matcher::match_rule_supported(Op_CMoveL);
209+
case T_OBJECT: return Matcher::match_rule_supported(Op_CMoveP);
210+
case T_ADDRESS: return Matcher::match_rule_supported(Op_CMoveP);
211+
case T_NARROWOOP: return Matcher::match_rule_supported(Op_CMoveN);
212+
default:
213+
ShouldNotReachHere();
214+
return false;
200215
}
201216
}
202217

src/hotspot/share/opto/movenode.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ class CMoveNode : public TypeNode {
4848
virtual const Type* Value(PhaseGVN* phase) const;
4949
virtual Node* Identity(PhaseGVN* phase);
5050
static CMoveNode* make(Node* bol, Node* left, Node* right, const Type* t);
51+
static bool supported(const Type* t);
5152
// Helper function to spot cmove graph shapes
5253
static Node* is_cmove_id(PhaseTransform* phase, Node* cmp, Node* t, Node* f, BoolNode* b);
5354
static Node* Ideal_minmax(PhaseGVN* phase, CMoveNode* cmov);

0 commit comments

Comments
 (0)