Search in sources :

Example 16 with AArch64MacroAssembler

use of org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler in project graal by oracle.

the class AArch64Move method stack2reg.

private static void stack2reg(CompilationResultBuilder crb, AArch64MacroAssembler masm, AllocatableValue result, AllocatableValue input) {
    AArch64Kind kind = (AArch64Kind) input.getPlatformKind();
    // use the slot kind to define the operand size
    final int size = kind.getSizeInBytes() * Byte.SIZE;
    if (kind.isInteger()) {
        AArch64Address src = loadStackSlotAddress(crb, masm, asStackSlot(input), result);
        masm.ldr(size, asRegister(result), src);
    } else {
        try (ScratchRegister sc = masm.getScratchRegister()) {
            AllocatableValue scratchRegisterValue = sc.getRegister().asValue(LIRKind.combine(input));
            AArch64Address src = loadStackSlotAddress(crb, masm, asStackSlot(input), scratchRegisterValue);
            masm.fldr(size, asRegister(result), src);
        }
    }
}
Also used : ScratchRegister(org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler.ScratchRegister) AArch64Kind(jdk.vm.ci.aarch64.AArch64Kind) AArch64Address(org.graalvm.compiler.asm.aarch64.AArch64Address) ValueUtil.asAllocatableValue(jdk.vm.ci.code.ValueUtil.asAllocatableValue) AllocatableValue(jdk.vm.ci.meta.AllocatableValue)

Example 17 with AArch64MacroAssembler

use of org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler in project graal by oracle.

the class AArch64Move method const2stack.

private static void const2stack(CompilationResultBuilder crb, AArch64MacroAssembler masm, Value result, JavaConstant constant) {
    try (ScratchRegister addrReg = masm.getScratchRegister()) {
        StackSlot slot = (StackSlot) result;
        AArch64Address resultAddress = loadStackSlotAddress(crb, masm, slot, addrReg.getRegister());
        if (constant.isDefaultForKind() || constant.isNull()) {
            emitStore(crb, masm, (AArch64Kind) result.getPlatformKind(), resultAddress, zr.asValue(LIRKind.combine(result)));
        } else {
            try (ScratchRegister sc = masm.getScratchRegister()) {
                Value scratchRegisterValue = sc.getRegister().asValue(LIRKind.combine(result));
                const2reg(crb, masm, scratchRegisterValue, constant);
                emitStore(crb, masm, (AArch64Kind) result.getPlatformKind(), resultAddress, scratchRegisterValue);
            }
        }
    }
}
Also used : ScratchRegister(org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler.ScratchRegister) ValueUtil.asAllocatableValue(jdk.vm.ci.code.ValueUtil.asAllocatableValue) Value(jdk.vm.ci.meta.Value) AllocatableValue(jdk.vm.ci.meta.AllocatableValue) ValueUtil.asStackSlot(jdk.vm.ci.code.ValueUtil.asStackSlot) VirtualStackSlot(org.graalvm.compiler.lir.VirtualStackSlot) ValueUtil.isStackSlot(jdk.vm.ci.code.ValueUtil.isStackSlot) StackSlot(jdk.vm.ci.code.StackSlot) AArch64Address(org.graalvm.compiler.asm.aarch64.AArch64Address)

Example 18 with AArch64MacroAssembler

use of org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler in project graal by oracle.

the class AArch64ArrayEqualsOp method emitTailCompares.

/**
 * Emits code to compare the remaining 1 to 4 bytes.
 */
private void emitTailCompares(AArch64MacroAssembler masm, Register result, Register array1, Register array2, Label breakLabel, Register rscratch1) {
    Label compare2Bytes = new Label();
    Label compare1Byte = new Label();
    Label end = new Label();
    Register temp = asRegister(temp4);
    if (kind.getByteCount() <= 4) {
        // Compare trailing 4 bytes, if any.
        masm.ands(32, zr, result, 4);
        masm.branchConditionally(ConditionFlag.EQ, compare2Bytes);
        masm.ldr(32, temp, AArch64Address.createPostIndexedImmediateAddress(array1, 4));
        masm.ldr(32, rscratch1, AArch64Address.createPostIndexedImmediateAddress(array2, 4));
        masm.eor(32, rscratch1, temp, rscratch1);
        masm.cbnz(32, rscratch1, breakLabel);
        if (kind.getByteCount() <= 2) {
            // Compare trailing 2 bytes, if any.
            masm.bind(compare2Bytes);
            masm.ands(32, zr, result, 2);
            masm.branchConditionally(ConditionFlag.EQ, compare1Byte);
            masm.ldr(16, temp, AArch64Address.createPostIndexedImmediateAddress(array1, 2));
            masm.ldr(16, rscratch1, AArch64Address.createPostIndexedImmediateAddress(array2, 2));
            masm.eor(32, rscratch1, temp, rscratch1);
            masm.cbnz(32, rscratch1, breakLabel);
            // The one-byte tail compare is only required for boolean and byte arrays.
            if (kind.getByteCount() <= 1) {
                // Compare trailing byte, if any.
                masm.bind(compare1Byte);
                masm.ands(32, zr, result, 1);
                masm.branchConditionally(ConditionFlag.EQ, end);
                masm.ldr(8, temp, AArch64Address.createBaseRegisterOnlyAddress(array1));
                masm.ldr(8, rscratch1, AArch64Address.createBaseRegisterOnlyAddress(array2));
                masm.eor(32, rscratch1, temp, rscratch1);
                masm.cbnz(32, rscratch1, breakLabel);
            } else {
                masm.bind(compare1Byte);
            }
        } else {
            masm.bind(compare2Bytes);
        }
    }
    masm.bind(end);
    masm.mov(64, rscratch1, zr);
}
Also used : ScratchRegister(org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler.ScratchRegister) Register(jdk.vm.ci.code.Register) ValueUtil.asRegister(jdk.vm.ci.code.ValueUtil.asRegister) Label(org.graalvm.compiler.asm.Label)

Aggregations

ScratchRegister (org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler.ScratchRegister)15 Register (jdk.vm.ci.code.Register)13 ValueUtil.asRegister (jdk.vm.ci.code.ValueUtil.asRegister)11 AArch64Address (org.graalvm.compiler.asm.aarch64.AArch64Address)9 Label (org.graalvm.compiler.asm.Label)6 ValueUtil.isRegister (jdk.vm.ci.code.ValueUtil.isRegister)4 AArch64MacroAssembler (org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler)4 AArch64Kind (jdk.vm.ci.aarch64.AArch64Kind)3 ValueUtil.asAllocatableValue (jdk.vm.ci.code.ValueUtil.asAllocatableValue)2 AllocatableValue (jdk.vm.ci.meta.AllocatableValue)2 HotSpotProviders (org.graalvm.compiler.hotspot.meta.HotSpotProviders)2 CallingConvention (jdk.vm.ci.code.CallingConvention)1 RegisterConfig (jdk.vm.ci.code.RegisterConfig)1 StackSlot (jdk.vm.ci.code.StackSlot)1 TargetDescription (jdk.vm.ci.code.TargetDescription)1 ValueUtil.asStackSlot (jdk.vm.ci.code.ValueUtil.asStackSlot)1 ValueUtil.isStackSlot (jdk.vm.ci.code.ValueUtil.isStackSlot)1 AArch64HotSpotRegisterConfig (jdk.vm.ci.hotspot.aarch64.AArch64HotSpotRegisterConfig)1 PlatformKind (jdk.vm.ci.meta.PlatformKind)1 Value (jdk.vm.ci.meta.Value)1