Search in sources :

Example 1 with LLVM80BitFloat

use of com.oracle.truffle.llvm.runtime.floating.LLVM80BitFloat in project sulong by graalvm.

the class LLVMX86_64VAStart method computeOverflowArgAreaSize.

private int computeOverflowArgAreaSize(Object[] realArguments) {
    assert numberOfExplicitArguments <= realArguments.length;
    int overflowArea = 0;
    int gpOffset = calculateUsedGpArea(realArguments);
    int fpOffset = X86_64BitVarArgs.GP_LIMIT + calculateUsedFpArea(realArguments);
    for (int i = numberOfExplicitArguments; i < realArguments.length; i++) {
        final Object arg = realArguments[i];
        final VarArgArea area = getVarArgArea(arg);
        if (area == VarArgArea.GP_AREA && gpOffset < X86_64BitVarArgs.GP_LIMIT) {
            gpOffset += X86_64BitVarArgs.GP_STEP;
        } else if (area == VarArgArea.FP_AREA && fpOffset < X86_64BitVarArgs.FP_LIMIT) {
            fpOffset += X86_64BitVarArgs.FP_STEP;
        } else if (area != VarArgArea.OVERFLOW_AREA) {
            overflowArea += X86_64BitVarArgs.STACK_STEP;
        } else if (arg instanceof LLVM80BitFloat) {
            overflowArea += 16;
        } else if (arg instanceof LLVMVarArgCompoundValue) {
            LLVMVarArgCompoundValue obj = (LLVMVarArgCompoundValue) arg;
            overflowArea += obj.getSize();
        } else {
            throw new AssertionError(arg);
        }
    }
    return overflowArea;
}
Also used : LLVMVarArgCompoundValue(com.oracle.truffle.llvm.runtime.LLVMVarArgCompoundValue) LLVMTruffleObject(com.oracle.truffle.llvm.runtime.LLVMTruffleObject) LLVM80BitFloat(com.oracle.truffle.llvm.runtime.floating.LLVM80BitFloat)

Example 2 with LLVM80BitFloat

use of com.oracle.truffle.llvm.runtime.floating.LLVM80BitFloat in project sulong by graalvm.

the class LLVM80BitFromDoubleTest method testOne.

@Test
public void testOne() {
    LLVM80BitFloat val = LLVM80BitFloat.fromDouble(1);
    assertEquals(one(), val);
}
Also used : LLVM80BitFloat(com.oracle.truffle.llvm.runtime.floating.LLVM80BitFloat) Test(org.junit.Test)

Example 3 with LLVM80BitFloat

use of com.oracle.truffle.llvm.runtime.floating.LLVM80BitFloat in project sulong by graalvm.

the class LLVM80BitFromDoubleTest method testZero.

@Test
public void testZero() {
    LLVM80BitFloat val = LLVM80BitFloat.fromDouble(0);
    assertEquals(zero(), val);
}
Also used : LLVM80BitFloat(com.oracle.truffle.llvm.runtime.floating.LLVM80BitFloat) Test(org.junit.Test)

Example 4 with LLVM80BitFloat

use of com.oracle.truffle.llvm.runtime.floating.LLVM80BitFloat in project sulong by graalvm.

the class LLVM80BitFromDoubleTest method testNegativeInfinity.

@Test
public void testNegativeInfinity() {
    LLVM80BitFloat val = LLVM80BitFloat.fromDouble(Double.NEGATIVE_INFINITY);
    LLVM80BitFloat expected = LLVM80BitFloat.fromRawValues(true, 0x7fff, 0x8000000000000000L);
    assertEquals(expected, val);
}
Also used : LLVM80BitFloat(com.oracle.truffle.llvm.runtime.floating.LLVM80BitFloat) Test(org.junit.Test)

Example 5 with LLVM80BitFloat

use of com.oracle.truffle.llvm.runtime.floating.LLVM80BitFloat in project sulong by graalvm.

the class LLVM80BitFromDoubleTest method testMinusOne.

@Test
public void testMinusOne() {
    LLVM80BitFloat val = LLVM80BitFloat.fromDouble(-1);
    assertEquals(minusOne(), val);
}
Also used : LLVM80BitFloat(com.oracle.truffle.llvm.runtime.floating.LLVM80BitFloat) Test(org.junit.Test)

Aggregations

LLVM80BitFloat (com.oracle.truffle.llvm.runtime.floating.LLVM80BitFloat)42 Test (org.junit.Test)38 LLVMTruffleObject (com.oracle.truffle.llvm.runtime.LLVMTruffleObject)3 Specialization (com.oracle.truffle.api.dsl.Specialization)2 ExplodeLoop (com.oracle.truffle.api.nodes.ExplodeLoop)2 UnexpectedResultException (com.oracle.truffle.api.nodes.UnexpectedResultException)2 LLVMVarArgCompoundValue (com.oracle.truffle.llvm.runtime.LLVMVarArgCompoundValue)2 LLVMAddress (com.oracle.truffle.llvm.runtime.LLVMAddress)1 LLVMGlobal (com.oracle.truffle.llvm.runtime.global.LLVMGlobal)1 LLVMFloatVector (com.oracle.truffle.llvm.runtime.vector.LLVMFloatVector)1