Search in sources :

Example 21 with AArch64Address

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

the class AArch64MacroAssemblerTest method testLoadAddressRegisterOffsetScaled.

@Test
public void testLoadAddressRegisterOffsetScaled() {
    Register dst = AArch64.r26;
    AArch64Address address = AArch64Address.createRegisterOffsetAddress(base, index, true);
    masm.loadAddress(dst, address, 4);
    asm.add(64, dst, base, index, AArch64Assembler.ShiftType.LSL, 2);
    compareAssembly();
}
Also used : Register(jdk.vm.ci.code.Register) AArch64Address(org.graalvm.compiler.asm.aarch64.AArch64Address) Test(org.junit.Test) GraalTest(org.graalvm.compiler.test.GraalTest)

Example 22 with AArch64Address

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

the class AArch64MacroAssemblerTest method testMakeAddressAddIndexNoOverwrite.

@Test
public void testMakeAddressAddIndexNoOverwrite() {
    AArch64Address address = masm.makeAddress(base, NumUtil.getNbitNumberInt(8) << 5, index, false, 8, scratch, false);
    Assert.assertTrue(address.isScaled() && address.getAddressingMode() == AArch64Address.AddressingMode.REGISTER_OFFSET && address.getBase().equals(base) && address.getOffset().equals(scratch));
    asm.add(64, scratch, index, NumUtil.getNbitNumberInt(8) << 2);
    compareAssembly();
}
Also used : AArch64Address(org.graalvm.compiler.asm.aarch64.AArch64Address) Test(org.junit.Test) GraalTest(org.graalvm.compiler.test.GraalTest)

Example 23 with AArch64Address

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

the class AArch64MacroAssemblerTest method testLoadAddressScaledLowerOnly.

@Test
public void testLoadAddressScaledLowerOnly() {
    Register dst = AArch64.r26;
    AArch64Address address = AArch64Address.createScaledImmediateAddress(base, NumUtil.getNbitNumberInt(5));
    masm.loadAddress(dst, address, 8);
    asm.add(64, dst, base, NumUtil.getNbitNumberInt(5) << 3);
    compareAssembly();
}
Also used : Register(jdk.vm.ci.code.Register) AArch64Address(org.graalvm.compiler.asm.aarch64.AArch64Address) Test(org.junit.Test) GraalTest(org.graalvm.compiler.test.GraalTest)

Example 24 with AArch64Address

use of org.graalvm.compiler.asm.aarch64.AArch64Address 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 25 with AArch64Address

use of org.graalvm.compiler.asm.aarch64.AArch64Address 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)

Aggregations

AArch64Address (org.graalvm.compiler.asm.aarch64.AArch64Address)25 Register (jdk.vm.ci.code.Register)16 GraalTest (org.graalvm.compiler.test.GraalTest)16 Test (org.junit.Test)16 ScratchRegister (org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler.ScratchRegister)8 ValueUtil.asRegister (jdk.vm.ci.code.ValueUtil.asRegister)6 ValueUtil.isRegister (jdk.vm.ci.code.ValueUtil.isRegister)3 AArch64Kind (jdk.vm.ci.aarch64.AArch64Kind)2 ValueUtil.asAllocatableValue (jdk.vm.ci.code.ValueUtil.asAllocatableValue)2 AllocatableValue (jdk.vm.ci.meta.AllocatableValue)2 CallingConvention (jdk.vm.ci.code.CallingConvention)1 StackSlot (jdk.vm.ci.code.StackSlot)1 ValueUtil.asStackSlot (jdk.vm.ci.code.ValueUtil.asStackSlot)1 ValueUtil.isStackSlot (jdk.vm.ci.code.ValueUtil.isStackSlot)1 PlatformKind (jdk.vm.ci.meta.PlatformKind)1 Value (jdk.vm.ci.meta.Value)1 Label (org.graalvm.compiler.asm.Label)1 AArch64Assembler (org.graalvm.compiler.asm.aarch64.AArch64Assembler)1 ExtendType (org.graalvm.compiler.asm.aarch64.AArch64Assembler.ExtendType)1 AArch64MacroAssembler (org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler)1