Search in sources :

Example 1 with AMD64Kind

use of jdk.vm.ci.amd64.AMD64Kind in project graal by oracle.

the class AMD64HotSpotLoadConfigValueOp method emitCode.

@Override
public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) {
    if (GeneratePIC.getValue(crb.getOptions())) {
        AMD64Kind kind = (AMD64Kind) result.getPlatformKind();
        Register reg = asRegister(result);
        AMD64Address placeholder = masm.getPlaceholder(-1);
        switch(kind) {
            case BYTE:
                masm.movsbl(reg, placeholder);
                break;
            case WORD:
                masm.movswl(reg, placeholder);
                break;
            case DWORD:
                masm.movl(reg, placeholder);
                break;
            case QWORD:
                masm.movq(reg, placeholder);
                break;
            default:
                throw GraalError.unimplemented();
        }
    } else {
        throw GraalError.unimplemented();
    }
    crb.recordMark(markId);
}
Also used : AMD64Kind(jdk.vm.ci.amd64.AMD64Kind) ValueUtil.asRegister(jdk.vm.ci.code.ValueUtil.asRegister) Register(jdk.vm.ci.code.Register) AMD64Address(org.graalvm.compiler.asm.amd64.AMD64Address)

Example 2 with AMD64Kind

use of jdk.vm.ci.amd64.AMD64Kind in project graal by oracle.

the class AMD64ArithmeticLIRGenerator method emitStore.

@Override
public void emitStore(ValueKind<?> lirKind, Value address, Value input, LIRFrameState state) {
    AMD64AddressValue storeAddress = getAMD64LIRGen().asAddressValue(address);
    AMD64Kind kind = (AMD64Kind) lirKind.getPlatformKind();
    if (isConstantValue(input)) {
        emitStoreConst(kind, storeAddress, asConstantValue(input), state);
    } else {
        emitStore(kind, storeAddress, getLIRGen().asAllocatable(input), state);
    }
}
Also used : AMD64AddressValue(org.graalvm.compiler.lir.amd64.AMD64AddressValue) AMD64Kind(jdk.vm.ci.amd64.AMD64Kind)

Example 3 with AMD64Kind

use of jdk.vm.ci.amd64.AMD64Kind in project graal by oracle.

the class AMD64ArithmeticLIRGenerator method emitLoad.

@Override
public Variable emitLoad(LIRKind kind, Value address, LIRFrameState state) {
    AMD64AddressValue loadAddress = getAMD64LIRGen().asAddressValue(address);
    Variable result = getLIRGen().newVariable(getLIRGen().toRegisterKind(kind));
    switch((AMD64Kind) kind.getPlatformKind()) {
        case BYTE:
            getLIRGen().append(new AMD64Unary.MemoryOp(MOVSXB, DWORD, result, loadAddress, state));
            break;
        case WORD:
            getLIRGen().append(new AMD64Unary.MemoryOp(MOVSX, DWORD, result, loadAddress, state));
            break;
        case DWORD:
            getLIRGen().append(new AMD64Unary.MemoryOp(MOV, DWORD, result, loadAddress, state));
            break;
        case QWORD:
            getLIRGen().append(new AMD64Unary.MemoryOp(MOV, QWORD, result, loadAddress, state));
            break;
        case SINGLE:
            getLIRGen().append(new AMD64Unary.MemoryOp(MOVSS, SS, result, loadAddress, state));
            break;
        case DOUBLE:
            getLIRGen().append(new AMD64Unary.MemoryOp(MOVSD, SD, result, loadAddress, state));
            break;
        default:
            throw GraalError.shouldNotReachHere();
    }
    return result;
}
Also used : AMD64AddressValue(org.graalvm.compiler.lir.amd64.AMD64AddressValue) AMD64Unary(org.graalvm.compiler.lir.amd64.AMD64Unary) AMD64Kind(jdk.vm.ci.amd64.AMD64Kind) Variable(org.graalvm.compiler.lir.Variable)

Example 4 with AMD64Kind

use of jdk.vm.ci.amd64.AMD64Kind in project graal by oracle.

the class AMD64ArithmeticLIRGenerator method emitMul.

@Override
public Variable emitMul(Value a, Value b, boolean setFlags) {
    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 emitIMUL(DWORD, a, b);
        case QWORD:
            return emitIMUL(QWORD, a, b);
        case SINGLE:
            if (isAvx) {
                return emitBinary(resultKind, AVXOp.MUL, SS, true, a, b);
            } else {
                return emitBinary(resultKind, SSEOp.MUL, SS, true, a, b);
            }
        case DOUBLE:
            if (isAvx) {
                return emitBinary(resultKind, AVXOp.MUL, SD, true, a, b);
            } else {
                return emitBinary(resultKind, SSEOp.MUL, SD, 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 5 with AMD64Kind

use of jdk.vm.ci.amd64.AMD64Kind in project graal by oracle.

the class AMD64ArithmeticLIRGenerator method emitXor.

@Override
public Variable emitXor(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, XOR, DWORD, true, a, b, false);
        case QWORD:
            return emitBinary(resultKind, XOR, QWORD, true, a, b, false);
        case SINGLE:
            if (isAvx) {
                return emitBinary(resultKind, AVXOp.XOR, PS, true, a, b);
            } else {
                return emitBinary(resultKind, SSEOp.XOR, PS, true, a, b);
            }
        case DOUBLE:
            if (isAvx) {
                return emitBinary(resultKind, AVXOp.XOR, PD, true, a, b);
            } else {
                return emitBinary(resultKind, SSEOp.XOR, 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)

Aggregations

AMD64Kind (jdk.vm.ci.amd64.AMD64Kind)24 TargetDescription (jdk.vm.ci.code.TargetDescription)9 AMD64AddressValue (org.graalvm.compiler.lir.amd64.AMD64AddressValue)8 Variable (org.graalvm.compiler.lir.Variable)7 LIRKind (org.graalvm.compiler.core.common.LIRKind)6 AllocatableValue (jdk.vm.ci.meta.AllocatableValue)5 RegisterValue (jdk.vm.ci.code.RegisterValue)3 Register (jdk.vm.ci.code.Register)2 JavaConstant (jdk.vm.ci.meta.JavaConstant)2 Value (jdk.vm.ci.meta.Value)2 AMD64Address (org.graalvm.compiler.asm.amd64.AMD64Address)2 AMD64RMOp (org.graalvm.compiler.asm.amd64.AMD64Assembler.AMD64RMOp)2 OperandSize (org.graalvm.compiler.asm.amd64.AMD64Assembler.OperandSize)2 CanonicalCondition (org.graalvm.compiler.core.common.calc.CanonicalCondition)2 Condition (org.graalvm.compiler.core.common.calc.Condition)2 NodeLIRBuilder (org.graalvm.compiler.core.gen.NodeLIRBuilder)2 ComplexMatchResult (org.graalvm.compiler.core.match.ComplexMatchResult)2 LabelRef (org.graalvm.compiler.lir.LabelRef)2 AMD64Move (org.graalvm.compiler.lir.amd64.AMD64Move)2 CompareAndSwapOp (org.graalvm.compiler.lir.amd64.AMD64Move.CompareAndSwapOp)2