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));
}
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));
}
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;
}
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);
}
Aggregations