Search in sources :

Example 6 with VectorType

use of com.oracle.truffle.llvm.runtime.types.VectorType in project sulong by graalvm.

the class Function method createExtractElement.

private void createExtractElement(long[] args) {
    int i = 0;
    int vector = getIndex(args[i++]);
    Type vectorType;
    if (scope.isValueForwardRef(vector)) {
        vectorType = types.get(args[i++]);
    } else {
        vectorType = scope.getValueType(vector);
    }
    int index = getIndex(args[i]);
    final Type elementType = ((VectorType) vectorType).getElementType();
    emit(ExtractElementInstruction.fromSymbols(scope.getSymbols(), elementType, vector, index));
}
Also used : PrimitiveType(com.oracle.truffle.llvm.runtime.types.PrimitiveType) VectorType(com.oracle.truffle.llvm.runtime.types.VectorType) StructureType(com.oracle.truffle.llvm.runtime.types.StructureType) ArrayType(com.oracle.truffle.llvm.runtime.types.ArrayType) AggregateType(com.oracle.truffle.llvm.runtime.types.AggregateType) Type(com.oracle.truffle.llvm.runtime.types.Type) PointerType(com.oracle.truffle.llvm.runtime.types.PointerType) FunctionType(com.oracle.truffle.llvm.runtime.types.FunctionType) VoidType(com.oracle.truffle.llvm.runtime.types.VoidType) VectorType(com.oracle.truffle.llvm.runtime.types.VectorType)

Example 7 with VectorType

use of com.oracle.truffle.llvm.runtime.types.VectorType in project sulong by graalvm.

the class Function method createCompare2.

private void createCompare2(long[] args) {
    int i = 0;
    Type operandType;
    int lhs = getIndex(args[i++]);
    if (scope.isValueForwardRef(lhs)) {
        operandType = types.get(args[i++]);
    } else {
        operandType = scope.getValueType(lhs);
    }
    int rhs = getIndex(args[i++]);
    int opcode = (int) args[i];
    Type type = operandType instanceof VectorType ? new VectorType(PrimitiveType.I1, ((VectorType) operandType).getNumberOfElements()) : PrimitiveType.I1;
    emit(CompareInstruction.fromSymbols(scope.getSymbols(), type, opcode, lhs, rhs));
}
Also used : PrimitiveType(com.oracle.truffle.llvm.runtime.types.PrimitiveType) VectorType(com.oracle.truffle.llvm.runtime.types.VectorType) StructureType(com.oracle.truffle.llvm.runtime.types.StructureType) ArrayType(com.oracle.truffle.llvm.runtime.types.ArrayType) AggregateType(com.oracle.truffle.llvm.runtime.types.AggregateType) Type(com.oracle.truffle.llvm.runtime.types.Type) PointerType(com.oracle.truffle.llvm.runtime.types.PointerType) FunctionType(com.oracle.truffle.llvm.runtime.types.FunctionType) VoidType(com.oracle.truffle.llvm.runtime.types.VoidType) VectorType(com.oracle.truffle.llvm.runtime.types.VectorType)

Example 8 with VectorType

use of com.oracle.truffle.llvm.runtime.types.VectorType in project sulong by graalvm.

the class BinaryOperationInstruction method fromSymbols.

public static BinaryOperationInstruction fromSymbols(SymbolTable symbols, Type type, int opcode, int flags, int lhs, int rhs) {
    final boolean isFloatingPoint = Type.isFloatingpointType(type) || (type instanceof VectorType && Type.isFloatingpointType(((VectorType) type).getElementType()));
    final BinaryOperator operator = BinaryOperator.decode(opcode, isFloatingPoint);
    final BinaryOperationInstruction inst = new BinaryOperationInstruction(type, operator, Flag.decode(operator, flags));
    inst.lhs = symbols.getForwardReferenced(lhs, inst);
    inst.rhs = symbols.getForwardReferenced(rhs, inst);
    return inst;
}
Also used : VectorType(com.oracle.truffle.llvm.runtime.types.VectorType) BinaryOperator(com.oracle.truffle.llvm.parser.model.enums.BinaryOperator)

Example 9 with VectorType

use of com.oracle.truffle.llvm.runtime.types.VectorType in project sulong by graalvm.

the class LLVMFrameNullerUtil method nullObject.

public static void nullObject(VirtualFrame frame, FrameSlot frameSlot) {
    CompilerAsserts.partialEvaluationConstant(frameSlot.getInfo());
    CompilerAsserts.partialEvaluationConstant(frameSlot.getInfo() == null);
    if (frameSlot.getInfo() != null) {
        Type type = (Type) frameSlot.getInfo();
        CompilerAsserts.partialEvaluationConstant(Type.isFunctionOrFunctionPointer(type));
        CompilerAsserts.partialEvaluationConstant(type instanceof VectorType);
        CompilerAsserts.partialEvaluationConstant(type instanceof VariableBitWidthType);
        CompilerAsserts.partialEvaluationConstant(type instanceof PrimitiveType && ((PrimitiveType) type).getPrimitiveKind() == PrimitiveKind.X86_FP80);
        if (Type.isFunctionOrFunctionPointer(type)) {
            nullFunction(frame, frameSlot);
        } else if (type instanceof VectorType && ((VectorType) type).getElementType() instanceof PrimitiveType) {
            nullVector(frame, frameSlot, ((PrimitiveType) ((VectorType) type).getElementType()).getPrimitiveKind());
        } else if (type instanceof VectorType && ((VectorType) type).getElementType() instanceof PointerType) {
            frame.setObject(frameSlot, LLVMAddressVector.createNullVector());
        } else if (type instanceof VariableBitWidthType) {
            nullIVarBit(frame, frameSlot);
        } else if (type instanceof PrimitiveType && ((PrimitiveType) type).getPrimitiveKind() == PrimitiveKind.X86_FP80) {
            null80BitFloat(frame, frameSlot);
        }
    }
    // This is a best effort approach. It could still be that LLVMAddress clashes with some
    // other class.
    nullAddress(frame, frameSlot);
}
Also used : PrimitiveType(com.oracle.truffle.llvm.runtime.types.PrimitiveType) VariableBitWidthType(com.oracle.truffle.llvm.runtime.types.VariableBitWidthType) VectorType(com.oracle.truffle.llvm.runtime.types.VectorType) PointerType(com.oracle.truffle.llvm.runtime.types.PointerType) Type(com.oracle.truffle.llvm.runtime.types.Type) VectorType(com.oracle.truffle.llvm.runtime.types.VectorType) VariableBitWidthType(com.oracle.truffle.llvm.runtime.types.VariableBitWidthType) PrimitiveType(com.oracle.truffle.llvm.runtime.types.PrimitiveType) PointerType(com.oracle.truffle.llvm.runtime.types.PointerType)

Aggregations

VectorType (com.oracle.truffle.llvm.runtime.types.VectorType)9 Type (com.oracle.truffle.llvm.runtime.types.Type)7 ArrayType (com.oracle.truffle.llvm.runtime.types.ArrayType)6 PointerType (com.oracle.truffle.llvm.runtime.types.PointerType)6 PrimitiveType (com.oracle.truffle.llvm.runtime.types.PrimitiveType)6 StructureType (com.oracle.truffle.llvm.runtime.types.StructureType)6 FunctionType (com.oracle.truffle.llvm.runtime.types.FunctionType)5 VoidType (com.oracle.truffle.llvm.runtime.types.VoidType)5 AggregateType (com.oracle.truffle.llvm.runtime.types.AggregateType)4 BinaryOperator (com.oracle.truffle.llvm.parser.model.enums.BinaryOperator)2 LLVMInteropType (com.oracle.truffle.llvm.runtime.interop.access.LLVMInteropType)2 MetaType (com.oracle.truffle.llvm.runtime.types.MetaType)2 VariableBitWidthType (com.oracle.truffle.llvm.runtime.types.VariableBitWidthType)2 LLVMArithmeticInstructionType (com.oracle.truffle.llvm.parser.instructions.LLVMArithmeticInstructionType)1 LLVMConversionType (com.oracle.truffle.llvm.parser.instructions.LLVMConversionType)1 TypesRecord (com.oracle.truffle.llvm.parser.records.TypesRecord)1 LLVMSourcePointerType (com.oracle.truffle.llvm.runtime.debug.LLVMSourcePointerType)1 LLVMSourceType (com.oracle.truffle.llvm.runtime.debug.LLVMSourceType)1 LLVMExpressionNode (com.oracle.truffle.llvm.runtime.nodes.api.LLVMExpressionNode)1 OpaqueType (com.oracle.truffle.llvm.runtime.types.OpaqueType)1