add support for unchecked math
This commit is contained in:
parent
d461555e44
commit
d6266a7666
3 changed files with 42 additions and 0 deletions
|
@ -265,6 +265,12 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
|
||||||
neg(x) => LLVMBuildNeg,
|
neg(x) => LLVMBuildNeg,
|
||||||
fneg(x) => LLVMBuildFNeg,
|
fneg(x) => LLVMBuildFNeg,
|
||||||
not(x) => LLVMBuildNot,
|
not(x) => LLVMBuildNot,
|
||||||
|
unchecked_sadd(x, y) => LLVMBuildNSWAdd,
|
||||||
|
unchecked_uadd(x, y) => LLVMBuildNUWAdd,
|
||||||
|
unchecked_ssub(x, y) => LLVMBuildNSWSub,
|
||||||
|
unchecked_usub(x, y) => LLVMBuildNUWSub,
|
||||||
|
unchecked_smul(x, y) => LLVMBuildNSWMul,
|
||||||
|
unchecked_umul(x, y) => LLVMBuildNUWMul,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn fadd_fast(&mut self, lhs: &'ll Value, rhs: &'ll Value) -> &'ll Value {
|
fn fadd_fast(&mut self, lhs: &'ll Value, rhs: &'ll Value) -> &'ll Value {
|
||||||
|
|
|
@ -1002,6 +1002,36 @@ extern "C" {
|
||||||
RHS: &'a Value,
|
RHS: &'a Value,
|
||||||
Name: *const c_char)
|
Name: *const c_char)
|
||||||
-> &'a Value;
|
-> &'a Value;
|
||||||
|
pub fn LLVMBuildNSWAdd(B: &Builder<'a>,
|
||||||
|
LHS: &'a Value,
|
||||||
|
RHS: &'a Value,
|
||||||
|
Name: *const c_char)
|
||||||
|
-> &'a Value;
|
||||||
|
pub fn LLVMBuildNUWAdd(B: &Builder<'a>,
|
||||||
|
LHS: &'a Value,
|
||||||
|
RHS: &'a Value,
|
||||||
|
Name: *const c_char)
|
||||||
|
-> &'a Value;
|
||||||
|
pub fn LLVMBuildNSWSub(B: &Builder<'a>,
|
||||||
|
LHS: &'a Value,
|
||||||
|
RHS: &'a Value,
|
||||||
|
Name: *const c_char)
|
||||||
|
-> &'a Value;
|
||||||
|
pub fn LLVMBuildNUWSub(B: &Builder<'a>,
|
||||||
|
LHS: &'a Value,
|
||||||
|
RHS: &'a Value,
|
||||||
|
Name: *const c_char)
|
||||||
|
-> &'a Value;
|
||||||
|
pub fn LLVMBuildNSWMul(B: &Builder<'a>,
|
||||||
|
LHS: &'a Value,
|
||||||
|
RHS: &'a Value,
|
||||||
|
Name: *const c_char)
|
||||||
|
-> &'a Value;
|
||||||
|
pub fn LLVMBuildNUWMul(B: &Builder<'a>,
|
||||||
|
LHS: &'a Value,
|
||||||
|
RHS: &'a Value,
|
||||||
|
Name: *const c_char)
|
||||||
|
-> &'a Value;
|
||||||
pub fn LLVMBuildAnd(B: &Builder<'a>,
|
pub fn LLVMBuildAnd(B: &Builder<'a>,
|
||||||
LHS: &'a Value,
|
LHS: &'a Value,
|
||||||
RHS: &'a Value,
|
RHS: &'a Value,
|
||||||
|
|
|
@ -88,6 +88,12 @@ pub trait BuilderMethods<'a, 'tcx: 'a>:
|
||||||
fn shl(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value;
|
fn shl(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value;
|
||||||
fn lshr(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value;
|
fn lshr(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value;
|
||||||
fn ashr(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value;
|
fn ashr(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value;
|
||||||
|
fn unchecked_sadd(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value;
|
||||||
|
fn unchecked_uadd(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value;
|
||||||
|
fn unchecked_ssub(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value;
|
||||||
|
fn unchecked_usub(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value;
|
||||||
|
fn unchecked_smul(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value;
|
||||||
|
fn unchecked_umul(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value;
|
||||||
fn and(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value;
|
fn and(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value;
|
||||||
fn or(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value;
|
fn or(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value;
|
||||||
fn xor(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value;
|
fn xor(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value;
|
||||||
|
|
Loading…
Reference in a new issue