about summary refs log tree commit diff
path: root/library/compiler-builtins/libm/src/math/sqrtf.rs
diff options
context:
space:
mode:
Diffstat (limited to 'library/compiler-builtins/libm/src/math/sqrtf.rs')
-rw-r--r--library/compiler-builtins/libm/src/math/sqrtf.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/library/compiler-builtins/libm/src/math/sqrtf.rs b/library/compiler-builtins/libm/src/math/sqrtf.rs
new file mode 100644
index 00000000000..c28a705e378
--- /dev/null
+++ b/library/compiler-builtins/libm/src/math/sqrtf.rs
@@ -0,0 +1,15 @@
+/// The square root of `x` (f32).
+#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
+pub fn sqrtf(x: f32) -> f32 {
+    select_implementation! {
+        name: sqrtf,
+        use_arch: any(
+            all(target_arch = "aarch64", target_feature = "neon"),
+            all(target_arch = "wasm32", intrinsics_enabled),
+            target_feature = "sse2"
+        ),
+        args: x,
+    }
+
+    super::generic::sqrt(x)
+}