Combine identical match arms.

This commit is contained in:
Dan Gohman
2017-11-08 10:40:43 -08:00
parent 388ebde41d
commit b7f979a8be

View File

@@ -486,26 +486,15 @@ pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
state.push1(builder.ins().f64const(f64_translation(value))); state.push1(builder.ins().f64const(f64_translation(value)));
} }
/******************************* Unary Operators *************************************/ /******************************* Unary Operators *************************************/
Operator::I32Clz => { Operator::I32Clz | Operator::I64Clz => {
let arg = state.pop1(); let arg = state.pop1();
state.push1(builder.ins().clz(arg)); state.push1(builder.ins().clz(arg));
} }
Operator::I64Clz => { Operator::I32Ctz | Operator::I64Ctz => {
let arg = state.pop1();
state.push1(builder.ins().clz(arg));
}
Operator::I32Ctz => {
let arg = state.pop1(); let arg = state.pop1();
state.push1(builder.ins().ctz(arg)); state.push1(builder.ins().ctz(arg));
} }
Operator::I64Ctz => { Operator::I32Popcnt |
let arg = state.pop1();
state.push1(builder.ins().ctz(arg));
}
Operator::I32Popcnt => {
let arg = state.pop1();
state.push1(builder.ins().popcnt(arg));
}
Operator::I64Popcnt => { Operator::I64Popcnt => {
let arg = state.pop1(); let arg = state.pop1();
state.push1(builder.ins().popcnt(arg)); state.push1(builder.ins().popcnt(arg));