|
|
@ -1,6 +1,6 @@ |
|
|
|
// This file is taken and modified from the public-domain poclbm project, and |
|
|
|
// This file is taken and modified from the public-domain poclbm project, and |
|
|
|
// I have therefore decided to keep it public-domain. |
|
|
|
// I have therefore decided to keep it public-domain. |
|
|
|
|
|
|
|
// Modified version copyright 2011-2012 Con Kolivas |
|
|
|
|
|
|
|
|
|
|
|
#ifdef VECTORS4 |
|
|
|
#ifdef VECTORS4 |
|
|
|
typedef uint4 u; |
|
|
|
typedef uint4 u; |
|
|
@ -51,9 +51,6 @@ __constant uint H[8] = { |
|
|
|
#ifdef BITALIGN |
|
|
|
#ifdef BITALIGN |
|
|
|
#pragma OPENCL EXTENSION cl_amd_media_ops : enable |
|
|
|
#pragma OPENCL EXTENSION cl_amd_media_ops : enable |
|
|
|
#define rot(x, y) amd_bitalign(x, x, (uint)(32 - y)) |
|
|
|
#define rot(x, y) amd_bitalign(x, x, (uint)(32 - y)) |
|
|
|
#else |
|
|
|
|
|
|
|
#define rot(x, y) rotate(x, (uint)y) |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// This part is not from the stock poclbm kernel. It's part of an optimization |
|
|
|
// This part is not from the stock poclbm kernel. It's part of an optimization |
|
|
|
// added in the Phoenix Miner. |
|
|
|
// added in the Phoenix Miner. |
|
|
@ -75,13 +72,22 @@ __constant uint H[8] = { |
|
|
|
#define Ch(x, y, z) amd_bytealign(x,y,z) |
|
|
|
#define Ch(x, y, z) amd_bytealign(x,y,z) |
|
|
|
// Ma can also be implemented in terms of BFI_INT... |
|
|
|
// Ma can also be implemented in terms of BFI_INT... |
|
|
|
#define Ma(z, x, y) amd_bytealign(z^x,y,x) |
|
|
|
#define Ma(z, x, y) amd_bytealign(z^x,y,x) |
|
|
|
#else |
|
|
|
#else // BFI_INT |
|
|
|
#define Ch(x, y, z) bitselect(x,y,z) |
|
|
|
// Later SDKs optimise this to BFI INT without patching and GCN |
|
|
|
// Ma can also be implemented in terms of bitselect |
|
|
|
// actually fails if manually patched with BFI_INT |
|
|
|
#define Ma(z, x, y) bitselect(z^x,y,x) |
|
|
|
|
|
|
|
|
|
|
|
#define Ch(x, y, z) bitselect((u)z, (u)y, (u)x) |
|
|
|
|
|
|
|
#define Ma(x, y, z) bitselect((u)x, (u)y, (u)z ^ (u)x) |
|
|
|
|
|
|
|
#define rotr(x, y) amd_bitalign((u)x, (u)x, (u)y) |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
#else // BITALIGN |
|
|
|
|
|
|
|
#define Ch(x, y, z) (z ^ (x & (y ^ z))) |
|
|
|
|
|
|
|
#define Ma(x, y, z) ((x & z) | (y & (x | z))) |
|
|
|
|
|
|
|
#define rotr(x, y) rotate((u)x, (u)(32-y)) |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Various intermediate calculations for each SHA round |
|
|
|
//Various intermediate calculations for each SHA round |
|
|
|
#define s0(n) (S0(Vals[(0 + 128 - (n)) % 8])) |
|
|
|
#define s0(n) (S0(Vals[(0 + 128 - (n)) % 8])) |
|
|
|
#define S0(n) (rot(n, 30u)^rot(n, 19u)^rot(n,10u)) |
|
|
|
#define S0(n) (rot(n, 30u)^rot(n, 19u)^rot(n,10u)) |