final BigInteger size = t.getSizeInBits().getValue();
e.getLexicalInformation(), JPRACheckerErrorCode.MATRIX_SIZE_FLOAT_UNSUPPORTED, sb.toString());
private TypeExprFloat<IdentifierType, TType> checkTypeExprFloat( final TypeExprFloat<IdentifierType, Untyped> e) throws JPRACompilerCheckerException { final SizeExprType<IdentifierType, TType> se = this.checkSizeExpr(e.getSize()); final Size<SizeUnitBitsType> size = this.evaluateSize(se); if (this.caps.isRecordFloatSizeBitsSupported(size.getValue())) { final TType type = new TFloat(e.getLexicalInformation(), size); return new TypeExprFloat<>(type, e.getLexicalInformation(), se); } throw JPRACompilerCheckerException.floatSizeNotSupported( e, size, this.caps.getRecordFloatSizeBitsSupported()); }
private TypeExprFloat<IdentifierType, TType> checkTypeExprFloat( final TypeExprFloat<IdentifierType, Untyped> e) throws JPRACompilerCheckerException { final SizeExprType<IdentifierType, TType> se = this.checkSizeExpr(e.getSize()); final Size<SizeUnitBitsType> size = JPRAChecker.evaluateSize(se); if (this.caps.isRecordFloatSizeBitsSupported(size.getValue())) { final TType type = new TFloat(e.getLexicalInformation(), size); return new TypeExprFloat<>(type, e.getLexicalInformation(), se); } throw JPRACompilerCheckerException.floatSizeNotSupported( e, size, this.caps.getRecordFloatSizeBitsSupported()); }
@Override public Unit matchScalarFloat( final TFloat t) throws JPRACompilerCheckerException { final BigInteger size = t.getSizeInBits().getValue(); if (!JPRAChecker.this.caps.isMatrixFloatSizeSupported(size)) { throw JPRACompilerCheckerException.matrixFloatSizeNotSupported( t, size, JPRAChecker.this.caps.getMatrixFloatSizeSupported()); } return Unit.unit(); } });
new FieldName(no_lex, "f16"), gc.getFreshIdentifier(), new TFloat(no_lex, Size.valueOf(16L))); rb.addField( new FieldName(no_lex, "f32"), gc.getFreshIdentifier(), new TFloat(no_lex, Size.valueOf(32L))); rb.addField( new FieldName(no_lex, "f64"), gc.getFreshIdentifier(), new TFloat(no_lex, Size.valueOf(64L)));
e.getLexicalInformation(), JPRACheckerErrorCode.MATRIX_SIZE_FLOAT_UNSUPPORTED, sb.toString());
@Override public Unit matchScalarFloat( final TFloat t) throws JPRACompilerCheckerException { final BigInteger size = t.getSizeInBits().getValue(); if (!JPRAChecker.this.caps.isVectorFloatSizeSupported(size)) { throw JPRACompilerCheckerException.vectorFloatSizeNotSupported( t, size, JPRAChecker.this.caps.getVectorFloatSizeSupported()); } return Unit.unit(); } });
e.getLexicalInformation(), JPRACheckerErrorCode.VECTOR_SIZE_FLOAT_UNSUPPORTED, sb.toString());
@Override public Unit matchFloat(final TFloat t) final BigInteger size = t.getSizeInBits().getValue();
e.getLexicalInformation(), JPRACheckerErrorCode.VECTOR_SIZE_FLOAT_UNSUPPORTED, sb.toString());
@Override public Unit matchScalarFloat( final TFloat t) throws JPRACompilerCheckerException { final BigInteger size = t.getSizeInBits().getValue(); if (!JPRAChecker.this.caps.isVectorFloatSizeSupported(size)) { throw JPRACompilerCheckerException.vectorFloatSizeNotSupported( t, size, JPRAChecker.this.caps.getVectorFloatSizeSupported()); } return Unit.unit(); } });
@Override public Unit matchScalarFloat( final TFloat t) throws JPRACompilerCheckerException { final BigInteger size = t.getSizeInBits().getValue(); if (!JPRAChecker.this.caps.isMatrixFloatSizeSupported(size)) { throw JPRACompilerCheckerException.matrixFloatSizeNotSupported( t, size, JPRAChecker.this.caps.getMatrixFloatSizeSupported()); } return Unit.unit(); } });
@Override public Unit matchFloat(final TFloat t) { /* Construct a meta type field, and assign a value to it. */ final FieldName f_name = this.field.getName(); final ClassName c_name = JPRAClasses.getModelScalarTypeForScalarType(t); final String meta_field_name = JPRAGeneratedNames.getMetaTypeFieldName(f_name); this.class_builder.addField( c_name, meta_field_name, Modifier.FINAL, Modifier.PRIVATE); this.constructor_builder.addStatement( "this.$N = $T.of($L)", meta_field_name, c_name, t.getSizeInBits().getValue()); return Unit.unit(); }
final TFloat t) final int e_size = t.getSizeInBits().getValue().intValue(); switch (e_size) { case 32: {
final TFloat t) final int e_size = t.getSizeInBits().getValue().intValue(); switch (e_size) { case 16: {
@Test public final void testRecordTypeExprFloatSizeSupported() throws Exception { final JPRAParserType p = this.newParser(); final GlobalContextType c = GlobalContexts.newContext(new AlwaysEmptyLoader()); final JPRAResolverType r = this.newResolver(c); final JPRACheckerType ch = this.newChecker( c, JPRACheckerStandardCapabilities.newCapabilities()); final TypeExprType<IdentifierType, Untyped> te = r.resolveTypeExpression( p.parseTypeExpression( this.newStringSExpr("(float 32)"))); final TypeExprFloat<IdentifierType, TType> e = TypeExprFloat.class.cast(ch.checkTypeExpression(te)); final TFloat ti = TFloat.class.cast(e.getType()); Assert.assertEquals(BigInteger.valueOf(32L), ti.getSizeInBits().getValue()); }