Do SIMD XOR, where possible!

master
Kevin Greenan 2013-12-20 08:21:46 -08:00
parent 1733366245
commit c4ab254bbc
4 changed files with 10 additions and 31 deletions

View File

@ -51,9 +51,8 @@ extern int galois_single_multiply(int a, int b, int w);
extern int galois_single_divide(int a, int b, int w);
extern int galois_inverse(int x, int w);
void galois_region_xor( char *r1, /* Region 1 */
char *r2, /* Region 2 */
char *r3, /* Sum region (r3 = r1 ^ r2) -- can be r1 or r2 */
void galois_region_xor( char *src, /* Source Region */
char *dest, /* Dest Region (holds result) */
int nbytes); /* Number of bytes in region */
/* These multiply regions in w=8, w=16 and w=32. They are much faster

View File

@ -324,29 +324,9 @@ void galois_w32_region_xor(void *src, void *dest, int nbytes)
gfp_array[32]->multiply_region.w32(gfp_array[32], src, dest, 1, nbytes, 1);
}
void galois_region_xor(char *r1, /* Region 1 */
char *r2, /* Region 2 */
char *r3, /* Sum region (r3 = r1 ^ r2) -- can be r1 or r2 */
int nbytes) /* Number of bytes in region */
void galois_region_xor(char *src, char *dest, int nbytes)
{
long *l1;
long *l2;
long *l3;
long *ltop;
char *ctop;
ctop = r1 + nbytes;
ltop = (long *) ctop;
l1 = (long *) r1;
l2 = (long *) r2;
l3 = (long *) r3;
while (l1 < ltop) {
*l3 = ((*l1) ^ (*l2));
l1++;
l2++;
l3++;
}
galois_w32_region_xor(src, dest, nbytes);
}
int galois_inverse(int y, int w)

View File

@ -341,7 +341,7 @@ void jerasure_bitmatrix_dotprod(int k, int w, int *bitmatrix_row,
jerasure_total_memcpy_bytes += packetsize;
pstarted = 1;
} else {
galois_region_xor(pptr, dptr, pptr, packetsize);
galois_region_xor(dptr, pptr, packetsize);
jerasure_total_xor_bytes += packetsize;
}
}
@ -360,7 +360,7 @@ void jerasure_do_parity(int k, char **data_ptrs, char *parity_ptr, int size)
jerasure_total_memcpy_bytes += size;
for (i = 1; i < k; i++) {
galois_region_xor(data_ptrs[i], parity_ptr, parity_ptr, size);
galois_region_xor(data_ptrs[i], parity_ptr, size);
jerasure_total_xor_bytes += size;
}
}
@ -599,7 +599,7 @@ void jerasure_matrix_dotprod(int k, int w, int *matrix_row,
jerasure_total_memcpy_bytes += size;
init = 1;
} else {
galois_region_xor(sptr, dptr, dptr, size);
galois_region_xor(sptr, dptr, size);
jerasure_total_xor_bytes += size;
}
}
@ -1173,7 +1173,7 @@ void jerasure_do_scheduled_operations(char **ptrs, int **operations, int packets
operations[op][2],
operations[op][3]);
printf("xor(0x%x, 0x%x -> 0x%x, %d)\n", sptr, dptr, dptr, packetsize); */
galois_region_xor(sptr, dptr, dptr, packetsize);
galois_region_xor(sptr, dptr, packetsize);
jerasure_total_xor_bytes += packetsize;
} else {
/* printf("memcpy(0x%x <- 0x%x)\n", dptr, sptr); */

View File

@ -213,7 +213,7 @@ int reed_sol_r6_encode(int k, int w, char **data_ptrs, char **coding_ptrs, int s
memcpy(coding_ptrs[0], data_ptrs[0], size);
for (i = 1; i < k; i++) galois_region_xor(coding_ptrs[0], data_ptrs[i], coding_ptrs[0], size);
for (i = 1; i < k; i++) galois_region_xor(data_ptrs[i], coding_ptrs[0], size);
/* Next, put the sum of (2^j)*Dj into coding region 1 */
@ -227,7 +227,7 @@ int reed_sol_r6_encode(int k, int w, char **data_ptrs, char **coding_ptrs, int s
default: return 0;
}
galois_region_xor(coding_ptrs[1], data_ptrs[i], coding_ptrs[1], size);
galois_region_xor(data_ptrs[i], coding_ptrs[1], size);
}
return 1;
}