Repository navigation
Commit 04f3d21
perf: native sse2 trunc for batch<double>
The common trunc is select(abs(x) < maxflint, to_float(to_int(x)), x), so on
sse2 it goes through batch_cast<int64_t>. Adding 2^52 rounds |x| to an integer
in any rounding mode and one conditional decrement turns that into floor, which
needs no conversion at all.
3.743 -> 0.551 ns/element on a 128 KB L2-resident loop (Xeon w5-3435X, gcc 13.3
-O3, min of 300 reps).
Assisted-by: Claude Opus 5 <noreply@anthropic.com>1 parent eb416dd commit 04f3d21
1 file changed
Lines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2259 | 2259 | | |
2260 | 2260 | | |
2261 | 2261 | | |
| 2262 | + | |
| 2263 | + | |
| 2264 | + | |
| 2265 | + | |
| 2266 | + | |
| 2267 | + | |
| 2268 | + | |
| 2269 | + | |
| 2270 | + | |
| 2271 | + | |
| 2272 | + | |
| 2273 | + | |
| 2274 | + | |
| 2275 | + | |
| 2276 | + | |
| 2277 | + | |
| 2278 | + | |
| 2279 | + | |
| 2280 | + | |
| 2281 | + | |
2262 | 2282 | | |
2263 | 2283 | | |
2264 | 2284 | | |
| |||
0 commit comments