/* * DiabloMiner - OpenCL miner for BitCoin * Copyright (C) 2010, 2011, 2012 Patrick McFarland * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more detail). * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifdef VECTORS4 typedef uint4 z; #elif defined(VECTORS2) typedef uint2 z; #else typedef uint z; #endif #ifdef BITALIGN #pragma OPENCL EXTENSION cl_amd_media_ops : enable #define Zrotr(a, b) amd_bitalign((z)a, (z)a, (z)(32 - b)) #else #define Zrotr(a, b) rotate((z)a, (z)b) #endif #ifdef BFI_INT #define ZCh(a, b, c) amd_bytealign(a, b, c) #define ZMa(a, b, c) amd_bytealign((c ^ a), (b), (a)) #else #define ZCh(a, b, c) bitselect((z)c, (z)b, (z)a) #define ZMa(a, b, c) bitselect((z)a, (z)b, (z)c ^ (z)a) #endif #define ZR25(n) ((Zrotr((n), 25) ^ Zrotr((n), 14) ^ ((n) >> 3U))) #define ZR15(n) ((Zrotr((n), 15) ^ Zrotr((n), 13) ^ ((n) >> 10U))) #define ZR26(n) ((Zrotr((n), 26) ^ Zrotr((n), 21) ^ Zrotr((n), 7))) #define ZR30(n) ((Zrotr((n), 30) ^ Zrotr((n), 19) ^ Zrotr((n), 10))) __kernel __attribute__((reqd_work_group_size(WORKSIZE, 1, 1))) void search( const z base, const uint PreVal4_state0, const uint PreVal4_state0_k7, const uint PreVal4_T1, const uint W18, const uint W19, const uint W16, const uint W17, const uint W16_plus_K16, const uint W17_plus_K17, const uint W31, const uint W32, const uint d1, const uint b1, const uint c1, const uint h1, const uint f1, const uint g1, const uint c1_plus_k5, const uint b1_plus_k6, const uint state0, const uint state1, const uint state2, const uint state3, const uint state4, const uint state5, const uint state6, const uint state7, __global uint * output) { z ZA[25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A[2]); ZA[19]+=ZCh(ZA[3],ZA[22],ZA[16])+ZA[4]+0x5b9cca4fU+ZR26(ZA[3]); ZA[13]+=ZR15(ZA[4])+ZA[5]+ZR25(ZA[15]); ZA[4]=ZA[8]+ZA[19]; ZA[5]=ZA[24]+ZMa(ZA[2],ZA[8],ZA[7])+ZR30(ZA[7]); ZA[16]+=ZCh(ZA[4],ZA[3],ZA[22])+ZA[9]+0x682e6ff3U+ZR26(ZA[4]); ZA[12]+=ZR15(ZA[9])+ZR25(ZA[10])+ZA[15]; ZA[15]=ZA[2]+ZA[16]; ZA[9]=ZA[19]+ZMa(ZA[7],ZA[2],ZA[5])+ZR30(ZA[5]); ZA[22]+=ZCh(ZA[15],ZA[4],ZA[3])+ZA[13]+0x748f82eeU+ZR26(ZA[15]); ZA[13]=ZR15(ZA[13])+ZA[1]+ZR25(ZA[11])+ZA[10]; ZA[10]=ZA[7]+ZA[22]; ZA[1]=ZA[16]+ZMa(ZA[5],ZA[7],ZA[9])+ZR30(ZA[9]); ZA[3]+=ZCh(ZA[10],ZA[15],ZA[4])+ZA[5]+ZA[12]+0x78a5636fU+ZR26(ZA[10]); ZA[4]+=ZCh(ZA[3],ZA[10],ZA[15])+ZA[9]+ZA[13]+0x84c87814U+ZR26(ZA[3]); ZA[15]+=ZCh(ZA[4],ZA[3],ZA[10])+ZA[1]+ZR15(ZA[12])+ZA[0]+ZR25(ZA[6])+ZA[11]+0x8cc70208U+ZR26(ZA[4]); #define FOUND (0x80) #define NFLAG (0x7F) #if defined(VECTORS2) || defined(VECTORS4) ZA[10]+=(ZCh(ZA[15],ZA[4],ZA[3])+ZA[22]+ZMa(ZA[9],ZA[5],ZA[1])+ZR30(ZA[1])+ZR15(ZA[13])+ZA[17]+ZR25(ZA[14])+ZA[6])+ZR26(ZA[15])-0x136032EDU; bool result = any(!ZA[10]); if (result) { if (!ZA[10].x) output[FOUND] = output[NFLAG & Znonce.x] = Znonce.x; if (!ZA[10].y) output[FOUND] = output[NFLAG & Znonce.y] = Znonce.y; #if defined(VECTORS4) if (!ZA[10].z) output[FOUND] = output[NFLAG & Znonce.z] = Znonce.z; if (!ZA[10].w) output[FOUND] = output[NFLAG & Znonce.w] = Znonce.w; #endif } #elif defined(VECTORS2) bool result = any(!ZA[10]); if (result) { if (!ZA[10].x) output[FOUND] = output[NFLAG & Znonce.x] = Znonce.x; if (!ZA[10].y) output[FOUND] = output[NFLAG & Znonce.y] = Znonce.y; } #else if (ZA[10]+(ZCh(ZA[15],ZA[4],ZA[3])+ZA[22]+ZMa(ZA[9],ZA[5],ZA[1])+ ZR30(ZA[1])+ZR15(ZA[13])+ZA[17]+ZR25(ZA[14])+ZA[6])+ZR26(ZA[15]) == 0x136032EDU) output[FOUND] = output[NFLAG & Znonce] = Znonce; #endif }