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();
}
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();
}
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();
}
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);
}
}
}
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);
}
}
}
}
Aggregations