This commit is contained in:
Doug Simon 2016-08-23 22:31:48 +00:00
commit 0eb2d4511b
5 changed files with 41 additions and 36 deletions

View file

@ -3159,45 +3159,65 @@ void Compile::final_graph_reshaping_impl( Node *n, Final_Reshape_Counts &frc) {
break; break;
#endif #endif
case Op_ModI: case Op_ModI: {
Node* di = NULL;
if (UseDivMod) { if (UseDivMod) {
// Check if a%b and a/b both exist // Check if a%b and a/b both exist
Node* d = n->find_similar(Op_DivI); di = n->find_similar(Op_DivI);
if (d) { if (di) {
// Replace them with a fused divmod if supported // Replace them with a fused divmod if supported
if (Matcher::has_match_rule(Op_DivModI)) { if (Matcher::has_match_rule(Op_DivModI)) {
DivModINode* divmod = DivModINode::make(n); DivModINode* divmod = DivModINode::make(n);
d->subsume_by(divmod->div_proj(), this); di->subsume_by(divmod->div_proj(), this);
n->subsume_by(divmod->mod_proj(), this); n->subsume_by(divmod->mod_proj(), this);
} else { } else {
// replace a%b with a-((a/b)*b) // replace a%b with a-((a/b)*b)
Node* mult = new MulINode(d, d->in(2)); Node* mult = new MulINode(di, di->in(2));
Node* sub = new SubINode(d->in(1), mult); Node* sub = new SubINode(di->in(1), mult);
n->subsume_by(sub, this); n->subsume_by(sub, this);
} }
} }
} }
if (di == NULL) {
// Remove useless control edge in case of not mod-zero.
const Type *t = n->in(2)->bottom_type();
const TypeInt *ti = t->is_int();
if (n->in(0) && (ti->_hi < 0 || ti->_lo > 0)) {
n->set_req(0, NULL);
}
}
break; break;
}
case Op_ModL: case Op_ModL: {
Node* dl = NULL;
if (UseDivMod) { if (UseDivMod) {
// Check if a%b and a/b both exist // Check if a%b and a/b both exist
Node* d = n->find_similar(Op_DivL); dl = n->find_similar(Op_DivL);
if (d) { if (dl) {
// Replace them with a fused divmod if supported // Replace them with a fused divmod if supported
if (Matcher::has_match_rule(Op_DivModL)) { if (Matcher::has_match_rule(Op_DivModL)) {
DivModLNode* divmod = DivModLNode::make(n); DivModLNode* divmod = DivModLNode::make(n);
d->subsume_by(divmod->div_proj(), this); dl->subsume_by(divmod->div_proj(), this);
n->subsume_by(divmod->mod_proj(), this); n->subsume_by(divmod->mod_proj(), this);
} else { } else {
// replace a%b with a-((a/b)*b) // replace a%b with a-((a/b)*b)
Node* mult = new MulLNode(d, d->in(2)); Node* mult = new MulLNode(dl, dl->in(2));
Node* sub = new SubLNode(d->in(1), mult); Node* sub = new SubLNode(dl->in(1), mult);
n->subsume_by(sub, this); n->subsume_by(sub, this);
} }
} }
} }
if (dl == NULL) {
// Remove useless control edge in case of not mod-zero.
const Type *t = n->in(2)->bottom_type();
const TypeLong *tl = t->is_long();
if (n->in(0) && (tl->_hi < 0 || tl->_lo > 0)) {
n->set_req(0, NULL);
}
}
break; break;
}
case Op_LoadVector: case Op_LoadVector:
case Op_StoreVector: case Op_StoreVector:

View file

@ -853,13 +853,6 @@ Node *ModINode::Ideal(PhaseGVN *phase, bool can_reshape) {
if( t == Type::TOP ) return NULL; if( t == Type::TOP ) return NULL;
const TypeInt *ti = t->is_int(); const TypeInt *ti = t->is_int();
// Check for useless control input
// Check for excluding mod-zero case
if( in(0) && (ti->_hi < 0 || ti->_lo > 0) ) {
set_req(0, NULL); // Yank control input
return this;
}
// See if we are MOD'ing by 2^k or 2^k-1. // See if we are MOD'ing by 2^k or 2^k-1.
if( !ti->is_con() ) return NULL; if( !ti->is_con() ) return NULL;
jint con = ti->get_con(); jint con = ti->get_con();
@ -1024,13 +1017,6 @@ Node *ModLNode::Ideal(PhaseGVN *phase, bool can_reshape) {
if( t == Type::TOP ) return NULL; if( t == Type::TOP ) return NULL;
const TypeLong *tl = t->is_long(); const TypeLong *tl = t->is_long();
// Check for useless control input
// Check for excluding mod-zero case
if( in(0) && (tl->_hi < 0 || tl->_lo > 0) ) {
set_req(0, NULL); // Yank control input
return this;
}
// See if we are MOD'ing by 2^k or 2^k-1. // See if we are MOD'ing by 2^k or 2^k-1.
if( !tl->is_con() ) return NULL; if( !tl->is_con() ) return NULL;
jlong con = tl->get_con(); jlong con = tl->get_con();

View file

@ -40,7 +40,7 @@
package compiler.profiling.spectrapredefineclass; package compiler.profiling.spectrapredefineclass;
import jdk.test.lib.JDKToolLauncher; import jdk.test.lib.JDKToolLauncher;
import jdk.test.lib.OutputAnalyzer; import jdk.test.lib.process.OutputAnalyzer;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;

View file

@ -43,7 +43,7 @@
package compiler.profiling.spectrapredefineclass_classloaders; package compiler.profiling.spectrapredefineclass_classloaders;
import jdk.test.lib.JDKToolLauncher; import jdk.test.lib.JDKToolLauncher;
import jdk.test.lib.OutputAnalyzer; import jdk.test.lib.process.OutputAnalyzer;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;

View file

@ -70,17 +70,17 @@ DIST_DIR = dist
DIST_JAR = $(DIST_DIR)/JITtester.jar DIST_JAR = $(DIST_DIR)/JITtester.jar
SRC_FILES = $(shell find $(SRC_DIR) -name '*.java') SRC_FILES = $(shell find $(SRC_DIR) -name '*.java')
TESTLIBRARY_SRC_DIR = ../jdk/test/lib TESTLIBRARY_SRC_DIR = ../../../../test/lib/jdk/test/lib
TESTLIBRARY_SRC_FILES = $(TESTLIBRARY_SRC_DIR)/Asserts.java \ TESTLIBRARY_SRC_FILES = $(TESTLIBRARY_SRC_DIR)/Asserts.java \
$(TESTLIBRARY_SRC_DIR)/JDKToolFinder.java \ $(TESTLIBRARY_SRC_DIR)/JDKToolFinder.java \
$(TESTLIBRARY_SRC_DIR)/JDKToolLauncher.java \ $(TESTLIBRARY_SRC_DIR)/JDKToolLauncher.java \
$(TESTLIBRARY_SRC_DIR)/OutputAnalyzer.java \
$(TESTLIBRARY_SRC_DIR)/OutputBuffer.java \
$(TESTLIBRARY_SRC_DIR)/Pair.java \
$(TESTLIBRARY_SRC_DIR)/Platform.java \ $(TESTLIBRARY_SRC_DIR)/Platform.java \
$(TESTLIBRARY_SRC_DIR)/ProcessTools.java \ $(TESTLIBRARY_SRC_DIR)/Utils.java \
$(TESTLIBRARY_SRC_DIR)/StreamPumper.java \ $(TESTLIBRARY_SRC_DIR)/process/OutputAnalyzer.java \
$(TESTLIBRARY_SRC_DIR)/Utils.java $(TESTLIBRARY_SRC_DIR)/process/OutputBuffer.java \
$(TESTLIBRARY_SRC_DIR)/process/ProcessTools.java \
$(TESTLIBRARY_SRC_DIR)/process/StreamPumper.java \
$(TESTLIBRARY_SRC_DIR)/util/Pair.java
.PHONY: cleantmp .PHONY: cleantmp
@ -120,7 +120,6 @@ cleantmp:
copytestlibrary: $(DRIVER_DIR) copytestlibrary: $(DRIVER_DIR)
@cp -r src/jdk/test/lib/jittester/jtreg/*.java $(DRIVER_DIR) @cp -r src/jdk/test/lib/jittester/jtreg/*.java $(DRIVER_DIR)
@cp -r ../jdk $(TESTBASE_DIR)/
testgroup: $(TESTBASE_DIR) testgroup: $(TESTBASE_DIR)
@echo 'jittester_all = \\' > $(TESTGROUP_FILE) @echo 'jittester_all = \\' > $(TESTGROUP_FILE)