Add support for "copysign" for the text format.

This commit is contained in:
Volker Berlin 2019-08-03 20:51:00 +02:00
parent ae489b2f5a
commit 9bb6e64ce8
3 changed files with 18 additions and 0 deletions

View File

@ -1039,6 +1039,17 @@ public class BinaryModuleWriter extends ModuleWriter implements InstructionOpcod
default:
}
break;
case copysign:
switch( valueType ) {
case f32:
op = F32_COPYSIGN;
break;
case f64:
op = F64_COPYSIGN;
break;
default:
}
break;
default:
}

View File

@ -50,4 +50,5 @@ public enum NumericOperator {
floor,
trunc,
nearest,
copysign,
}

View File

@ -114,6 +114,9 @@ public class WatParser extends WasmCodeBuilder {
case "f32.reinterpret_i32":
addConvertInstruction( ValueTypeConvertion.i2f_re, javaCodePos, lineNumber );
break;
case "f32.copysign":
addNumericInstruction( NumericOperator.copysign, ValueType.f32, javaCodePos, lineNumber );
break;
case "f32.sqrt":
addNumericInstruction( NumericOperator.sqrt, ValueType.f32, javaCodePos, lineNumber );
break;
@ -153,6 +156,9 @@ public class WatParser extends WasmCodeBuilder {
case "f64.reinterpret_i64":
addConvertInstruction( ValueTypeConvertion.l2d_re, javaCodePos, lineNumber );
break;
case "f64.copysign":
addNumericInstruction( NumericOperator.copysign, ValueType.f64, javaCodePos, lineNumber );
break;
case "f64.sqrt":
addNumericInstruction( NumericOperator.sqrt, ValueType.f64, javaCodePos, lineNumber );
break;