Search in sources :

Example 1 with ConditionFlag

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

the class AArch64LIRGenerator method emitCompareBranch.

@Override
public void emitCompareBranch(PlatformKind cmpKind, Value left, Value right, Condition cond, boolean unorderedIsTrue, LabelRef trueDestination, LabelRef falseDestination, double trueDestinationProbability) {
    boolean mirrored = emitCompare(cmpKind, left, right, cond, unorderedIsTrue);
    Condition finalCondition = mirrored ? cond.mirror() : cond;
    boolean finalUnorderedIsTrue = mirrored ? !unorderedIsTrue : unorderedIsTrue;
    ConditionFlag cmpCondition = toConditionFlag(((AArch64Kind) cmpKind).isInteger(), finalCondition, finalUnorderedIsTrue);
    append(new BranchOp(cmpCondition, trueDestination, falseDestination, trueDestinationProbability));
}
Also used : Condition(org.graalvm.compiler.core.common.calc.Condition) BranchOp(org.graalvm.compiler.lir.aarch64.AArch64ControlFlow.BranchOp) ConditionFlag(org.graalvm.compiler.asm.aarch64.AArch64Assembler.ConditionFlag)

Example 2 with ConditionFlag

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

the class AArch64LIRGenerator method emitConditionalMove.

/**
 * Conditionally move trueValue into new variable if cond + unorderedIsTrue is true, else
 * falseValue.
 *
 * @param left Arbitrary value. Has to have same type as right. Non null.
 * @param right Arbitrary value. Has to have same type as left. Non null.
 * @param cond condition that decides whether to move trueValue or falseValue into result. Non
 *            null.
 * @param unorderedIsTrue defines whether floating-point comparisons consider unordered true or
 *            not. Ignored for integer comparisons.
 * @param trueValue arbitrary value same type as falseValue. Non null.
 * @param falseValue arbitrary value same type as trueValue. Non null.
 * @return value containing trueValue if cond + unorderedIsTrue is true, else falseValue. Non
 *         null.
 */
@Override
public Variable emitConditionalMove(PlatformKind cmpKind, Value left, Value right, Condition cond, boolean unorderedIsTrue, Value trueValue, Value falseValue) {
    boolean mirrored = emitCompare(cmpKind, left, right, cond, unorderedIsTrue);
    Condition finalCondition = mirrored ? cond.mirror() : cond;
    boolean finalUnorderedIsTrue = mirrored ? !unorderedIsTrue : unorderedIsTrue;
    ConditionFlag cmpCondition = toConditionFlag(((AArch64Kind) cmpKind).isInteger(), finalCondition, finalUnorderedIsTrue);
    Variable result = newVariable(trueValue.getValueKind());
    append(new CondMoveOp(result, cmpCondition, loadReg(trueValue), loadReg(falseValue)));
    return result;
}
Also used : Condition(org.graalvm.compiler.core.common.calc.Condition) Variable(org.graalvm.compiler.lir.Variable) CondMoveOp(org.graalvm.compiler.lir.aarch64.AArch64ControlFlow.CondMoveOp) ConditionFlag(org.graalvm.compiler.asm.aarch64.AArch64Assembler.ConditionFlag)

Aggregations

ConditionFlag (org.graalvm.compiler.asm.aarch64.AArch64Assembler.ConditionFlag)2 Condition (org.graalvm.compiler.core.common.calc.Condition)2 Variable (org.graalvm.compiler.lir.Variable)1 BranchOp (org.graalvm.compiler.lir.aarch64.AArch64ControlFlow.BranchOp)1 CondMoveOp (org.graalvm.compiler.lir.aarch64.AArch64ControlFlow.CondMoveOp)1