use of jdk.vm.ci.aarch64.AArch64Kind in project graal by oracle.
the class AArch64LIRGenerator method emitCompare.
/**
* This method emits the compare instruction, and may reorder the operands. It returns true if
* it did so.
*
* @param a the left operand of the comparison. Has to have same type as b. Non null.
* @param b the right operand of the comparison. Has to have same type as a. Non null.
* @return true if mirrored (i.e. "b cmp a" instead of "a cmp b" was done).
*/
protected boolean emitCompare(PlatformKind cmpKind, Value a, Value b, Condition condition, boolean unorderedIsTrue) {
Value left;
Value right;
boolean mirrored;
AArch64Kind kind = (AArch64Kind) cmpKind;
if (kind.isInteger()) {
Value aExt = a;
Value bExt = b;
int compareBytes = cmpKind.getSizeInBytes();
// AArch64 compares 32 or 64 bits: sign extend a and b as required.
if (compareBytes < a.getPlatformKind().getSizeInBytes()) {
aExt = arithmeticLIRGen.emitSignExtend(a, compareBytes * 8, 64);
}
if (compareBytes < b.getPlatformKind().getSizeInBytes()) {
bExt = arithmeticLIRGen.emitSignExtend(b, compareBytes * 8, 64);
}
if (LIRValueUtil.isVariable(bExt)) {
left = load(bExt);
right = loadNonConst(aExt);
mirrored = true;
} else {
left = load(aExt);
right = loadNonConst(bExt);
mirrored = false;
}
append(new AArch64Compare.CompareOp(left, loadNonCompareConst(right)));
} else if (kind.isSIMD()) {
if (AArch64Compare.FloatCompareOp.isFloatCmpConstant(a, condition, unorderedIsTrue)) {
left = load(b);
right = a;
mirrored = true;
} else if (AArch64Compare.FloatCompareOp.isFloatCmpConstant(b, condition, unorderedIsTrue)) {
left = load(a);
right = b;
mirrored = false;
} else {
left = load(a);
right = loadReg(b);
mirrored = false;
}
append(new AArch64Compare.FloatCompareOp(left, asAllocatable(right), condition, unorderedIsTrue));
} else {
throw GraalError.shouldNotReachHere();
}
return mirrored;
}
use of jdk.vm.ci.aarch64.AArch64Kind in project graal by oracle.
the class AArch64AddressLoweringByUse method doLower.
private AddressNode doLower(Stamp stamp, ValueNode base, ValueNode index) {
AArch64AddressNode ret = new AArch64AddressNode(base, index);
AArch64Kind aarch64Kind = (stamp == null ? null : getAArch64Kind(stamp));
// improve the address as much as possible
boolean changed;
do {
changed = improve(aarch64Kind, ret);
} while (changed);
// avoid duplicates
return base.graph().unique(ret);
}
use of jdk.vm.ci.aarch64.AArch64Kind 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 jdk.vm.ci.aarch64.AArch64Kind in project graal by oracle.
the class AArch64ReinterpretOp method emitCode.
@Override
public void emitCode(CompilationResultBuilder crb, AArch64MacroAssembler masm) {
Register result = asRegister(resultValue);
Register input = asRegister(inputValue);
AArch64Kind to = (AArch64Kind) resultValue.getPlatformKind();
final int size = to.getSizeInBytes() * Byte.SIZE;
masm.fmov(size, result, input);
}
use of jdk.vm.ci.aarch64.AArch64Kind in project graal by oracle.
the class AArch64ReadNode method generate.
@Override
public void generate(NodeLIRBuilderTool gen) {
AArch64LIRGenerator lirgen = (AArch64LIRGenerator) gen.getLIRGeneratorTool();
AArch64ArithmeticLIRGenerator arithgen = (AArch64ArithmeticLIRGenerator) lirgen.getArithmetic();
AArch64Kind readKind = (AArch64Kind) lirgen.getLIRKind(accessStamp).getPlatformKind();
int resultBits = ((IntegerStamp) stamp(NodeView.DEFAULT)).getBits();
gen.setResult(this, arithgen.emitExtendMemory(isSigned, readKind, resultBits, (AArch64AddressValue) gen.operand(getAddress()), gen.state(this)));
}
Aggregations