diff --git a/documentation/intrinsics.md b/documentation/intrinsics.md index 32b3f2f..b662893 100644 --- a/documentation/intrinsics.md +++ b/documentation/intrinsics.md @@ -73,6 +73,11 @@ Returns the larger of `a` and `b`. Returns the absolute value of `value`. +#### `::sqrt(value: T) -> T` +*Note: (only on floating-point numbers)* + +Calculates the square-root of `value` + #### `::pow(value: T, exponent: T) -> T` *Note: (only on floating-point numbers)* @@ -113,6 +118,11 @@ Calculates arccosine of `value` Calculates arctangent of `value` +#### `::atan2(value: T) -> T` +*Note: (only on floating-point numbers)* + +Calculates 2-argument arctangent of `value` + #### `::sinh(value: T) -> T` *Note: (only on floating-point numbers)* diff --git a/reid/src/codegen/intrinsics.rs b/reid/src/codegen/intrinsics.rs index 2ec4aa0..74eb203 100644 --- a/reid/src/codegen/intrinsics.rs +++ b/reid/src/codegen/intrinsics.rs @@ -130,6 +130,12 @@ pub fn get_intrinsic_assoc_functions(ty: &TypeKind) -> Vec { }); } if ty.category() == TypeCategory::Real { + intrinsics.push(simple_intrinsic( + "sqrt", + vec!["self"], + ty.clone(), + LLVMIntrinsicKind::Sqrt(ty.clone()), + )); intrinsics.push(simple_intrinsic( "sin", vec!["self"],