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; op = I32_GT_S;
break; break;
case i64: case i64:
op = I64_NE; op = I64_GT_S;
break; break;
case f32: case f32:
op = F32_NE; op = F32_GT;
break; break;
case f64: 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;
} }
break; break;

View File

@ -564,6 +564,15 @@ public abstract class ModuleWriter implements Closeable {
case 155: // iflt case 155: // iflt
opIfCondition( NumericOperator.gt, byteCode ); opIfCondition( NumericOperator.gt, byteCode );
break; 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 case 167: // goto
byteCode.skip(2); byteCode.skip(2);
break; break;

View File

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