|
@ -1591,32 +1591,26 @@ pub(crate) fn lower_insn_to_regs<C: LowerCtx<I = Inst>>( |
|
|
|
|
|
|
|
|
Opcode::Fadd | Opcode::Fsub | Opcode::Fmul | Opcode::Fdiv | Opcode::Fmin | Opcode::Fmax => { |
|
|
Opcode::Fadd | Opcode::Fsub | Opcode::Fmul | Opcode::Fdiv | Opcode::Fmin | Opcode::Fmax => { |
|
|
let ty = ty.unwrap(); |
|
|
let ty = ty.unwrap(); |
|
|
let bits = ty_bits(ty); |
|
|
|
|
|
let rn = put_input_in_reg(ctx, inputs[0], NarrowValueMode::None); |
|
|
let rn = put_input_in_reg(ctx, inputs[0], NarrowValueMode::None); |
|
|
let rm = put_input_in_reg(ctx, inputs[1], NarrowValueMode::None); |
|
|
let rm = put_input_in_reg(ctx, inputs[1], NarrowValueMode::None); |
|
|
let rd = get_output_reg(ctx, outputs[0]).only_reg().unwrap(); |
|
|
let rd = get_output_reg(ctx, outputs[0]).only_reg().unwrap(); |
|
|
if !ty.is_vector() { |
|
|
if !ty.is_vector() { |
|
|
let fpu_op = match (op, bits) { |
|
|
let fpu_op = match op { |
|
|
(Opcode::Fadd, 32) => FPUOp2::Add32, |
|
|
Opcode::Fadd => FPUOp2::Add, |
|
|
(Opcode::Fadd, 64) => FPUOp2::Add64, |
|
|
Opcode::Fsub => FPUOp2::Sub, |
|
|
(Opcode::Fsub, 32) => FPUOp2::Sub32, |
|
|
Opcode::Fmul => FPUOp2::Mul, |
|
|
(Opcode::Fsub, 64) => FPUOp2::Sub64, |
|
|
Opcode::Fdiv => FPUOp2::Div, |
|
|
(Opcode::Fmul, 32) => FPUOp2::Mul32, |
|
|
Opcode::Fmin => FPUOp2::Min, |
|
|
(Opcode::Fmul, 64) => FPUOp2::Mul64, |
|
|
Opcode::Fmax => FPUOp2::Max, |
|
|
(Opcode::Fdiv, 32) => FPUOp2::Div32, |
|
|
_ => unreachable!(), |
|
|
(Opcode::Fdiv, 64) => FPUOp2::Div64, |
|
|
|
|
|
(Opcode::Fmin, 32) => FPUOp2::Min32, |
|
|
|
|
|
(Opcode::Fmin, 64) => FPUOp2::Min64, |
|
|
|
|
|
(Opcode::Fmax, 32) => FPUOp2::Max32, |
|
|
|
|
|
(Opcode::Fmax, 64) => FPUOp2::Max64, |
|
|
|
|
|
_ => { |
|
|
|
|
|
return Err(CodegenError::Unsupported(format!( |
|
|
|
|
|
"{}: Unsupported type: {:?}", |
|
|
|
|
|
op, ty |
|
|
|
|
|
))) |
|
|
|
|
|
} |
|
|
|
|
|
}; |
|
|
}; |
|
|
ctx.emit(Inst::FpuRRR { fpu_op, rd, rn, rm }); |
|
|
ctx.emit(Inst::FpuRRR { |
|
|
|
|
|
fpu_op, |
|
|
|
|
|
size: ScalarSize::from_ty(ty), |
|
|
|
|
|
rd, |
|
|
|
|
|
rn, |
|
|
|
|
|
rm, |
|
|
|
|
|
}); |
|
|
} else { |
|
|
} else { |
|
|
let alu_op = match op { |
|
|
let alu_op = match op { |
|
|
Opcode::Fadd => VecALUOp::Fadd, |
|
|
Opcode::Fadd => VecALUOp::Fadd, |
|
@ -2149,7 +2143,8 @@ pub(crate) fn lower_insn_to_regs<C: LowerCtx<I = Inst>>( |
|
|
lower_constant_f64(ctx, rtmp1, max); |
|
|
lower_constant_f64(ctx, rtmp1, max); |
|
|
} |
|
|
} |
|
|
ctx.emit(Inst::FpuRRR { |
|
|
ctx.emit(Inst::FpuRRR { |
|
|
fpu_op: choose_32_64(in_ty, FPUOp2::Min32, FPUOp2::Min64), |
|
|
fpu_op: FPUOp2::Min, |
|
|
|
|
|
size: ScalarSize::from_ty(in_ty), |
|
|
rd: rtmp2, |
|
|
rd: rtmp2, |
|
|
rn, |
|
|
rn, |
|
|
rm: rtmp1.to_reg(), |
|
|
rm: rtmp1.to_reg(), |
|
@ -2160,7 +2155,8 @@ pub(crate) fn lower_insn_to_regs<C: LowerCtx<I = Inst>>( |
|
|
lower_constant_f64(ctx, rtmp1, min); |
|
|
lower_constant_f64(ctx, rtmp1, min); |
|
|
} |
|
|
} |
|
|
ctx.emit(Inst::FpuRRR { |
|
|
ctx.emit(Inst::FpuRRR { |
|
|
fpu_op: choose_32_64(in_ty, FPUOp2::Max32, FPUOp2::Max64), |
|
|
fpu_op: FPUOp2::Max, |
|
|
|
|
|
size: ScalarSize::from_ty(in_ty), |
|
|
rd: rtmp2, |
|
|
rd: rtmp2, |
|
|
rn: rtmp2.to_reg(), |
|
|
rn: rtmp2.to_reg(), |
|
|
rm: rtmp1.to_reg(), |
|
|
rm: rtmp1.to_reg(), |
|
|