cranelift: Port bitselect over to ISLE on x64
This commit is contained in:
@@ -1534,30 +1534,8 @@ fn lower_insn_to_regs<C: LowerCtx<I = Inst>>(
|
||||
| Opcode::Umax
|
||||
| Opcode::Imin
|
||||
| Opcode::Umin
|
||||
| Opcode::Bnot => implemented_in_isle(ctx),
|
||||
|
||||
Opcode::Bitselect => {
|
||||
let ty = ty.unwrap();
|
||||
let condition = put_input_in_reg(ctx, inputs[0]);
|
||||
let if_true = put_input_in_reg(ctx, inputs[1]);
|
||||
let if_false = input_to_reg_mem(ctx, inputs[2]);
|
||||
let dst = get_output_reg(ctx, outputs[0]).only_reg().unwrap();
|
||||
|
||||
if ty.is_vector() {
|
||||
let tmp1 = ctx.alloc_tmp(ty).only_reg().unwrap();
|
||||
ctx.emit(Inst::gen_move(tmp1, if_true, ty));
|
||||
ctx.emit(Inst::and(ty, RegMem::reg(condition.clone()), tmp1));
|
||||
|
||||
let tmp2 = ctx.alloc_tmp(ty).only_reg().unwrap();
|
||||
ctx.emit(Inst::gen_move(tmp2, condition, ty));
|
||||
ctx.emit(Inst::and_not(ty, if_false, tmp2));
|
||||
|
||||
ctx.emit(Inst::gen_move(dst, tmp2.to_reg(), ty));
|
||||
ctx.emit(Inst::or(ty, RegMem::from(tmp1), dst));
|
||||
} else {
|
||||
unimplemented!("no lowering for scalar bitselect instruction")
|
||||
}
|
||||
}
|
||||
| Opcode::Bnot
|
||||
| Opcode::Bitselect => implemented_in_isle(ctx),
|
||||
|
||||
Opcode::Vselect => {
|
||||
let ty = ty.unwrap();
|
||||
|
||||
Reference in New Issue
Block a user