Search in sources :

Example 26 with TargetDescription

use of jdk.vm.ci.code.TargetDescription in project graal by oracle.

the class AMD64ArithmeticLIRGenerator method emitSub.

@Override
public Variable emitSub(LIRKind resultKind, Value a, Value b, boolean setFlags) {
    TargetDescription target = getLIRGen().target();
    boolean isAvx = ((AMD64) target.arch).getFeatures().contains(CPUFeature.AVX);
    switch((AMD64Kind) a.getPlatformKind()) {
        case DWORD:
            return emitBinary(resultKind, SUB, DWORD, false, a, b, setFlags);
        case QWORD:
            return emitBinary(resultKind, SUB, QWORD, false, a, b, setFlags);
        case SINGLE:
            if (isAvx) {
                return emitBinary(resultKind, AVXOp.SUB, SS, false, a, b);
            } else {
                return emitBinary(resultKind, SSEOp.SUB, SS, false, a, b);
            }
        case DOUBLE:
            if (isAvx) {
                return emitBinary(resultKind, AVXOp.SUB, SD, false, a, b);
            } else {
                return emitBinary(resultKind, SSEOp.SUB, SD, false, a, b);
            }
        default:
            throw GraalError.shouldNotReachHere();
    }
}
Also used : AMD64Kind(jdk.vm.ci.amd64.AMD64Kind) TargetDescription(jdk.vm.ci.code.TargetDescription)

Example 27 with TargetDescription

use of jdk.vm.ci.code.TargetDescription in project graal by oracle.

the class AMD64ArithmeticLIRGenerator method emitOr.

@Override
public Variable emitOr(Value a, Value b) {
    LIRKind resultKind = LIRKind.combine(a, b);
    TargetDescription target = getLIRGen().target();
    boolean isAvx = ((AMD64) target.arch).getFeatures().contains(CPUFeature.AVX);
    switch((AMD64Kind) a.getPlatformKind()) {
        case DWORD:
            return emitBinary(resultKind, OR, DWORD, true, a, b, false);
        case QWORD:
            return emitBinary(resultKind, OR, QWORD, true, a, b, false);
        case SINGLE:
            if (isAvx) {
                return emitBinary(resultKind, AVXOp.OR, PS, true, a, b);
            } else {
                return emitBinary(resultKind, SSEOp.OR, PS, true, a, b);
            }
        case DOUBLE:
            if (isAvx) {
                return emitBinary(resultKind, AVXOp.OR, PD, true, a, b);
            } else {
                return emitBinary(resultKind, SSEOp.OR, PD, true, a, b);
            }
        default:
            throw GraalError.shouldNotReachHere();
    }
}
Also used : AMD64Kind(jdk.vm.ci.amd64.AMD64Kind) TargetDescription(jdk.vm.ci.code.TargetDescription) LIRKind(org.graalvm.compiler.core.common.LIRKind)

Example 28 with TargetDescription

use of jdk.vm.ci.code.TargetDescription in project graal by oracle.

the class AMD64ArithmeticLIRGenerator method emitAnd.

@Override
public Variable emitAnd(Value a, Value b) {
    LIRKind resultKind = LIRKind.combine(a, b);
    TargetDescription target = getLIRGen().target();
    boolean isAvx = ((AMD64) target.arch).getFeatures().contains(CPUFeature.AVX);
    switch((AMD64Kind) a.getPlatformKind()) {
        case DWORD:
            return emitBinary(resultKind, AND, DWORD, true, a, b, false);
        case QWORD:
            return emitBinary(resultKind, AND, QWORD, true, a, b, false);
        case SINGLE:
            if (isAvx) {
                return emitBinary(resultKind, AVXOp.AND, PS, true, a, b);
            } else {
                return emitBinary(resultKind, SSEOp.AND, PS, true, a, b);
            }
        case DOUBLE:
            if (isAvx) {
                return emitBinary(resultKind, AVXOp.AND, PD, true, a, b);
            } else {
                return emitBinary(resultKind, SSEOp.AND, PD, true, a, b);
            }
        default:
            throw GraalError.shouldNotReachHere();
    }
}
Also used : AMD64Kind(jdk.vm.ci.amd64.AMD64Kind) TargetDescription(jdk.vm.ci.code.TargetDescription) LIRKind(org.graalvm.compiler.core.common.LIRKind)

Example 29 with TargetDescription

use of jdk.vm.ci.code.TargetDescription in project graal by oracle.

the class AMD64NodeMatchRules method mulMemory.

@MatchRule("(Mul value Read=access)")
@MatchRule("(Mul value FloatingRead=access)")
public ComplexMatchResult mulMemory(ValueNode value, LIRLowerableAccess access) {
    OperandSize size = getMemorySize(access);
    if (size.isXmmType()) {
        TargetDescription target = getLIRGeneratorTool().target();
        boolean isAvx = ((AMD64) target.arch).getFeatures().contains(CPUFeature.AVX);
        if (isAvx) {
            return binaryRead(AVXOp.MUL, size, value, access);
        } else {
            return binaryRead(SSEOp.MUL, size, value, access);
        }
    } else {
        return binaryRead(AMD64RMOp.IMUL, size, value, access);
    }
}
Also used : TargetDescription(jdk.vm.ci.code.TargetDescription) OperandSize(org.graalvm.compiler.asm.amd64.AMD64Assembler.OperandSize) MatchRule(org.graalvm.compiler.core.match.MatchRule)

Example 30 with TargetDescription

use of jdk.vm.ci.code.TargetDescription in project graal by oracle.

the class AMD64ArithmeticLIRGenerator method emitDiv.

@Override
public Value emitDiv(Value a, Value b, LIRFrameState state) {
    TargetDescription target = getLIRGen().target();
    boolean isAvx = ((AMD64) target.arch).getFeatures().contains(CPUFeature.AVX);
    LIRKind resultKind = LIRKind.combine(a, b);
    switch((AMD64Kind) a.getPlatformKind()) {
        case DWORD:
            AMD64MulDivOp op = emitIDIV(DWORD, a, b, state);
            return getLIRGen().emitMove(op.getQuotient());
        case QWORD:
            AMD64MulDivOp lop = emitIDIV(QWORD, a, b, state);
            return getLIRGen().emitMove(lop.getQuotient());
        case SINGLE:
            if (isAvx) {
                return emitBinary(resultKind, AVXOp.DIV, SS, false, a, b);
            } else {
                return emitBinary(resultKind, SSEOp.DIV, SS, false, a, b);
            }
        case DOUBLE:
            if (isAvx) {
                return emitBinary(resultKind, AVXOp.DIV, SD, false, a, b);
            } else {
                return emitBinary(resultKind, SSEOp.DIV, SD, false, a, b);
            }
        default:
            throw GraalError.shouldNotReachHere();
    }
}
Also used : AMD64MulDivOp(org.graalvm.compiler.lir.amd64.AMD64MulDivOp) AMD64Kind(jdk.vm.ci.amd64.AMD64Kind) TargetDescription(jdk.vm.ci.code.TargetDescription) LIRKind(org.graalvm.compiler.core.common.LIRKind)

Aggregations

TargetDescription (jdk.vm.ci.code.TargetDescription)41 CallingConvention (jdk.vm.ci.code.CallingConvention)14 Register (jdk.vm.ci.code.Register)14 RegisterConfig (jdk.vm.ci.code.RegisterConfig)12 AssemblerTest (org.graalvm.compiler.asm.test.AssemblerTest)11 CompilationResult (org.graalvm.compiler.code.CompilationResult)11 Test (org.junit.Test)11 ValueUtil.asRegister (jdk.vm.ci.code.ValueUtil.asRegister)10 AMD64Assembler (org.graalvm.compiler.asm.amd64.AMD64Assembler)10 AMD64Kind (jdk.vm.ci.amd64.AMD64Kind)8 GraalHotSpotVMConfig (org.graalvm.compiler.hotspot.GraalHotSpotVMConfig)7 LIRKind (org.graalvm.compiler.core.common.LIRKind)6 AMD64Address (org.graalvm.compiler.asm.amd64.AMD64Address)5 Field (java.lang.reflect.Field)4 BytecodeProvider (org.graalvm.compiler.bytecode.BytecodeProvider)4 Value (jdk.vm.ci.meta.Value)3 AMD64MacroAssembler (org.graalvm.compiler.asm.amd64.AMD64MacroAssembler)3 HotSpotRegistersProvider (org.graalvm.compiler.hotspot.meta.HotSpotRegistersProvider)3 RegisterValue (jdk.vm.ci.code.RegisterValue)2 DataSectionReference (jdk.vm.ci.code.site.DataSectionReference)2