more if conditions

This commit is contained in:
Volker Berlin 2018-03-28 20:07:51 +02:00
parent 01386051af
commit b23683ff68
3 changed files with 62 additions and 3 deletions

View File

@ -476,13 +476,61 @@ public class BinaryModuleWriter extends ModuleWriter implements InstructionOpcod
op = I32_GT_S;
break;
case i64:
op = I64_NE;
op = I64_GT_S;
break;
case f32:
op = F32_NE;
op = F32_GT;
break;
case f64:
op = F64_NE;
op = F64_GT;
break;
}
break;
case lt_s:
switch( valueType ) {
case i32:
op = I32_LT_S;
break;
case i64:
op = I64_LT_S;
break;
case f32:
op = F32_LT;
break;
case f64:
op = F64_LT;
break;
}
break;
case le_s:
switch( valueType ) {
case i32:
op = I32_LE_S;
break;
case i64:
op = I64_LE_S;
break;
case f32:
op = F32_LE;
break;
case f64:
op = F64_LE;
break;
}
break;
case ge_s:
switch( valueType ) {
case i32:
op = I32_GE_S;
break;
case i64:
op = I64_GE_S;
break;
case f32:
op = F32_GE;
break;
case f64:
op = F64_GE;
break;
}
break;

View File

@ -564,6 +564,15 @@ public abstract class ModuleWriter implements Closeable {
case 155: // iflt
opIfCondition( NumericOperator.gt, byteCode );
break;
case 156: // ifge
opIfCondition( NumericOperator.le_s, byteCode );
break;
case 157: // ifgt
opIfCondition( NumericOperator.lt_s, byteCode );
break;
case 158: // ifle
opIfCondition( NumericOperator.ge_s, byteCode );
break;
case 167: // goto
byteCode.skip(2);
break;

View File

@ -34,4 +34,6 @@ public enum NumericOperator {
ne,
gt,
lt_s,
le_s,
ge_s,
}