[llvm] [docs] Add a brief description of using -fveclib to enable some math library vectorizations (PR #119215)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 9 06:06:29 PST 2024


https://github.com/RKSimon created https://github.com/llvm/llvm-project/pull/119215

Fixes #62283

>From 74f8c7665fbfe4d629fa478636e3bdf40b0d0f97 Mon Sep 17 00:00:00 2001
From: Simon Pilgrim <llvm-dev at redking.me.uk>
Date: Mon, 9 Dec 2024 14:04:40 +0000
Subject: [PATCH] [docs] Add a brief description of using -fveclib to enable
 some math library vectorizations

Fixes #62283
---
 llvm/docs/Vectorizers.rst | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/llvm/docs/Vectorizers.rst b/llvm/docs/Vectorizers.rst
index c2beb1669c4e3b..c0f7a68600a496 100644
--- a/llvm/docs/Vectorizers.rst
+++ b/llvm/docs/Vectorizers.rst
@@ -345,6 +345,18 @@ instruction is available.
       f[i] = floorf(f[i]);
   }
 
+Many of these math functions are only vectorizable if the file has been built
+with a specified target vector library that provides a vector implemention
+of that math function. Using clang, this is handled by the "-fveclib" command
+line option with one of the following vector libraries:
+
+.. code-block:: console
+   accelerate,libmvec,massv,svml,sleef,darwin_libsystem_m,armpl,amdlibm
+
+.. code-block:: console
+
+   $ clang ... -fno-math-errno -fveclib=libmvec file.c
+
 Partial unrolling during vectorization
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 



More information about the llvm-commits mailing list