diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2021-01-30 13:20:59 +0200 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2021-01-30 16:19:59 +0000 |
commit | f72ee8e742a171db74ed32b54b85953b8dfe1d77 (patch) | |
tree | 80e015f57b8bfc3c0a0fccb6b0d4ef4d602c0a0d /docs/markdown/Simd-module.md | |
parent | 4f8cecca9733588b083dba8488143fa1ffb0e495 (diff) | |
download | meson-f72ee8e742a171db74ed32b54b85953b8dfe1d77.zip meson-f72ee8e742a171db74ed32b54b85953b8dfe1d77.tar.gz meson-f72ee8e742a171db74ed32b54b85953b8dfe1d77.tar.bz2 |
Rewrap long text lines in docs. [skip ci]
Diffstat (limited to 'docs/markdown/Simd-module.md')
-rw-r--r-- | docs/markdown/Simd-module.md | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/docs/markdown/Simd-module.md b/docs/markdown/Simd-module.md index 0fd1dda..29f3e95 100644 --- a/docs/markdown/Simd-module.md +++ b/docs/markdown/Simd-module.md @@ -3,14 +3,15 @@ This module provides helper functionality to build code with SIMD instructions. Available since 0.42.0. -**Note**:Â this module is unstable. It is only provided as a technology preview. -Its API may change in arbitrary ways between releases or it might be removed -from Meson altogether. +**Note**: this module is unstable. It is only provided as a technology +preview. Its API may change in arbitrary ways between releases or it +might be removed from Meson altogether. ## Usage -This module is designed for the use case where you have an algorithm with one -or more SIMD implementation and you choose which one to use at runtime. +This module is designed for the use case where you have an algorithm +with one or more SIMD implementation and you choose which one to use +at runtime. The module provides one method, `check`, which is used like this: @@ -27,20 +28,21 @@ The module provides one method, `check`, which is used like this: neon : 'simd_neon.c', compiler : cc) -Here the individual files contain the accelerated versions of the functions -in question. The `compiler` keyword argument takes the compiler you are -going to use to compile them. The function returns an array with two values. -The first value is a bunch of libraries that contain the compiled code. Any -SIMD code that the compiler can't compile (for example, Neon instructions on -an x86 machine) are ignored. You should pass this value to the desired target -using `link_with`. The second value is a `configuration_data` object that -contains true for all the values that were supported. For example if the -compiler did support sse2 instructions, then the object would have `HAVE_SSE2` -set to 1. +Here the individual files contain the accelerated versions of the +functions in question. The `compiler` keyword argument takes the +compiler you are going to use to compile them. The function returns an +array with two values. The first value is a bunch of libraries that +contain the compiled code. Any SIMD code that the compiler can't +compile (for example, Neon instructions on an x86 machine) are +ignored. You should pass this value to the desired target using +`link_with`. The second value is a `configuration_data` object that +contains true for all the values that were supported. For example if +the compiler did support sse2 instructions, then the object would have +`HAVE_SSE2` set to 1. Generating code to detect the proper instruction set at runtime is -straightforward. First you create a header with the configuration object and -then a chooser function that looks like this: +straightforward. First you create a header with the configuration +object and then a chooser function that looks like this: void (*fptr)(type_of_function_here) = NULL; @@ -61,9 +63,9 @@ then a chooser function that looks like this: fptr = default_function; } -Each source file provides two functions, the `xxx_available` function to query -whether the CPU currently in use supports the instruction set and -`xxx_accelerated_function` that is the corresponding accelerated +Each source file provides two functions, the `xxx_available` function +to query whether the CPU currently in use supports the instruction set +and `xxx_accelerated_function` that is the corresponding accelerated implementation. At the end of this function the function pointer points to the fastest |