Browse Source

Merge commit '75cbffc' into bfgminer

Luke Dashjr 13 years ago
parent
commit
2b0cd922c0
5 changed files with 10 additions and 5 deletions
  1. 2 1
      sha256_4way.c
  2. 2 1
      sha256_altivec_4way.c
  3. 2 1
      sha256_sse2_amd64.c
  4. 2 1
      sha256_sse2_i386.c
  5. 2 1
      sha256_sse4_amd64.c

+ 2 - 1
sha256_4way.c

@@ -107,6 +107,7 @@ bool ScanHash_4WaySSE2(struct thr_info*thr, const unsigned char *pmidstate,
 	uint32_t max_nonce, uint32_t *last_nonce,
 	uint32_t nonce)
 {
+	uint32_t *hash32 = (uint32_t *)phash;
     unsigned int *nNonce_p = (unsigned int*)(pdata + 76);
 
 	pdata += 64;
@@ -129,7 +130,7 @@ bool ScanHash_4WaySSE2(struct thr_info*thr, const unsigned char *pmidstate,
                 for (i = 0; i < 32/4; i++)
                     ((unsigned int*)phash)[i] = thash[i][j];
 
-		if (fulltest(phash, ptarget)) {
+		if (unlikely(hash32[7] == 0 && fulltest(phash, ptarget))) {
 					nonce += j;
 					*last_nonce = nonce;
 					*nNonce_p = nonce;

+ 2 - 1
sha256_altivec_4way.c

@@ -80,6 +80,7 @@ bool ScanHash_altivec_4way(struct thr_info*thr, const unsigned char *pmidstate,
 	uint32_t max_nonce, uint32_t *last_nonce,
 	uint32_t nonce)
 {
+	uint32_t *hash32 = (uint32_t *)phash;
     unsigned int *nNonce_p = (unsigned int*)(pdata + 76);
 
 	pdata += 64;
@@ -102,7 +103,7 @@ bool ScanHash_altivec_4way(struct thr_info*thr, const unsigned char *pmidstate,
                 for (i = 0; i < 32/4; i++)
                     ((unsigned int*)phash)[i] = thash[i][j];
 
-		if (fulltest(phash, ptarget)) {
+		if (unlikely(hash32[7] == 0 && fulltest(phash, ptarget))) {
 					nonce += j;
 					*last_nonce = nonce;
 					*nNonce_p = nonce;

+ 2 - 1
sha256_sse2_amd64.c

@@ -55,6 +55,7 @@ bool scanhash_sse2_64(struct thr_info*thr, const unsigned char *pmidstate,
 	uint32_t max_nonce, uint32_t *last_nonce,
 	uint32_t nonce)
 {
+	uint32_t *hash32 = (uint32_t *)phash;
     uint32_t *nNonce_p = (uint32_t *)(pdata + 76);
     uint32_t m_midstate[8], m_w[16], m_w1[16];
     __m128i m_4w[64] __attribute__ ((aligned (0x100)));
@@ -111,7 +112,7 @@ bool scanhash_sse2_64(struct thr_info*thr, const unsigned char *pmidstate,
 		    *(uint32_t *)&(phash)[i*4] = mi.i[j];
 		}
 
-		if (fulltest(phash, ptarget)) {
+		if (unlikely(hash32[7] == 0 && fulltest(phash, ptarget))) {
 		     nonce += j;
 		     *last_nonce = nonce + 1;
 		     *nNonce_p = nonce;

+ 2 - 1
sha256_sse2_i386.c

@@ -55,6 +55,7 @@ bool scanhash_sse2_32(struct thr_info*thr, const unsigned char *pmidstate,
 	uint32_t max_nonce, uint32_t *last_nonce,
 	uint32_t nonce)
 {
+	uint32_t *hash32 = (uint32_t *)phash;
     uint32_t *nNonce_p = (uint32_t *)(pdata + 76);
     uint32_t m_midstate[8], m_w[16], m_w1[16];
     __m128i m_4w[64] __attribute__ ((aligned (0x100)));
@@ -102,7 +103,7 @@ bool scanhash_sse2_32(struct thr_info*thr, const unsigned char *pmidstate,
 		    *(uint32_t *)&(phash)[i<<2] = ((uint32_t *)&(m_4hash[i]))[j];
 		}
 
-		if (fulltest(phash, ptarget)) {
+		if (unlikely(hash32[7] == 0 && fulltest(phash, ptarget))) {
 		     nonce += j;
 		     *last_nonce = nonce;
 		     *nNonce_p = nonce;

+ 2 - 1
sha256_sse4_amd64.c

@@ -54,6 +54,7 @@ bool scanhash_sse4_64(struct thr_info*thr, const unsigned char *pmidstate,
 	uint32_t max_nonce, uint32_t *last_nonce,
 	uint32_t nonce)
 {
+	uint32_t *hash32 = (uint32_t *)phash;
     uint32_t *nNonce_p = (uint32_t *)(pdata + 76);
     uint32_t m_midstate[8], m_w[16], m_w1[16];
     __m128i m_4w[64], m_4hash[64], m_4hash1[64];
@@ -110,7 +111,7 @@ bool scanhash_sse4_64(struct thr_info*thr, const unsigned char *pmidstate,
 		    *(uint32_t *)&(phash)[i*4] = mi.i[j];
 		}
 
-		if (fulltest(phash, ptarget)) {
+		if (unlikely(hash32[7] == 0 && fulltest(phash, ptarget))) {
 			nonce += j;
 			*last_nonce = nonce;
 			*nNonce_p = nonce;