@@ -10,8 +10,9 @@ use crate::{
1010 go:: {
1111 GoIdentifier , GoResult , GoType , Operand , comment,
1212 imports:: {
13- ERRORS_NEW , WAZERO_API_DECODE_I32 , WAZERO_API_DECODE_U32 , WAZERO_API_ENCODE_I32 ,
14- WAZERO_API_ENCODE_U32 ,
13+ ERRORS_NEW , WAZERO_API_DECODE_F32 , WAZERO_API_DECODE_F64 , WAZERO_API_DECODE_I32 ,
14+ WAZERO_API_DECODE_U32 , WAZERO_API_ENCODE_F32 , WAZERO_API_ENCODE_F64 ,
15+ WAZERO_API_ENCODE_I32 , WAZERO_API_ENCODE_U32 ,
1516 } ,
1617 } ,
1718 resolve_type, resolve_wasm_type,
@@ -1120,8 +1121,26 @@ impl Bindgen for Func<'_> {
11201121 }
11211122 results. push ( Operand :: SingleValue ( value) )
11221123 }
1123- Instruction :: CoreF32FromF32 => todo ! ( "implement instruction: {inst:?}" ) ,
1124- Instruction :: CoreF64FromF64 => todo ! ( "implement instruction: {inst:?}" ) ,
1124+ Instruction :: CoreF32FromF32 => {
1125+ let tmp = self . tmp ( ) ;
1126+ let result = & format ! ( "result{tmp}" ) ;
1127+ let operand = & operands[ 0 ] ;
1128+ quote_in ! { self . body =>
1129+ $[ '\r' ]
1130+ $result : = $WAZERO_API_ENCODE_F32 ( $operand)
1131+ } ;
1132+ results. push ( Operand :: SingleValue ( result. into ( ) ) ) ;
1133+ }
1134+ Instruction :: CoreF64FromF64 => {
1135+ let tmp = self . tmp ( ) ;
1136+ let result = & format ! ( "result{tmp}" ) ;
1137+ let operand = & operands[ 0 ] ;
1138+ quote_in ! { self . body =>
1139+ $[ '\r' ]
1140+ $result : = $WAZERO_API_ENCODE_F64 ( $operand)
1141+ } ;
1142+ results. push ( Operand :: SingleValue ( result. into ( ) ) ) ;
1143+ }
11251144 // TODO: Validate the Go cast truncates the upper bits in the I32
11261145 Instruction :: S8FromI32 => {
11271146 let tmp = self . tmp ( ) ;
@@ -1179,8 +1198,26 @@ impl Bindgen for Func<'_> {
11791198 Instruction :: S64FromI64 => todo ! ( "implement instruction: {inst:?}" ) ,
11801199 Instruction :: U64FromI64 => todo ! ( "implement instruction: {inst:?}" ) ,
11811200 Instruction :: CharFromI32 => todo ! ( "implement instruction: {inst:?}" ) ,
1182- Instruction :: F32FromCoreF32 => todo ! ( "implement instruction: {inst:?}" ) ,
1183- Instruction :: F64FromCoreF64 => todo ! ( "implement instruction: {inst:?}" ) ,
1201+ Instruction :: F32FromCoreF32 => {
1202+ let tmp = self . tmp ( ) ;
1203+ let result = & format ! ( "result{tmp}" ) ;
1204+ let operand = & operands[ 0 ] ;
1205+ quote_in ! { self . body =>
1206+ $[ '\r' ]
1207+ $result : = $WAZERO_API_DECODE_F32 ( $operand)
1208+ } ;
1209+ results. push ( Operand :: SingleValue ( result. into ( ) ) ) ;
1210+ }
1211+ Instruction :: F64FromCoreF64 => {
1212+ let tmp = self . tmp ( ) ;
1213+ let result = & format ! ( "result{tmp}" ) ;
1214+ let operand = & operands[ 0 ] ;
1215+ quote_in ! { self . body =>
1216+ $[ '\r' ]
1217+ $result : = $WAZERO_API_DECODE_F64 ( $operand)
1218+ } ;
1219+ results. push ( Operand :: SingleValue ( result. into ( ) ) ) ;
1220+ }
11841221 Instruction :: TupleLower { .. } => todo ! ( "implement instruction: {inst:?}" ) ,
11851222 Instruction :: TupleLift { .. } => todo ! ( "implement instruction: {inst:?}" ) ,
11861223 Instruction :: FlagsLower { .. } => todo ! ( "implement instruction: {inst:?}" ) ,
0 commit comments