Search in sources :

Example 1 with AArch64

use of jdk.vm.ci.aarch64.AArch64 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;
}
Also used : AArch64Compare(org.graalvm.compiler.lir.aarch64.AArch64Compare) AArch64AddressValue(org.graalvm.compiler.lir.aarch64.AArch64AddressValue) RegisterValue(jdk.vm.ci.code.RegisterValue) Value(jdk.vm.ci.meta.Value) AllocatableValue(jdk.vm.ci.meta.AllocatableValue) AArch64Kind(jdk.vm.ci.aarch64.AArch64Kind)

Example 2 with AArch64

use of jdk.vm.ci.aarch64.AArch64 in project graal by oracle.

the class AArch64MacroAssemblerTest method createTarget.

private static TargetDescription createTarget() {
    final int stackFrameAlignment = 16;
    final int implicitNullCheckLimit = 4096;
    final boolean inlineObjects = true;
    Architecture arch = new AArch64(computeFeatures(), computeFlags());
    return new TargetDescription(arch, true, stackFrameAlignment, implicitNullCheckLimit, inlineObjects);
}
Also used : AArch64(jdk.vm.ci.aarch64.AArch64) Architecture(jdk.vm.ci.code.Architecture) TargetDescription(jdk.vm.ci.code.TargetDescription)

Aggregations

AArch64 (jdk.vm.ci.aarch64.AArch64)1 AArch64Kind (jdk.vm.ci.aarch64.AArch64Kind)1 Architecture (jdk.vm.ci.code.Architecture)1 RegisterValue (jdk.vm.ci.code.RegisterValue)1 TargetDescription (jdk.vm.ci.code.TargetDescription)1 AllocatableValue (jdk.vm.ci.meta.AllocatableValue)1 Value (jdk.vm.ci.meta.Value)1 AArch64AddressValue (org.graalvm.compiler.lir.aarch64.AArch64AddressValue)1 AArch64Compare (org.graalvm.compiler.lir.aarch64.AArch64Compare)1