@@ -13,11 +13,12 @@ use rustc_codegen_ssa::common::IntPredicate;
1313use rustc_codegen_ssa:: errors:: InvalidMonomorphization ;
1414use rustc_codegen_ssa:: mir:: operand:: { OperandRef , OperandValue } ;
1515use rustc_codegen_ssa:: mir:: place:: { PlaceRef , PlaceValue } ;
16+ use rustc_codegen_ssa:: traits:: BaseTypeCodegenMethods ;
17+ #[ cfg( feature = "master" ) ]
18+ use rustc_codegen_ssa:: traits:: MiscCodegenMethods ;
1619use rustc_codegen_ssa:: traits:: {
1720 ArgAbiBuilderMethods , BuilderMethods , ConstCodegenMethods , IntrinsicCallBuilderMethods ,
1821} ;
19- #[ cfg( feature = "master" ) ]
20- use rustc_codegen_ssa:: traits:: { BaseTypeCodegenMethods , MiscCodegenMethods } ;
2122use rustc_middle:: bug;
2223#[ cfg( feature = "master" ) ]
2324use rustc_middle:: ty:: layout:: { FnAbiOf , HasTyCtxt } ;
@@ -139,6 +140,18 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tc
139140 & args. iter ( ) . map ( |arg| arg. immediate ( ) ) . collect :: < Vec < _ > > ( ) ,
140141 )
141142 }
143+ sym:: fmaf16 => {
144+ // TODO(antoyo): use the correct builtin for f16.
145+ let func = self . cx . context . get_builtin_function ( "fmaf" ) ;
146+ let args: Vec < _ > = args
147+ . iter ( )
148+ . map ( |arg| {
149+ self . cx . context . new_cast ( self . location , arg. immediate ( ) , self . cx . type_f32 ( ) )
150+ } )
151+ . collect ( ) ;
152+ let result = self . cx . context . new_call ( self . location , func, & args) ;
153+ self . cx . context . new_cast ( self . location , result, self . cx . type_f16 ( ) )
154+ }
142155 sym:: is_val_statically_known => {
143156 let a = args[ 0 ] . immediate ( ) ;
144157 let builtin = self . context . get_builtin_function ( "__builtin_constant_p" ) ;
0 commit comments