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