Commit 92c281d
pystrhex: Use signed comparison for efficient SIMD codegen
GCC's vector extensions generate inefficient code for unsigned byte
comparison (hi > nine): psubusb + pcmpeqb + pcmpeqb (3 instructions).
By casting to signed bytes before comparison, GCC generates the
efficient pcmpgtb instruction instead. This is safe because nibble
values (0-15) are within signed byte range.
This reduces the SIMD loop from 29 to 25 instructions, matching the
performance of explicit SSE2 intrinsics while keeping the portable
vector extensions approach.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>1 parent e643fb8 commit 92c281d
1 file changed
Lines changed: 17 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
26 | 30 | | |
27 | 31 | | |
28 | 32 | | |
| |||
31 | 35 | | |
32 | 36 | | |
33 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
34 | 44 | | |
35 | 45 | | |
36 | 46 | | |
| |||
39 | 49 | | |
40 | 50 | | |
41 | 51 | | |
42 | | - | |
| 52 | + | |
43 | 53 | | |
44 | 54 | | |
45 | 55 | | |
| |||
53 | 63 | | |
54 | 64 | | |
55 | 65 | | |
56 | | - | |
57 | | - | |
58 | | - | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
59 | 72 | | |
60 | 73 | | |
61 | 74 | | |
| |||
0 commit comments