From cbf0fcc8b7e95f6b4e2bc797371f63fe53fe74fd Mon Sep 17 00:00:00 2001 From: DRC Date: Tue, 5 Nov 2019 11:56:06 -0600 Subject: [PATCH] i386 SSE2 Huffman: Fix pointer arithmetic issue Splitting the pointer arithmetic in GET_SYM() into a separate add and sub instruction was an attempt to work around an error ("invalid operand type") that occurred when assembling the file with NASM. However, this created a link error on macOS ("ld: illegal text-relocation to '_jconst_huff_encode_one_block' in simd/CMakeFiles/simd.dir/i386/jchuff-sse2.asm.o from '_jsimd_huff_encode_one_block_sse2' in simd/CMakeFiles/simd.dir/i386/jchuff-sse2.asm.o for architecture i386") and also changed the alignment of the code in ways that might have affected the previous benchmark results (which took a great deal of time to obtain.) Ultimately, the path of least resistance is just to require NASM 2.13 or later. --- BUILDING.md | 5 +---- simd/i386/jchuff-sse2.asm | 3 +-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/BUILDING.md b/BUILDING.md index 24e74fd0..24dd2d28 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -12,10 +12,7 @@ Build Requirements - [NASM](http://www.nasm.us) or [YASM](http://yasm.tortall.net) (if building x86 or x86-64 SIMD extensions) - * If using NASM, 2.10 or later is required. - * If using NASM, 2.10 or later (except 2.11.08) is required for an x86-64 Mac - build (2.11.08 does not work properly with libjpeg-turbo's x86-64 SIMD code - when building macho64 objects.) + * If using NASM, 2.13 or later is required. * If using YASM, 1.2.0 or later is required. * If building on macOS, NASM or YASM can be obtained from [MacPorts](http://www.macports.org/) or [Homebrew](http://brew.sh/). diff --git a/simd/i386/jchuff-sse2.asm b/simd/i386/jchuff-sse2.asm index 342cc437..28fdb4de 100644 --- a/simd/i386/jchuff-sse2.asm +++ b/simd/i386/jchuff-sse2.asm @@ -252,8 +252,7 @@ times 1 << 14 db 15 call %%.geteip %%.ref: %4 - add %1, %2 - sub %1, %%.ref + add %1, %2 - %%.ref jmp short %%.done align 32 %%.geteip: