From: Jens Steube Date: Sat, 6 Feb 2016 09:40:51 +0000 (+0100) Subject: Converted to new SIMD: -m 6100 -a 0 X-Git-Tag: v3.00-beta~329 X-Git-Url: https://www.flypig.org.uk/git/?a=commitdiff_plain;h=915a315e5609179c0b938386b3ab8934bba0701e;p=hashcat.git Converted to new SIMD: -m 6100 -a 0 --- diff --git a/OpenCL/m06100_a0.cl b/OpenCL/m06100_a0.cl index bb58cbd..9856498 100644 --- a/OpenCL/m06100_a0.cl +++ b/OpenCL/m06100_a0.cl @@ -7,6 +7,8 @@ #define _WHIRLPOOL_ +#define NEW_SIMD_CODE + #include "include/constants.h" #include "include/kernel_vendor.h" @@ -20,9 +22,7 @@ #include "OpenCL/common.c" #include "include/rp_kernel.h" #include "OpenCL/rp.c" - -#define COMPARE_S "OpenCL/check_single_comp4.c" -#define COMPARE_M "OpenCL/check_multi_comp4.c" +#include "OpenCL/simd.c" #define R 10 @@ -1132,10 +1132,10 @@ __constant u32 rcl[R + 1] = // this is a highly optimized that assumes dgst[16] = { 0 }; only reuse of no 2nd transform is needed -static void whirlpool_transform (const u32 w[16], u32 dgst[16], __local u32 (*s_Ch)[256], __local u32 (*s_Cl)[256]) +static void whirlpool_transform (const u32x w[16], u32x dgst[16], __local u32 (*s_Ch)[256], __local u32 (*s_Cl)[256]) { - u32 Kh[8]; - u32 Kl[8]; + u32x Kh[8]; + u32x Kl[8]; Kh[0] = 0x300beec0; Kl[0] = 0xaf902967; @@ -1154,8 +1154,8 @@ static void whirlpool_transform (const u32 w[16], u32 dgst[16], __local u32 (*s_ Kh[7] = 0x28282828; Kl[7] = 0x28282828; - u32 stateh[8]; - u32 statel[8]; + u32x stateh[8]; + u32x statel[8]; stateh[0] = w[ 0]; statel[0] = w[ 1]; @@ -1174,20 +1174,20 @@ static void whirlpool_transform (const u32 w[16], u32 dgst[16], __local u32 (*s_ stateh[7] = w[14]; statel[7] = w[15]; - u32 Lh[8]; - u32 Ll[8]; + u32x Lh[8]; + u32x Ll[8]; #pragma unroll for (int i = 0; i < 8; i++) { - const u32 Lp0 = stateh[(i + 8) & 7] >> 24; - const u32 Lp1 = stateh[(i + 7) & 7] >> 16; - const u32 Lp2 = stateh[(i + 6) & 7] >> 8; - const u32 Lp3 = stateh[(i + 5) & 7] >> 0; - const u32 Lp4 = statel[(i + 4) & 7] >> 24; - const u32 Lp5 = statel[(i + 3) & 7] >> 16; - const u32 Lp6 = statel[(i + 2) & 7] >> 8; - const u32 Lp7 = statel[(i + 1) & 7] >> 0; + const u32x Lp0 = stateh[(i + 8) & 7] >> 24; + const u32x Lp1 = stateh[(i + 7) & 7] >> 16; + const u32x Lp2 = stateh[(i + 6) & 7] >> 8; + const u32x Lp3 = stateh[(i + 5) & 7] >> 0; + const u32x Lp4 = statel[(i + 4) & 7] >> 24; + const u32x Lp5 = statel[(i + 3) & 7] >> 16; + const u32x Lp6 = statel[(i + 2) & 7] >> 8; + const u32x Lp7 = statel[(i + 1) & 7] >> 0; Lh[i] = BOX (s_Ch, 0, Lp0 & 0xff) ^ BOX (s_Ch, 1, Lp1 & 0xff) @@ -1227,20 +1227,20 @@ static void whirlpool_transform (const u32 w[16], u32 dgst[16], __local u32 (*s_ for (int r = 2; r <= R; r++) { - u32 Lh[8]; - u32 Ll[8]; + u32x Lh[8]; + u32x Ll[8]; #pragma unroll for (int i = 0; i < 8; i++) { - const u32 Lp0 = Kh[(i + 8) & 7] >> 24; - const u32 Lp1 = Kh[(i + 7) & 7] >> 16; - const u32 Lp2 = Kh[(i + 6) & 7] >> 8; - const u32 Lp3 = Kh[(i + 5) & 7] >> 0; - const u32 Lp4 = Kl[(i + 4) & 7] >> 24; - const u32 Lp5 = Kl[(i + 3) & 7] >> 16; - const u32 Lp6 = Kl[(i + 2) & 7] >> 8; - const u32 Lp7 = Kl[(i + 1) & 7] >> 0; + const u32x Lp0 = Kh[(i + 8) & 7] >> 24; + const u32x Lp1 = Kh[(i + 7) & 7] >> 16; + const u32x Lp2 = Kh[(i + 6) & 7] >> 8; + const u32x Lp3 = Kh[(i + 5) & 7] >> 0; + const u32x Lp4 = Kl[(i + 4) & 7] >> 24; + const u32x Lp5 = Kl[(i + 3) & 7] >> 16; + const u32x Lp6 = Kl[(i + 2) & 7] >> 8; + const u32x Lp7 = Kl[(i + 1) & 7] >> 0; Lh[i] = BOX (s_Ch, 0, Lp0 & 0xff) ^ BOX (s_Ch, 1, Lp1 & 0xff) @@ -1281,14 +1281,14 @@ static void whirlpool_transform (const u32 w[16], u32 dgst[16], __local u32 (*s_ #pragma unroll 8 for (int i = 0; i < 8; i++) { - const u32 Lp0 = stateh[(i + 8) & 7] >> 24; - const u32 Lp1 = stateh[(i + 7) & 7] >> 16; - const u32 Lp2 = stateh[(i + 6) & 7] >> 8; - const u32 Lp3 = stateh[(i + 5) & 7] >> 0; - const u32 Lp4 = statel[(i + 4) & 7] >> 24; - const u32 Lp5 = statel[(i + 3) & 7] >> 16; - const u32 Lp6 = statel[(i + 2) & 7] >> 8; - const u32 Lp7 = statel[(i + 1) & 7] >> 0; + const u32x Lp0 = stateh[(i + 8) & 7] >> 24; + const u32x Lp1 = stateh[(i + 7) & 7] >> 16; + const u32x Lp2 = stateh[(i + 6) & 7] >> 8; + const u32x Lp3 = stateh[(i + 5) & 7] >> 0; + const u32x Lp4 = statel[(i + 4) & 7] >> 24; + const u32x Lp5 = statel[(i + 3) & 7] >> 16; + const u32x Lp6 = statel[(i + 2) & 7] >> 8; + const u32x Lp7 = statel[(i + 1) & 7] >> 0; Lh[i] = BOX (s_Ch, 0, Lp0 & 0xff) ^ BOX (s_Ch, 1, Lp1 & 0xff) @@ -1411,41 +1411,18 @@ __kernel void m06100_m04 (__global pw_t *pws, __global kernel_rule_t *rules_buf, * loop */ - for (u32 il_pos = 0; il_pos < rules_cnt; il_pos++) + for (u32 il_pos = 0; il_pos < rules_cnt; il_pos += VECT_SIZE) { - u32 w0[4]; - - w0[0] = pw_buf0[0]; - w0[1] = pw_buf0[1]; - w0[2] = pw_buf0[2]; - w0[3] = pw_buf0[3]; - - u32 w1[4]; - - w1[0] = pw_buf1[0]; - w1[1] = pw_buf1[1]; - w1[2] = pw_buf1[2]; - w1[3] = pw_buf1[3]; - - u32 w2[4]; - - w2[0] = 0; - w2[1] = 0; - w2[2] = 0; - w2[3] = 0; - - u32 w3[4]; - - w3[0] = 0; - w3[1] = 0; - w3[2] = 0; - w3[3] = 0; + u32x w0[4] = { 0 }; + u32x w1[4] = { 0 }; + u32x w2[4] = { 0 }; + u32x w3[4] = { 0 }; - const u32 out_len = apply_rules (rules_buf[il_pos].cmds, w0, w1, pw_len); + const u32 out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1); append_0x80_2x4 (w0, w1, out_len); - u32 wl[16]; + u32x wl[16]; wl[ 0] = swap32 (w0[0]); wl[ 1] = swap32 (w0[1]); @@ -1464,7 +1441,7 @@ __kernel void m06100_m04 (__global pw_t *pws, __global kernel_rule_t *rules_buf, wl[14] = 0; wl[15] = out_len * 8; - u32 dgst[16]; + u32x dgst[16]; dgst[ 0] = 0; dgst[ 1] = 0; @@ -1485,12 +1462,7 @@ __kernel void m06100_m04 (__global pw_t *pws, __global kernel_rule_t *rules_buf, whirlpool_transform (wl, dgst, s_Ch, s_Cl); - const u32 r0 = dgst[0]; - const u32 r1 = dgst[1]; - const u32 r2 = dgst[2]; - const u32 r3 = dgst[3]; - - #include COMPARE_M + COMPARE_M_SIMD (dgst[0], dgst[1], dgst[2], dgst[3]); } } @@ -1580,41 +1552,18 @@ __kernel void m06100_s04 (__global pw_t *pws, __global kernel_rule_t *rules_buf, * loop */ - for (u32 il_pos = 0; il_pos < rules_cnt; il_pos++) + for (u32 il_pos = 0; il_pos < rules_cnt; il_pos += VECT_SIZE) { - u32 w0[4]; - - w0[0] = pw_buf0[0]; - w0[1] = pw_buf0[1]; - w0[2] = pw_buf0[2]; - w0[3] = pw_buf0[3]; - - u32 w1[4]; - - w1[0] = pw_buf1[0]; - w1[1] = pw_buf1[1]; - w1[2] = pw_buf1[2]; - w1[3] = pw_buf1[3]; - - u32 w2[4]; + u32x w0[4] = { 0 }; + u32x w1[4] = { 0 }; + u32x w2[4] = { 0 }; + u32x w3[4] = { 0 }; - w2[0] = 0; - w2[1] = 0; - w2[2] = 0; - w2[3] = 0; - - u32 w3[4]; - - w3[0] = 0; - w3[1] = 0; - w3[2] = 0; - w3[3] = 0; - - const u32 out_len = apply_rules (rules_buf[il_pos].cmds, w0, w1, pw_len); + const u32 out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1); append_0x80_2x4 (w0, w1, out_len); - u32 wl[16]; + u32x wl[16]; wl[ 0] = swap32 (w0[0]); wl[ 1] = swap32 (w0[1]); @@ -1633,7 +1582,7 @@ __kernel void m06100_s04 (__global pw_t *pws, __global kernel_rule_t *rules_buf, wl[14] = 0; wl[15] = out_len * 8; - u32 dgst[16]; + u32x dgst[16]; dgst[ 0] = 0; dgst[ 1] = 0; @@ -1654,12 +1603,7 @@ __kernel void m06100_s04 (__global pw_t *pws, __global kernel_rule_t *rules_buf, whirlpool_transform (wl, dgst, s_Ch, s_Cl); - const u32 r0 = dgst[0]; - const u32 r1 = dgst[1]; - const u32 r2 = dgst[2]; - const u32 r3 = dgst[3]; - - #include COMPARE_S + COMPARE_S_SIMD (dgst[0], dgst[1], dgst[2], dgst[3]); } }