forked from M-Labs/nac3
1
0
Fork 0

implement division

This commit is contained in:
Sebastien Bourdeauducq 2020-03-30 12:34:38 +08:00
parent 056b9631a0
commit c5efa615a2
1 changed files with 5 additions and 0 deletions

View File

@ -222,6 +222,11 @@ impl<'ctx> CodeGen<'ctx> {
=> Ok(self.builder.build_float_sub(a, b, "tmpsub").into()),
(Mult, values::BasicValueEnum::FloatValue(a), values::BasicValueEnum::FloatValue(b))
=> Ok(self.builder.build_float_mul(a, b, "tmpmul").into()),
(Div, values::BasicValueEnum::FloatValue(a), values::BasicValueEnum::FloatValue(b))
=> Ok(self.builder.build_float_div(a, b, "tmpdiv").into()),
(FloorDiv, values::BasicValueEnum::IntValue(a), values::BasicValueEnum::IntValue(b))
=> Ok(self.builder.build_int_signed_div(a, b, "tmpdiv").into()),
_ => return Err(self.compile_error(CompileErrorKind::Unsupported("unimplemented operation"))),
}
},