Skip to content

Commit

Permalink
bug: fix abs intrinsic function for llvm codegen (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
martinjrobins authored Dec 9, 2024
1 parent 0657c23 commit f823bf2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/execution/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,7 @@ mod tests {
heaviside_function0: "r { heaviside(-0.1) }" expect "r" vec![0.0],
heaviside_function1: "r { heaviside(0.0) }" expect "r" vec![1.0],
exp_function: "r { exp(2) }" expect "r" vec![f64::exp(2.0)],
abs_function: "r { abs(-2) }" expect "r" vec![f64::abs(-2.0)],
pow_function: "r { pow(4.3245, 0.5) }" expect "r" vec![f64::powf(4.3245, 0.5)],
arcsinh_function: "r { arcsinh(0.5) }" expect "r" vec![f64::asinh(0.5)],
arccosh_function: "r { arccosh(2) }" expect "r" vec![f64::acosh(2.0)],
Expand Down
1 change: 1 addition & 0 deletions src/execution/llvm/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,7 @@ impl<'ctx> CodeGen<'ctx> {
let intrinsic_name = match name {
"min" => "minnum",
"max" => "maxnum",
"abs" => "fabs",
_ => name,
};
let llvm_name = format!("llvm.{}.{}", intrinsic_name, self.real_type_str);
Expand Down

0 comments on commit f823bf2

Please sign in to comment.