Skip to content

Commit

Permalink
Pseudo-intrinsics for ARM: Guard vroti_epi32/64
Browse files Browse the repository at this point in the history
MacOS native (clang) gcc wouldn't allow rotations larger than width
so we simply mask the argument correctly.

Closes #4585
  • Loading branch information
magnumripper committed Mar 8, 2021
1 parent d531f97 commit c9825e6
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 13 deletions.
19 changes: 12 additions & 7 deletions doc/INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -153,16 +153,21 @@ that probably work fine but these instructions are for "Homebrew":

1. Install Homebrew:
http://mxcl.github.io/homebrew/
2. Install Homebrew's gcc and openssl:
2. Install Homebrew's gcc and OpenSSL:
brew install gcc openssl
3. Make sure /usr/local/bin precedes /usr/bin in your $PATH
4. Configure, possibly adding a CC option for pointing to a specific gcc:
./configure CC="gcc-6"
3. Consider adding homebrew directories such as /usr/local/bin and/or
/opt/homebrew/bin to your $PATH.
4. Configure, possibly adding a CC option for pointing to a specific gcc and
using whatever LDFLAGS and CPPFLAGS was recommended when you installed
Homebrew's OpenSSL:
./configure CC="/opt/homebrew/bin/gcc-10" \
LDFLAGS="-L/opt/homebrew/opt/openssl@1.1/lib" \
CPPFLAGS="-I/opt/homebrew/opt/openssl@1.1/include"
5. Clean old files and make:
make -s clean && make -sj4

After the above, you should be able to get an optimal build with AVX and/or
whatever extra features your CPU has got.
After the above, you should be able to get an optimal build with AVX/ASIMD
or whatever extra features your CPU has got.

If you get weird problems including things like "error: unknown type name
'dispatch_block_t'" on 10.10 Yosemite, you might need to apply a patch for
Expand All @@ -171,7 +176,7 @@ From John's "src" directory:

sudo patch -b -N -p0 < unused/Yosemite.patch

The patch is not needed for 10.11 "El Capitan".
The patch is not needed for 10.11 "El Capitan" or later!

NOTE: The above command will create backup files. If you ever want to restore
everything as it were originally:
Expand Down
6 changes: 4 additions & 2 deletions doc/NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,13 @@ Major changes from 1.9.0-jumbo-1 (May 2019) in this bleeding-edge version:
- Final fixes for zip2john selection of 1-byte or 2-byte early-reject checks,
as well as exactly what source to use for that check, after seeing several
issues and digging into the specs. Note that a re-run of zip2john is needed
for correct cracking. [magnum; 2021]
for correct cracking. [magnum; 2021]

- Allow any node range divisible by fork (or MPI) count. [Solar, magnum; 2021]

- Fix autoconf selection of arch.h for Apple M1. [magnum; 2021]
- Fix autoconf selection of arch.h for Apple M1. Improve ARM pseudo-intrinsics
portability (would fail on clang). Allow __ARM_FEATURE_UNALIGNED to set our
ARCH_ALLOWS_UNALIGNED macro. [magnum; 2021]


Major changes from 1.8.0-jumbo-1 (December 2014) to 1.9.0-jumbo-1 (May 2019):
Expand Down
8 changes: 4 additions & 4 deletions src/pseudo_intrinsics.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ typedef union {
#define VLOADU_EMULATED 1
#define vor(x, y) (vtype)vorrq_u32((x).v32, (y).v32)
#define vorn(x, y) (vtype)vornq_u32((x).v32, (y).v32)
#define vroti_epi32(x, i) (i > 0 ? (vtype)vsliq_n_u32(vshrq_n_u32((x).v32, 32 - (i)), (x).v32, i) : \
(vtype)vsriq_n_u32(vshlq_n_u32((x).v32, 32 + (i)), (x).v32, -(i)))
#define vroti_epi64(x, i) (i > 0 ? (vtype)vsliq_n_u64(vshrq_n_u64((x).v64, 64 - (i)), (x).v64, i) : \
(vtype)vsriq_n_u64(vshlq_n_u64((x).v64, 64 + (i)), (x).v64, -(i)))
#define vroti_epi32(x, i) (i > 0 ? (vtype)vsliq_n_u32(vshrq_n_u32((x).v32, 32 - ((i) & 31)), (x).v32, (i) & 31) : \
(vtype)vsriq_n_u32(vshlq_n_u32((x).v32, (32 + (i)) & 31), (x).v32, (-(i)) & 31))
#define vroti_epi64(x, i) (i > 0 ? (vtype)vsliq_n_u64(vshrq_n_u64((x).v64, 64 - ((i) & 63)), (x).v64, (i) & 63) : \
(vtype)vsriq_n_u64(vshlq_n_u64((x).v64, (64 + (i)) & 63), (x).v64, (-(i)) & 63))
#define vroti16_epi32 vroti_epi32
#define vset1_epi32(i) (vtype)vdupq_n_u32(i)
#define vset1_epi64(i) (vtype)vdupq_n_u64(i)
Expand Down

0 comments on commit c9825e6

Please sign in to comment.