You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+47Lines changed: 47 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -152,6 +152,53 @@ It may be necessary to set the CXX variable. The project is installable (`make i
152
152
153
153
To create project files for Microsoft Visual Studio, it might be useful to target 64-bit Windows (e.g., see http://www.cmake.org/cmake/help/v3.0/generator/Visual%20Studio%2012%202013.html).
154
154
155
+
### CMake Options
156
+
157
+
#### FASTPFOR_SIMD_MODE
158
+
159
+
Controls how SIMD instructions are compiled. This affects portability and performance:
160
+
161
+
| Mode | Flag | Description |
162
+
|------|------|-------------|
163
+
|`portable`|`-msse4.2`|**Default.** Compiles with SSE4.2 baseline only. Binaries will run on any x86-64 CPU from ~2008 onwards. Best for distributable libraries and CI builds. |
164
+
|`native`|`-march=native`| Compiles with all SIMD instructions supported by the build machine (may include AVX, AVX2, AVX-512, etc.). Maximum performance but binaries may crash with `SIGILL` on CPUs that lack the required instructions. |
165
+
|`runtime`|`-msse4.2` + `FASTPFOR_RUNTIME_DISPATCH`| Experimental. Intended for future runtime CPU dispatch using function multi-versioning. |
166
+
167
+
**Usage:**
168
+
169
+
```bash
170
+
# Portable build (default) - safe for distribution
171
+
cmake -B build -DFASTPFOR_SIMD_MODE=portable
172
+
173
+
# Native build - maximum performance on build machine
174
+
cmake -B build -DFASTPFOR_SIMD_MODE=native
175
+
176
+
# Check which mode is active in CMake output
177
+
cmake -B build
178
+
# Look for: "FASTPFOR_SIMD_MODE: portable" in the output
179
+
```
180
+
181
+
**When to use each mode:**
182
+
183
+
- Use `portable` (default) when building binaries that will run on different machines, in CI/CD pipelines, or when distributing pre-built libraries.
184
+
- Use `native` when building for a specific machine where maximum performance is needed and you know the binary won't be moved to a different CPU.
185
+
186
+
#### FASTPFOR_SANITIZE
187
+
188
+
Enable address sanitizer for debugging memory issues:
0 commit comments