use of jdk.vm.ci.sparc.SPARC in project graal by oracle.
the class SPARCAssemblerTest method createTarget.
private static TargetDescription createTarget() {
final int stackFrameAlignment = 16;
final int implicitNullCheckLimit = 4096;
final boolean inlineObjects = true;
Architecture arch = new SPARC(computeFeatures());
return new TargetDescription(arch, true, stackFrameAlignment, implicitNullCheckLimit, inlineObjects);
}
use of jdk.vm.ci.sparc.SPARC in project graal by oracle.
the class BitOpNodesTest method testBitCountLong.
@Test
public void testBitCountLong() {
Architecture arch = getBackend().getTarget().arch;
boolean isAmd64WithPopCount = arch instanceof AMD64 && ((AMD64) arch).getFeatures().contains(AMD64.CPUFeature.POPCNT);
boolean isSparc = arch instanceof SPARC;
Assume.assumeTrue("Only works on hardware with popcnt at the moment", isAmd64WithPopCount || isSparc);
ValueNode result = parseAndInline("bitCountLongSnippet");
Assert.assertEquals(StampFactory.forInteger(JavaKind.Int, 8, 40), result.stamp(NodeView.DEFAULT));
}
use of jdk.vm.ci.sparc.SPARC in project graal by oracle.
the class SPARCMove method const2reg.
public static void const2reg(CompilationResultBuilder crb, SPARCMacroAssembler masm, Value result, Register constantTableBase, JavaConstant input, SPARCDelayedControlTransfer delaySlotLir) {
try (ScratchRegister sc = masm.getScratchRegister()) {
Register scratch = sc.getRegister();
Set<CPUFeature> cpuFeatures = ((SPARC) masm.target.arch).getFeatures();
boolean hasVIS1 = cpuFeatures.contains(CPUFeature.VIS1);
boolean hasVIS3 = cpuFeatures.contains(CPUFeature.VIS3);
Register resultRegister = asRegister(result);
switch(input.getJavaKind().getStackKind()) {
case Int:
if (input.isDefaultForKind()) {
delaySlotLir.emitControlTransfer(crb, masm);
masm.clr(resultRegister);
} else if (isSimm13(input.asInt())) {
delaySlotLir.emitControlTransfer(crb, masm);
masm.or(g0, input.asInt(), resultRegister);
} else {
if (constantTableBase.equals(g0)) {
throw GraalError.shouldNotReachHere();
} else {
loadFromConstantTable(crb, masm, constantTableBase, input, resultRegister, delaySlotLir);
}
}
break;
case Long:
if (input.isDefaultForKind()) {
delaySlotLir.emitControlTransfer(crb, masm);
masm.clr(resultRegister);
} else if (isSimm13(input.asLong())) {
delaySlotLir.emitControlTransfer(crb, masm);
masm.or(g0, (int) input.asLong(), resultRegister);
} else {
loadFromConstantTable(crb, masm, constantTableBase, input, resultRegister, delaySlotLir);
}
break;
case Float:
{
float constant = input.asFloat();
int constantBits = java.lang.Float.floatToIntBits(constant);
if (hasVIS1 && constantBits == 0) {
delaySlotLir.emitControlTransfer(crb, masm);
masm.fzeros(resultRegister);
} else {
if (hasVIS3 && isSimm13(constantBits)) {
masm.or(g0, constantBits, scratch);
delaySlotLir.emitControlTransfer(crb, masm);
masm.movwtos(scratch, resultRegister);
} else {
// First load the address into the scratch register
loadFromConstantTable(crb, masm, constantTableBase, input, resultRegister, delaySlotLir);
}
}
break;
}
case Double:
{
double constant = input.asDouble();
long constantBits = java.lang.Double.doubleToRawLongBits(constant);
if (hasVIS1 && constantBits == 0) {
delaySlotLir.emitControlTransfer(crb, masm);
masm.fzerod(resultRegister);
} else {
if (hasVIS3 && isSimm13(constantBits)) {
masm.or(g0, (int) constantBits, scratch);
delaySlotLir.emitControlTransfer(crb, masm);
masm.movxtod(scratch, resultRegister);
} else {
loadFromConstantTable(crb, masm, constantTableBase, input, resultRegister, delaySlotLir);
}
}
break;
}
case Object:
if (input.isNull()) {
delaySlotLir.emitControlTransfer(crb, masm);
masm.clr(resultRegister);
} else {
loadFromConstantTable(crb, masm, constantTableBase, input, resultRegister, delaySlotLir);
}
break;
default:
throw GraalError.shouldNotReachHere("missing: " + input.getJavaKind());
}
}
}
use of jdk.vm.ci.sparc.SPARC in project graal by oracle.
the class SPARCBranchBailoutTest method testBailoutOnBranchOverflow.
@SuppressWarnings("try")
@Test
public void testBailoutOnBranchOverflow() throws Throwable {
Assume.assumeTrue(getBackend().getTarget().arch instanceof SPARC);
ResolvedJavaMethod m = getResolvedJavaMethod("testBranch");
DebugContext debug = getDebugContext();
try {
try (Scope s = debug.disable()) {
StructuredGraph graph = parseEager(m, AllowAssumptions.YES, debug);
compile(m, graph);
}
} catch (GraalError e) {
Assert.assertEquals(PermanentBailoutException.class, e.getCause().getClass());
}
}
use of jdk.vm.ci.sparc.SPARC in project graal by oracle.
the class BitOpNodesTest method testBitCountIntEmpty.
@Test
public void testBitCountIntEmpty() {
Architecture arch = getBackend().getTarget().arch;
boolean isAmd64WithPopCount = arch instanceof AMD64 && ((AMD64) arch).getFeatures().contains(AMD64.CPUFeature.POPCNT);
boolean isSparc = arch instanceof SPARC;
Assume.assumeTrue("Only works on hardware with popcnt at the moment", isAmd64WithPopCount || isSparc);
ValueNode result = parseAndInline("bitCountIntEmptySnippet");
Assert.assertEquals(StampFactory.forInteger(JavaKind.Int, 0, 24), result.stamp(NodeView.DEFAULT));
}
Aggregations