Search in sources :

Example 1 with SPARC

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);
}
Also used : SPARC(jdk.vm.ci.sparc.SPARC) Architecture(jdk.vm.ci.code.Architecture) TargetDescription(jdk.vm.ci.code.TargetDescription)

Example 2 with SPARC

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));
}
Also used : AMD64(jdk.vm.ci.amd64.AMD64) SPARC(jdk.vm.ci.sparc.SPARC) Architecture(jdk.vm.ci.code.Architecture) ValueNode(org.graalvm.compiler.nodes.ValueNode) Test(org.junit.Test) GraalCompilerTest(org.graalvm.compiler.core.test.GraalCompilerTest)

Example 3 with SPARC

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());
        }
    }
}
Also used : ScratchRegister(org.graalvm.compiler.asm.sparc.SPARCMacroAssembler.ScratchRegister) SPARC(jdk.vm.ci.sparc.SPARC) CPUFeature(jdk.vm.ci.sparc.SPARC.CPUFeature) SPARCAssembler.isSingleFloatRegister(org.graalvm.compiler.asm.sparc.SPARCAssembler.isSingleFloatRegister) SPARCAssembler.isCPURegister(org.graalvm.compiler.asm.sparc.SPARCAssembler.isCPURegister) SPARCAssembler.isDoubleFloatRegister(org.graalvm.compiler.asm.sparc.SPARCAssembler.isDoubleFloatRegister) Register(jdk.vm.ci.code.Register) ValueUtil.isRegister(jdk.vm.ci.code.ValueUtil.isRegister) ValueUtil.asRegister(jdk.vm.ci.code.ValueUtil.asRegister) ScratchRegister(org.graalvm.compiler.asm.sparc.SPARCMacroAssembler.ScratchRegister)

Example 4 with SPARC

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());
    }
}
Also used : SPARC(jdk.vm.ci.sparc.SPARC) Scope(org.graalvm.compiler.debug.DebugContext.Scope) StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) GraalError(org.graalvm.compiler.debug.GraalError) DebugContext(org.graalvm.compiler.debug.DebugContext) ResolvedJavaMethod(jdk.vm.ci.meta.ResolvedJavaMethod) PermanentBailoutException(org.graalvm.compiler.core.common.PermanentBailoutException) Test(org.junit.Test)

Example 5 with SPARC

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));
}
Also used : AMD64(jdk.vm.ci.amd64.AMD64) SPARC(jdk.vm.ci.sparc.SPARC) Architecture(jdk.vm.ci.code.Architecture) ValueNode(org.graalvm.compiler.nodes.ValueNode) Test(org.junit.Test) GraalCompilerTest(org.graalvm.compiler.core.test.GraalCompilerTest)

Aggregations

SPARC (jdk.vm.ci.sparc.SPARC)7 Architecture (jdk.vm.ci.code.Architecture)5 Test (org.junit.Test)5 AMD64 (jdk.vm.ci.amd64.AMD64)4 GraalCompilerTest (org.graalvm.compiler.core.test.GraalCompilerTest)4 ValueNode (org.graalvm.compiler.nodes.ValueNode)4 Register (jdk.vm.ci.code.Register)1 TargetDescription (jdk.vm.ci.code.TargetDescription)1 ValueUtil.asRegister (jdk.vm.ci.code.ValueUtil.asRegister)1 ValueUtil.isRegister (jdk.vm.ci.code.ValueUtil.isRegister)1 ResolvedJavaMethod (jdk.vm.ci.meta.ResolvedJavaMethod)1 CPUFeature (jdk.vm.ci.sparc.SPARC.CPUFeature)1 SPARCAssembler.isCPURegister (org.graalvm.compiler.asm.sparc.SPARCAssembler.isCPURegister)1 SPARCAssembler.isDoubleFloatRegister (org.graalvm.compiler.asm.sparc.SPARCAssembler.isDoubleFloatRegister)1 SPARCAssembler.isSingleFloatRegister (org.graalvm.compiler.asm.sparc.SPARCAssembler.isSingleFloatRegister)1 ScratchRegister (org.graalvm.compiler.asm.sparc.SPARCMacroAssembler.ScratchRegister)1 PermanentBailoutException (org.graalvm.compiler.core.common.PermanentBailoutException)1 DebugContext (org.graalvm.compiler.debug.DebugContext)1 Scope (org.graalvm.compiler.debug.DebugContext.Scope)1 GraalError (org.graalvm.compiler.debug.GraalError)1