diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2018-05-13 11:21:52 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2018-05-15 17:09:01 +0000 |
commit | 6e2ad0c79ca85bd4a6ca46c3862fcb0df736449b (patch) | |
tree | aaae99c083c3e88061a4cfad2f3dfa1042ddb072 /src/printsupport | |
parent | 85278a69707ec85db28e9a1b11d708ab550592ce (diff) |
ucstrncmp: refactor with 32- and 8-byte loads
First of all, this removes the UB that used to try and calculate the
distance between the two strings. That's a valid technique in assembly,
but dangerous in C++ and totally unnecessary. The compiler is perfectly
able to generate loops with a single induction variable all on its own.
Second, this commit makes the main loop use 32-byte comparisons (16
characters at a time), which is a reasonable size for strings. We use
AVX2 if that's available, or an unrolled pair of 16-byte loads
otherwise. After the existing 16-byte comparison, this commit inserts an
8-byte (4-character) comparison and then reduces the final, unrolled
comparison to just 3 characters.
Change-Id: Ib48364abee9f464c96c6fffd152e474b39e1f293
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/printsupport')
0 files changed, 0 insertions, 0 deletions