Add support for printing functions selected in gf_init

There is currently no way to figure out which functions were selected
during gf_init and as a result of SIMD options. This is not even possible
in gdb since most functions are static.

This commit adds a new macro SET_FUNCTION that records the name of the
function selected during init inside the gf_internal structure. This macro
only works when DEBUG_FUNCTIONS is defined during compile. Otherwise the
code works exactly as it did before this change.

The names of selected functions will be used during testing of SIMD
runtime detection.

All calls such as:

gf->multiply.w32 = gf_w16_shift_multiply;

need to be replaced with the following:

SET_FUNCTION(gf,multiply,w32,gf_w16_shift_multiply)

Also added a new flag to tools/gf_methods that will print the names of
functions selected during gf_init.
master
Bassam Tabbara 2016-09-02 17:19:04 -07:00
parent 22352ca094
commit 87f0d4395d
14 changed files with 420 additions and 386 deletions

View File

@ -30,8 +30,24 @@ typedef struct {
int arg2; int arg2;
gf_t *base_gf; gf_t *base_gf;
void *private; void *private;
#ifdef DEBUG_FUNCTIONS
const char *multiply;
const char *divide;
const char *inverse;
const char *multiply_region;
const char *extract_word;
#endif
} gf_internal_t; } gf_internal_t;
#ifdef DEBUG_FUNCTIONS
#define SET_FUNCTION(gf,method,size,func) \
{ (gf)->method.size = (func); \
((gf_internal_t*)(gf)->scratch)->method = #func; }
#else
#define SET_FUNCTION(gf,method,size,func) \
(gf)->method.size = (func);
#endif
extern int gf_w4_init (gf_t *gf); extern int gf_w4_init (gf_t *gf);
extern int gf_w4_scratch_size(int mult_type, int region_type, int divide_type, int arg1, int arg2); extern int gf_w4_scratch_size(int mult_type, int region_type, int divide_type, int arg1, int arg2);

View File

@ -1405,14 +1405,14 @@ int gf_w128_composite_init(gf_t *gf)
gf_internal_t *h = (gf_internal_t *) gf->scratch; gf_internal_t *h = (gf_internal_t *) gf->scratch;
if (h->region_type & GF_REGION_ALTMAP) { if (h->region_type & GF_REGION_ALTMAP) {
gf->multiply_region.w128 = gf_w128_composite_multiply_region_alt; SET_FUNCTION(gf,multiply_region,w128,gf_w128_composite_multiply_region_alt)
} else { } else {
gf->multiply_region.w128 = gf_w128_composite_multiply_region; SET_FUNCTION(gf,multiply_region,w128,gf_w128_composite_multiply_region)
} }
gf->multiply.w128 = gf_w128_composite_multiply; SET_FUNCTION(gf,multiply,w128,gf_w128_composite_multiply)
gf->divide.w128 = gf_w128_divide_from_inverse; SET_FUNCTION(gf,divide,w128,gf_w128_divide_from_inverse)
gf->inverse.w128 = gf_w128_composite_inverse; SET_FUNCTION(gf,inverse,w128,gf_w128_composite_inverse)
return 1; return 1;
} }
@ -1421,9 +1421,9 @@ static
int gf_w128_cfm_init(gf_t *gf) int gf_w128_cfm_init(gf_t *gf)
{ {
#if defined(INTEL_SSE4_PCLMUL) #if defined(INTEL_SSE4_PCLMUL)
gf->inverse.w128 = gf_w128_euclid; SET_FUNCTION(gf,inverse,w128,gf_w128_euclid)
gf->multiply.w128 = gf_w128_clm_multiply; SET_FUNCTION(gf,multiply,w128,gf_w128_clm_multiply)
gf->multiply_region.w128 = gf_w128_clm_multiply_region_from_single; SET_FUNCTION(gf,multiply_region,w128,gf_w128_clm_multiply_region_from_single)
return 1; return 1;
#endif #endif
@ -1433,9 +1433,9 @@ int gf_w128_cfm_init(gf_t *gf)
static static
int gf_w128_shift_init(gf_t *gf) int gf_w128_shift_init(gf_t *gf)
{ {
gf->multiply.w128 = gf_w128_shift_multiply; SET_FUNCTION(gf,multiply,w128,gf_w128_shift_multiply)
gf->inverse.w128 = gf_w128_euclid; SET_FUNCTION(gf,inverse,w128,gf_w128_euclid)
gf->multiply_region.w128 = gf_w128_multiply_region_from_single; SET_FUNCTION(gf,multiply_region,w128,gf_w128_multiply_region_from_single)
return 1; return 1;
} }
@ -1446,16 +1446,16 @@ int gf_w128_bytwo_init(gf_t *gf)
h = (gf_internal_t *) gf->scratch; h = (gf_internal_t *) gf->scratch;
if (h->mult_type == GF_MULT_BYTWO_p) { if (h->mult_type == GF_MULT_BYTWO_p) {
gf->multiply.w128 = gf_w128_bytwo_p_multiply; SET_FUNCTION(gf,multiply,w128,gf_w128_bytwo_p_multiply)
/*gf->multiply.w128 = gf_w128_sse_bytwo_p_multiply;*/ /*SET_FUNCTION(gf,multiply,w128,gf_w128_sse_bytwo_p_multiply)*/
/* John: the sse function is slower.*/ /* John: the sse function is slower.*/
} else { } else {
gf->multiply.w128 = gf_w128_bytwo_b_multiply; SET_FUNCTION(gf,multiply,w128,gf_w128_bytwo_b_multiply)
/*gf->multiply.w128 = gf_w128_sse_bytwo_b_multiply; /*SET_FUNCTION(gf,multiply,w128,gf_w128_sse_bytwo_b_multiply)
Ben: This sse function is also slower. */ Ben: This sse function is also slower. */
} }
gf->inverse.w128 = gf_w128_euclid; SET_FUNCTION(gf,inverse,w128,gf_w128_euclid)
gf->multiply_region.w128 = gf_w128_bytwo_b_multiply_region; SET_FUNCTION(gf,multiply_region,w128,gf_w128_bytwo_b_multiply_region)
return 1; return 1;
} }
@ -1525,20 +1525,20 @@ int gf_w128_split_init(gf_t *gf)
h = (gf_internal_t *) gf->scratch; h = (gf_internal_t *) gf->scratch;
gf->multiply.w128 = gf_w128_bytwo_p_multiply; SET_FUNCTION(gf,multiply,w128,gf_w128_bytwo_p_multiply)
#if defined(INTEL_SSE4_PCLMUL) #if defined(INTEL_SSE4_PCLMUL)
if (!(h->region_type & GF_REGION_NOSIMD)){ if (!(h->region_type & GF_REGION_NOSIMD)){
gf->multiply.w128 = gf_w128_clm_multiply; SET_FUNCTION(gf,multiply,w128,gf_w128_clm_multiply)
} }
#endif #endif
gf->inverse.w128 = gf_w128_euclid; SET_FUNCTION(gf,inverse,w128,gf_w128_euclid)
if ((h->arg1 != 4 && h->arg2 != 4) || h->mult_type == GF_MULT_DEFAULT) { if ((h->arg1 != 4 && h->arg2 != 4) || h->mult_type == GF_MULT_DEFAULT) {
sd8 = (struct gf_w128_split_8_128_data *) h->private; sd8 = (struct gf_w128_split_8_128_data *) h->private;
sd8->last_value[0] = 0; sd8->last_value[0] = 0;
sd8->last_value[1] = 0; sd8->last_value[1] = 0;
gf->multiply_region.w128 = gf_w128_split_8_128_multiply_region; SET_FUNCTION(gf,multiply_region,w128,gf_w128_split_8_128_multiply_region)
} else { } else {
sd4 = (struct gf_w128_split_4_128_data *) h->private; sd4 = (struct gf_w128_split_4_128_data *) h->private;
sd4->last_value[0] = 0; sd4->last_value[0] = 0;
@ -1547,7 +1547,7 @@ int gf_w128_split_init(gf_t *gf)
{ {
#ifdef INTEL_SSE4 #ifdef INTEL_SSE4
if(!(h->region_type & GF_REGION_NOSIMD)) if(!(h->region_type & GF_REGION_NOSIMD))
gf->multiply_region.w128 = gf_w128_split_4_128_sse_altmap_multiply_region; SET_FUNCTION(gf,multiply_region,w128,gf_w128_split_4_128_sse_altmap_multiply_region)
else else
return 0; return 0;
#else #else
@ -1557,11 +1557,11 @@ int gf_w128_split_init(gf_t *gf)
else { else {
#ifdef INTEL_SSE4 #ifdef INTEL_SSE4
if(!(h->region_type & GF_REGION_NOSIMD)) if(!(h->region_type & GF_REGION_NOSIMD))
gf->multiply_region.w128 = gf_w128_split_4_128_sse_multiply_region; SET_FUNCTION(gf,multiply_region,w128,gf_w128_split_4_128_sse_multiply_region)
else else
gf->multiply_region.w128 = gf_w128_split_4_128_multiply_region; SET_FUNCTION(gf,multiply_region,w128,gf_w128_split_4_128_multiply_region)
#else #else
gf->multiply_region.w128 = gf_w128_split_4_128_multiply_region; SET_FUNCTION(gf,multiply_region,w128,gf_w128_split_4_128_multiply_region)
#endif #endif
} }
} }
@ -1586,9 +1586,9 @@ int gf_w128_group_init(gf_t *gf)
gt->m_table[2] = 0; gt->m_table[2] = 0;
gt->m_table[3] = 0; gt->m_table[3] = 0;
gf->multiply.w128 = gf_w128_group_multiply; SET_FUNCTION(gf,multiply,w128,gf_w128_group_multiply)
gf->inverse.w128 = gf_w128_euclid; SET_FUNCTION(gf,inverse,w128,gf_w128_euclid)
gf->multiply_region.w128 = gf_w128_group_multiply_region; SET_FUNCTION(gf,multiply_region,w128,gf_w128_group_multiply_region)
gf_w128_group_r_init(gf); gf_w128_group_r_init(gf);
@ -1738,10 +1738,10 @@ int gf_w128_init(gf_t *gf)
} }
} }
gf->multiply.w128 = NULL; SET_FUNCTION(gf,multiply,w128,NULL)
gf->divide.w128 = NULL; SET_FUNCTION(gf,divide,w128,NULL)
gf->inverse.w128 = NULL; SET_FUNCTION(gf,inverse,w128,NULL)
gf->multiply_region.w128 = NULL; SET_FUNCTION(gf,multiply_region,w128,NULL)
switch(h->mult_type) { switch(h->mult_type) {
case GF_MULT_BYTWO_p: case GF_MULT_BYTWO_p:
case GF_MULT_BYTWO_b: if (gf_w128_bytwo_init(gf) == 0) return 0; break; case GF_MULT_BYTWO_b: if (gf_w128_bytwo_init(gf) == 0) return 0; break;
@ -1757,22 +1757,22 @@ int gf_w128_init(gf_t *gf)
/* Ben: Used to be h->region_type == GF_REGION_ALTMAP, but failed since there /* Ben: Used to be h->region_type == GF_REGION_ALTMAP, but failed since there
are multiple flags in h->region_type */ are multiple flags in h->region_type */
if (h->mult_type == GF_MULT_SPLIT_TABLE && (h->region_type & GF_REGION_ALTMAP)) { if (h->mult_type == GF_MULT_SPLIT_TABLE && (h->region_type & GF_REGION_ALTMAP)) {
gf->extract_word.w128 = gf_w128_split_extract_word; SET_FUNCTION(gf,extract_word,w128,gf_w128_split_extract_word)
} else if (h->mult_type == GF_MULT_COMPOSITE && h->region_type == GF_REGION_ALTMAP) { } else if (h->mult_type == GF_MULT_COMPOSITE && h->region_type == GF_REGION_ALTMAP) {
gf->extract_word.w128 = gf_w128_composite_extract_word; SET_FUNCTION(gf,extract_word,w128,gf_w128_composite_extract_word)
} else { } else {
gf->extract_word.w128 = gf_w128_extract_word; SET_FUNCTION(gf,extract_word,w128,gf_w128_extract_word)
} }
if (h->divide_type == GF_DIVIDE_EUCLID) { if (h->divide_type == GF_DIVIDE_EUCLID) {
gf->divide.w128 = gf_w128_divide_from_inverse; SET_FUNCTION(gf,divide,w128,gf_w128_divide_from_inverse)
} }
if (gf->inverse.w128 != NULL && gf->divide.w128 == NULL) { if (gf->inverse.w128 != NULL && gf->divide.w128 == NULL) {
gf->divide.w128 = gf_w128_divide_from_inverse; SET_FUNCTION(gf,divide,w128,gf_w128_divide_from_inverse)
} }
if (gf->inverse.w128 == NULL && gf->divide.w128 != NULL) { if (gf->inverse.w128 == NULL && gf->divide.w128 != NULL) {
gf->inverse.w128 = gf_w128_inverse_from_divide; SET_FUNCTION(gf,inverse,w128,gf_w128_inverse_from_divide)
} }
return 1; return 1;
} }

View File

@ -548,7 +548,7 @@ gf_w16_shift_multiply (gf_t *gf, gf_val_32_t a16, gf_val_32_t b16)
static static
int gf_w16_shift_init(gf_t *gf) int gf_w16_shift_init(gf_t *gf)
{ {
gf->multiply.w32 = gf_w16_shift_multiply; SET_FUNCTION(gf,multiply,w32,gf_w16_shift_multiply)
return 1; return 1;
} }
@ -563,14 +563,14 @@ int gf_w16_cfm_init(gf_t *gf)
/*Ben: Determining how many reductions to do */ /*Ben: Determining how many reductions to do */
if ((0xfe00 & h->prim_poly) == 0) { if ((0xfe00 & h->prim_poly) == 0) {
gf->multiply.w32 = gf_w16_clm_multiply_2; SET_FUNCTION(gf,multiply,w32,gf_w16_clm_multiply_2)
gf->multiply_region.w32 = gf_w16_clm_multiply_region_from_single_2; SET_FUNCTION(gf,multiply_region,w32,gf_w16_clm_multiply_region_from_single_2)
} else if((0xf000 & h->prim_poly) == 0) { } else if((0xf000 & h->prim_poly) == 0) {
gf->multiply.w32 = gf_w16_clm_multiply_3; SET_FUNCTION(gf,multiply,w32,gf_w16_clm_multiply_3)
gf->multiply_region.w32 = gf_w16_clm_multiply_region_from_single_3; SET_FUNCTION(gf,multiply_region,w32,gf_w16_clm_multiply_region_from_single_3)
} else if ((0xe000 & h->prim_poly) == 0) { } else if ((0xe000 & h->prim_poly) == 0) {
gf->multiply.w32 = gf_w16_clm_multiply_4; SET_FUNCTION(gf,multiply,w32,gf_w16_clm_multiply_4)
gf->multiply_region.w32 = gf_w16_clm_multiply_region_from_single_4; SET_FUNCTION(gf,multiply_region,w32,gf_w16_clm_multiply_region_from_single_4)
} else { } else {
return 0; return 0;
} }
@ -705,10 +705,10 @@ int gf_w16_log_init(gf_t *gf)
ltd->inv_tbl[i] = ltd->antilog_tbl[GF_MULT_GROUP_SIZE-ltd->log_tbl[i]]; ltd->inv_tbl[i] = ltd->antilog_tbl[GF_MULT_GROUP_SIZE-ltd->log_tbl[i]];
} }
gf->inverse.w32 = gf_w16_log_inverse; SET_FUNCTION(gf,inverse,w32,gf_w16_log_inverse)
gf->divide.w32 = gf_w16_log_divide; SET_FUNCTION(gf,divide,w32,gf_w16_log_divide)
gf->multiply.w32 = gf_w16_log_multiply; SET_FUNCTION(gf,multiply,w32,gf_w16_log_multiply)
gf->multiply_region.w32 = gf_w16_log_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w16_log_multiply_region)
return 1; return 1;
} }
@ -1260,8 +1260,8 @@ int gf_w16_split_init(gf_t *gf)
} }
for (i = 0; i < 8; i++) basep = GF_MULTBY_TWO(basep); for (i = 0; i < 8; i++) basep = GF_MULTBY_TWO(basep);
} }
gf->multiply.w32 = gf_w16_split_8_8_multiply; SET_FUNCTION(gf,multiply,w32,gf_w16_split_8_8_multiply)
gf->multiply_region.w32 = gf_w16_split_8_16_lazy_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w16_split_8_16_lazy_multiply_region)
return 1; return 1;
} }
@ -1274,34 +1274,34 @@ int gf_w16_split_init(gf_t *gf)
/* Defaults */ /* Defaults */
if (issse3) { if (issse3) {
gf->multiply_region.w32 = gf_w16_split_4_16_lazy_sse_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w16_split_4_16_lazy_sse_multiply_region)
} else if (isneon) { } else if (isneon) {
#ifdef ARM_NEON #ifdef ARM_NEON
gf_w16_neon_split_init(gf); gf_w16_neon_split_init(gf);
#endif #endif
} else { } else {
gf->multiply_region.w32 = gf_w16_split_8_16_lazy_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w16_split_8_16_lazy_multiply_region)
} }
if ((h->arg1 == 8 && h->arg2 == 16) || (h->arg2 == 8 && h->arg1 == 16)) { if ((h->arg1 == 8 && h->arg2 == 16) || (h->arg2 == 8 && h->arg1 == 16)) {
gf->multiply_region.w32 = gf_w16_split_8_16_lazy_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w16_split_8_16_lazy_multiply_region)
} else if ((h->arg1 == 4 && h->arg2 == 16) || (h->arg2 == 4 && h->arg1 == 16)) { } else if ((h->arg1 == 4 && h->arg2 == 16) || (h->arg2 == 4 && h->arg1 == 16)) {
if (issse3 || isneon) { if (issse3 || isneon) {
if(h->region_type & GF_REGION_ALTMAP && h->region_type & GF_REGION_NOSIMD) if(h->region_type & GF_REGION_ALTMAP && h->region_type & GF_REGION_NOSIMD)
gf->multiply_region.w32 = gf_w16_split_4_16_lazy_nosse_altmap_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w16_split_4_16_lazy_nosse_altmap_multiply_region)
else if(h->region_type & GF_REGION_NOSIMD) else if(h->region_type & GF_REGION_NOSIMD)
gf->multiply_region.w32 = gf_w16_split_4_16_lazy_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w16_split_4_16_lazy_multiply_region)
else if(h->region_type & GF_REGION_ALTMAP && issse3) else if(h->region_type & GF_REGION_ALTMAP && issse3)
gf->multiply_region.w32 = gf_w16_split_4_16_lazy_sse_altmap_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w16_split_4_16_lazy_sse_altmap_multiply_region)
} else { } else {
if(h->region_type & GF_REGION_SIMD) if(h->region_type & GF_REGION_SIMD)
return 0; return 0;
else if(h->region_type & GF_REGION_ALTMAP) else if(h->region_type & GF_REGION_ALTMAP)
gf->multiply_region.w32 = gf_w16_split_4_16_lazy_nosse_altmap_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w16_split_4_16_lazy_nosse_altmap_multiply_region)
else else
gf->multiply_region.w32 = gf_w16_split_4_16_lazy_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w16_split_4_16_lazy_multiply_region)
} }
} }
@ -1313,7 +1313,7 @@ int gf_w16_table_init(gf_t *gf)
{ {
gf_w16_log_init(gf); gf_w16_log_init(gf);
gf->multiply_region.w32 = gf_w16_table_lazy_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w16_table_lazy_multiply_region)
return 1; return 1;
} }
@ -1844,26 +1844,26 @@ int gf_w16_bytwo_init(gf_t *gf)
} }
if (h->mult_type == GF_MULT_BYTWO_p) { if (h->mult_type == GF_MULT_BYTWO_p) {
gf->multiply.w32 = gf_w16_bytwo_p_multiply; SET_FUNCTION(gf,multiply,w32,gf_w16_bytwo_p_multiply)
#ifdef INTEL_SSE2 #ifdef INTEL_SSE2
if (h->region_type & GF_REGION_NOSIMD) if (h->region_type & GF_REGION_NOSIMD)
gf->multiply_region.w32 = gf_w16_bytwo_p_nosse_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w16_bytwo_p_nosse_multiply_region)
else else
gf->multiply_region.w32 = gf_w16_bytwo_p_sse_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w16_bytwo_p_sse_multiply_region)
#else #else
gf->multiply_region.w32 = gf_w16_bytwo_p_nosse_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w16_bytwo_p_nosse_multiply_region)
if(h->region_type & GF_REGION_SIMD) if(h->region_type & GF_REGION_SIMD)
return 0; return 0;
#endif #endif
} else { } else {
gf->multiply.w32 = gf_w16_bytwo_b_multiply; SET_FUNCTION(gf,multiply,w32,gf_w16_bytwo_b_multiply)
#ifdef INTEL_SSE2 #ifdef INTEL_SSE2
if (h->region_type & GF_REGION_NOSIMD) if (h->region_type & GF_REGION_NOSIMD)
gf->multiply_region.w32 = gf_w16_bytwo_b_nosse_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w16_bytwo_b_nosse_multiply_region)
else else
gf->multiply_region.w32 = gf_w16_bytwo_b_sse_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w16_bytwo_b_sse_multiply_region)
#else #else
gf->multiply_region.w32 = gf_w16_bytwo_b_nosse_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w16_bytwo_b_nosse_multiply_region)
if(h->region_type & GF_REGION_SIMD) if(h->region_type & GF_REGION_SIMD)
return 0; return 0;
#endif #endif
@ -1904,10 +1904,10 @@ int gf_w16_log_zero_init(gf_t *gf)
ltd->inv_tbl[i] = ltd->antilog_tbl[GF_MULT_GROUP_SIZE-ltd->log_tbl[i]]; ltd->inv_tbl[i] = ltd->antilog_tbl[GF_MULT_GROUP_SIZE-ltd->log_tbl[i]];
} }
gf->inverse.w32 = gf_w16_log_zero_inverse; SET_FUNCTION(gf,inverse,w32,gf_w16_log_zero_inverse)
gf->divide.w32 = gf_w16_log_zero_divide; SET_FUNCTION(gf,divide,w32,gf_w16_log_zero_divide)
gf->multiply.w32 = gf_w16_log_zero_multiply; SET_FUNCTION(gf,multiply,w32,gf_w16_log_zero_multiply)
gf->multiply_region.w32 = gf_w16_log_zero_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w16_log_zero_multiply_region)
return 1; return 1;
} }
@ -2145,18 +2145,18 @@ int gf_w16_composite_init(gf_t *gf)
cd->mult_table = gf_w8_get_mult_table(h->base_gf); cd->mult_table = gf_w8_get_mult_table(h->base_gf);
if (h->region_type & GF_REGION_ALTMAP) { if (h->region_type & GF_REGION_ALTMAP) {
gf->multiply_region.w32 = gf_w16_composite_multiply_region_alt; SET_FUNCTION(gf,multiply_region,w32,gf_w16_composite_multiply_region_alt)
} else { } else {
gf->multiply_region.w32 = gf_w16_composite_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w16_composite_multiply_region)
} }
if (cd->mult_table == NULL) { if (cd->mult_table == NULL) {
gf->multiply.w32 = gf_w16_composite_multiply_recursive; SET_FUNCTION(gf,multiply,w32,gf_w16_composite_multiply_recursive)
} else { } else {
gf->multiply.w32 = gf_w16_composite_multiply_inline; SET_FUNCTION(gf,multiply,w32,gf_w16_composite_multiply_inline)
} }
gf->divide.w32 = NULL; SET_FUNCTION(gf,divide,w32,NULL)
gf->inverse.w32 = gf_w16_composite_inverse; SET_FUNCTION(gf,inverse,w32,gf_w16_composite_inverse)
return 1; return 1;
} }
@ -2277,10 +2277,10 @@ int gf_w16_group_init(gf_t *gf)
d44->reduce[p>>16] = (p&0xffff); d44->reduce[p>>16] = (p&0xffff);
} }
gf->multiply.w32 = gf_w16_group_4_4_multiply; SET_FUNCTION(gf,multiply,w32,gf_w16_group_4_4_multiply)
gf->divide.w32 = NULL; SET_FUNCTION(gf,divide,w32,NULL)
gf->inverse.w32 = NULL; SET_FUNCTION(gf,inverse,w32,NULL)
gf->multiply_region.w32 = gf_w16_group_4_4_region_multiply; SET_FUNCTION(gf,multiply_region,w32,gf_w16_group_4_4_region_multiply)
return 1; return 1;
} }
@ -2360,10 +2360,10 @@ int gf_w16_init(gf_t *gf)
if (h->mult_type != GF_MULT_COMPOSITE) h->prim_poly |= (1 << 16); if (h->mult_type != GF_MULT_COMPOSITE) h->prim_poly |= (1 << 16);
gf->multiply.w32 = NULL; SET_FUNCTION(gf,multiply,w32,NULL)
gf->divide.w32 = NULL; SET_FUNCTION(gf,divide,w32,NULL)
gf->inverse.w32 = NULL; SET_FUNCTION(gf,inverse,w32,NULL)
gf->multiply_region.w32 = NULL; SET_FUNCTION(gf,multiply_region,w32,NULL)
switch(h->mult_type) { switch(h->mult_type) {
case GF_MULT_LOG_ZERO: if (gf_w16_log_zero_init(gf) == 0) return 0; break; case GF_MULT_LOG_ZERO: if (gf_w16_log_zero_init(gf) == 0) return 0; break;
@ -2380,34 +2380,34 @@ int gf_w16_init(gf_t *gf)
default: return 0; default: return 0;
} }
if (h->divide_type == GF_DIVIDE_EUCLID) { if (h->divide_type == GF_DIVIDE_EUCLID) {
gf->divide.w32 = gf_w16_divide_from_inverse; SET_FUNCTION(gf,divide,w32,gf_w16_divide_from_inverse)
gf->inverse.w32 = gf_w16_euclid; SET_FUNCTION(gf,inverse,w32,gf_w16_euclid)
} else if (h->divide_type == GF_DIVIDE_MATRIX) { } else if (h->divide_type == GF_DIVIDE_MATRIX) {
gf->divide.w32 = gf_w16_divide_from_inverse; SET_FUNCTION(gf,divide,w32,gf_w16_divide_from_inverse)
gf->inverse.w32 = gf_w16_matrix; SET_FUNCTION(gf,inverse,w32,gf_w16_matrix)
} }
if (gf->divide.w32 == NULL) { if (gf->divide.w32 == NULL) {
gf->divide.w32 = gf_w16_divide_from_inverse; SET_FUNCTION(gf,divide,w32,gf_w16_divide_from_inverse)
if (gf->inverse.w32 == NULL) gf->inverse.w32 = gf_w16_euclid; if (gf->inverse.w32 == NULL) SET_FUNCTION(gf,inverse,w32,gf_w16_euclid)
} }
if (gf->inverse.w32 == NULL) gf->inverse.w32 = gf_w16_inverse_from_divide; if (gf->inverse.w32 == NULL) SET_FUNCTION(gf,inverse,w32,gf_w16_inverse_from_divide)
if (h->region_type & GF_REGION_ALTMAP) { if (h->region_type & GF_REGION_ALTMAP) {
if (h->mult_type == GF_MULT_COMPOSITE) { if (h->mult_type == GF_MULT_COMPOSITE) {
gf->extract_word.w32 = gf_w16_composite_extract_word; SET_FUNCTION(gf,extract_word,w32,gf_w16_composite_extract_word)
} else { } else {
gf->extract_word.w32 = gf_w16_split_extract_word; SET_FUNCTION(gf,extract_word,w32,gf_w16_split_extract_word)
} }
} else if (h->region_type == GF_REGION_CAUCHY) { } else if (h->region_type == GF_REGION_CAUCHY) {
gf->multiply_region.w32 = gf_wgen_cauchy_region; SET_FUNCTION(gf,multiply_region,w32,gf_wgen_cauchy_region)
gf->extract_word.w32 = gf_wgen_extract_word; SET_FUNCTION(gf,extract_word,w32,gf_wgen_extract_word)
} else { } else {
gf->extract_word.w32 = gf_w16_extract_word; SET_FUNCTION(gf,extract_word,w32,gf_w16_extract_word)
} }
if (gf->multiply_region.w32 == NULL) { if (gf->multiply_region.w32 == NULL) {
gf->multiply_region.w32 = gf_w16_multiply_region_from_single; SET_FUNCTION(gf,multiply_region,w32,gf_w16_multiply_region_from_single)
} }
return 1; return 1;
} }

View File

@ -589,15 +589,15 @@ gf_w32_shift_multiply (gf_t *gf, uint32_t a32, uint32_t b32)
static static
int gf_w32_cfmgk_init(gf_t *gf) int gf_w32_cfmgk_init(gf_t *gf)
{ {
gf->inverse.w32 = gf_w32_euclid; SET_FUNCTION(gf,inverse,w32,gf_w32_euclid)
gf->multiply_region.w32 = gf_w32_multiply_region_from_single; SET_FUNCTION(gf,multiply_region,w32,gf_w32_multiply_region_from_single)
#if defined(INTEL_SSE4_PCLMUL) #if defined(INTEL_SSE4_PCLMUL)
gf_internal_t *h; gf_internal_t *h;
h = (gf_internal_t *) gf->scratch; h = (gf_internal_t *) gf->scratch;
gf->multiply.w32 = gf_w32_cfmgk_multiply; SET_FUNCTION(gf,multiply,w32,gf_w32_cfmgk_multiply)
gf->multiply_region.w32 = gf_w32_cfmgk_multiply_region_from_single; SET_FUNCTION(gf,multiply_region,w32,gf_w32_cfmgk_multiply_region_from_single)
uint64_t *q_plus = (uint64_t *) h->private; uint64_t *q_plus = (uint64_t *) h->private;
uint64_t *g_star = (uint64_t *) h->private + 1; uint64_t *g_star = (uint64_t *) h->private + 1;
@ -624,8 +624,8 @@ int gf_w32_cfmgk_init(gf_t *gf)
static static
int gf_w32_cfm_init(gf_t *gf) int gf_w32_cfm_init(gf_t *gf)
{ {
gf->inverse.w32 = gf_w32_euclid; SET_FUNCTION(gf,inverse,w32,gf_w32_euclid)
gf->multiply_region.w32 = gf_w32_multiply_region_from_single; SET_FUNCTION(gf,multiply_region,w32,gf_w32_multiply_region_from_single)
/*Ben: We also check to see if the prim poly will work for pclmul */ /*Ben: We also check to see if the prim poly will work for pclmul */
/*Ben: Check to see how many reduction steps it will take*/ /*Ben: Check to see how many reduction steps it will take*/
@ -636,14 +636,14 @@ int gf_w32_cfm_init(gf_t *gf)
h = (gf_internal_t *) gf->scratch; h = (gf_internal_t *) gf->scratch;
if ((0xfffe0000 & h->prim_poly) == 0){ if ((0xfffe0000 & h->prim_poly) == 0){
gf->multiply.w32 = gf_w32_clm_multiply_2; SET_FUNCTION(gf,multiply,w32,gf_w32_clm_multiply_2)
gf->multiply_region.w32 = gf_w32_clm_multiply_region_from_single_2; SET_FUNCTION(gf,multiply_region,w32,gf_w32_clm_multiply_region_from_single_2)
}else if ((0xffc00000 & h->prim_poly) == 0){ }else if ((0xffc00000 & h->prim_poly) == 0){
gf->multiply.w32 = gf_w32_clm_multiply_3; SET_FUNCTION(gf,multiply,w32,gf_w32_clm_multiply_3)
gf->multiply_region.w32 = gf_w32_clm_multiply_region_from_single_3; SET_FUNCTION(gf,multiply_region,w32,gf_w32_clm_multiply_region_from_single_3)
}else if ((0xfe000000 & h->prim_poly) == 0){ }else if ((0xfe000000 & h->prim_poly) == 0){
gf->multiply.w32 = gf_w32_clm_multiply_4; SET_FUNCTION(gf,multiply,w32,gf_w32_clm_multiply_4)
gf->multiply_region.w32 = gf_w32_clm_multiply_region_from_single_4; SET_FUNCTION(gf,multiply_region,w32,gf_w32_clm_multiply_region_from_single_4)
} else { } else {
return 0; return 0;
} }
@ -656,9 +656,9 @@ int gf_w32_cfm_init(gf_t *gf)
static static
int gf_w32_shift_init(gf_t *gf) int gf_w32_shift_init(gf_t *gf)
{ {
gf->inverse.w32 = gf_w32_euclid; SET_FUNCTION(gf,inverse,w32,gf_w32_euclid)
gf->multiply_region.w32 = gf_w32_multiply_region_from_single; SET_FUNCTION(gf,multiply_region,w32,gf_w32_multiply_region_from_single)
gf->multiply.w32 = gf_w32_shift_multiply; SET_FUNCTION(gf,multiply,w32,gf_w32_shift_multiply)
return 1; return 1;
} }
@ -1380,32 +1380,32 @@ int gf_w32_bytwo_init(gf_t *gf)
} }
if (h->mult_type == GF_MULT_BYTWO_p) { if (h->mult_type == GF_MULT_BYTWO_p) {
gf->multiply.w32 = gf_w32_bytwo_p_multiply; SET_FUNCTION(gf,multiply,w32,gf_w32_bytwo_p_multiply)
#ifdef INTEL_SSE2 #ifdef INTEL_SSE2
if (h->region_type & GF_REGION_NOSIMD) if (h->region_type & GF_REGION_NOSIMD)
gf->multiply_region.w32 = gf_w32_bytwo_p_nosse_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w32_bytwo_p_nosse_multiply_region)
else else
gf->multiply_region.w32 = gf_w32_bytwo_p_sse_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w32_bytwo_p_sse_multiply_region)
#else #else
gf->multiply_region.w32 = gf_w32_bytwo_p_nosse_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w32_bytwo_p_nosse_multiply_region)
if(h->region_type & GF_REGION_SIMD) if(h->region_type & GF_REGION_SIMD)
return 0; return 0;
#endif #endif
} else { } else {
gf->multiply.w32 = gf_w32_bytwo_b_multiply; SET_FUNCTION(gf,multiply,w32,gf_w32_bytwo_b_multiply)
#ifdef INTEL_SSE2 #ifdef INTEL_SSE2
if (h->region_type & GF_REGION_NOSIMD) if (h->region_type & GF_REGION_NOSIMD)
gf->multiply_region.w32 = gf_w32_bytwo_b_nosse_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w32_bytwo_b_nosse_multiply_region)
else else
gf->multiply_region.w32 = gf_w32_bytwo_b_sse_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w32_bytwo_b_sse_multiply_region)
#else #else
gf->multiply_region.w32 = gf_w32_bytwo_b_nosse_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w32_bytwo_b_nosse_multiply_region)
if(h->region_type & GF_REGION_SIMD) if(h->region_type & GF_REGION_SIMD)
return 0; return 0;
#endif #endif
} }
gf->inverse.w32 = gf_w32_euclid; SET_FUNCTION(gf,inverse,w32,gf_w32_euclid)
return 1; return 1;
} }
@ -2252,7 +2252,7 @@ int gf_w32_split_init(gf_t *gf)
/* Defaults */ /* Defaults */
gf->inverse.w32 = gf_w32_euclid; SET_FUNCTION(gf,inverse,w32,gf_w32_euclid)
/* JSP: First handle single multiplication: /* JSP: First handle single multiplication:
If args == 8, then we're doing split 8 8. If args == 8, then we're doing split 8 8.
@ -2261,17 +2261,17 @@ int gf_w32_split_init(gf_t *gf)
*/ */
if (h->arg1 == 8 && h->arg2 == 8) { if (h->arg1 == 8 && h->arg2 == 8) {
gf->multiply.w32 = gf_w32_split_8_8_multiply; SET_FUNCTION(gf,multiply,w32,gf_w32_split_8_8_multiply)
} else if (ispclmul) { } else if (ispclmul) {
if ((0xfffe0000 & h->prim_poly) == 0){ if ((0xfffe0000 & h->prim_poly) == 0){
gf->multiply.w32 = gf_w32_clm_multiply_2; SET_FUNCTION(gf,multiply,w32,gf_w32_clm_multiply_2)
} else if ((0xffc00000 & h->prim_poly) == 0){ } else if ((0xffc00000 & h->prim_poly) == 0){
gf->multiply.w32 = gf_w32_clm_multiply_3; SET_FUNCTION(gf,multiply,w32,gf_w32_clm_multiply_3)
} else if ((0xfe000000 & h->prim_poly) == 0){ } else if ((0xfe000000 & h->prim_poly) == 0){
gf->multiply.w32 = gf_w32_clm_multiply_4; SET_FUNCTION(gf,multiply,w32,gf_w32_clm_multiply_4)
} }
} else { } else {
gf->multiply.w32 = gf_w32_bytwo_p_multiply; SET_FUNCTION(gf,multiply,w32,gf_w32_bytwo_p_multiply)
} }
/* Easy cases: 16/32 and 2/32 */ /* Easy cases: 16/32 and 2/32 */
@ -2279,7 +2279,7 @@ int gf_w32_split_init(gf_t *gf)
if ((h->arg1 == 16 && h->arg2 == 32) || (h->arg1 == 32 && h->arg2 == 16)) { if ((h->arg1 == 16 && h->arg2 == 32) || (h->arg1 == 32 && h->arg2 == 16)) {
d16 = (struct gf_split_16_32_lazy_data *) h->private; d16 = (struct gf_split_16_32_lazy_data *) h->private;
d16->last_value = 0; d16->last_value = 0;
gf->multiply_region.w32 = gf_w32_split_16_32_lazy_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w32_split_16_32_lazy_multiply_region)
return 1; return 1;
} }
@ -2288,11 +2288,11 @@ int gf_w32_split_init(gf_t *gf)
ld2->last_value = 0; ld2->last_value = 0;
#ifdef INTEL_SSSE3 #ifdef INTEL_SSSE3
if (!(h->region_type & GF_REGION_NOSIMD)) if (!(h->region_type & GF_REGION_NOSIMD))
gf->multiply_region.w32 = gf_w32_split_2_32_lazy_sse_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w32_split_2_32_lazy_sse_multiply_region)
else else
gf->multiply_region.w32 = gf_w32_split_2_32_lazy_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w32_split_2_32_lazy_multiply_region)
#else #else
gf->multiply_region.w32 = gf_w32_split_2_32_lazy_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w32_split_2_32_lazy_multiply_region)
if(h->region_type & GF_REGION_SIMD) return 0; if(h->region_type & GF_REGION_SIMD) return 0;
#endif #endif
return 1; return 1;
@ -2305,15 +2305,15 @@ int gf_w32_split_init(gf_t *gf)
ld4 = (struct gf_split_4_32_lazy_data *) h->private; ld4 = (struct gf_split_4_32_lazy_data *) h->private;
ld4->last_value = 0; ld4->last_value = 0;
if ((h->region_type & GF_REGION_NOSIMD) || !(issse3 || isneon)) { if ((h->region_type & GF_REGION_NOSIMD) || !(issse3 || isneon)) {
gf->multiply_region.w32 = gf_w32_split_4_32_lazy_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w32_split_4_32_lazy_multiply_region)
} else if (isneon) { } else if (isneon) {
#ifdef ARM_NEON #ifdef ARM_NEON
gf_w32_neon_split_init(gf); gf_w32_neon_split_init(gf);
#endif #endif
} else if (h->region_type & GF_REGION_ALTMAP) { } else if (h->region_type & GF_REGION_ALTMAP) {
gf->multiply_region.w32 = gf_w32_split_4_32_lazy_sse_altmap_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w32_split_4_32_lazy_sse_altmap_multiply_region)
} else { } else {
gf->multiply_region.w32 = gf_w32_split_4_32_lazy_sse_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w32_split_4_32_lazy_sse_multiply_region)
} }
return 1; return 1;
} }
@ -2324,7 +2324,7 @@ int gf_w32_split_init(gf_t *gf)
h->mult_type == GF_MULT_DEFAULT) { h->mult_type == GF_MULT_DEFAULT) {
d32 = (struct gf_split_8_32_lazy_data *) h->private; d32 = (struct gf_split_8_32_lazy_data *) h->private;
d32->last_value = 0; d32->last_value = 0;
gf->multiply_region.w32 = gf_w32_split_8_32_lazy_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w32_split_8_32_lazy_multiply_region)
return 1; return 1;
} }
@ -2333,8 +2333,8 @@ int gf_w32_split_init(gf_t *gf)
if (h->arg1 == 8 && h->arg2 == 8) { if (h->arg1 == 8 && h->arg2 == 8) {
d8 = (struct gf_w32_split_8_8_data *) h->private; d8 = (struct gf_w32_split_8_8_data *) h->private;
d8->last_value = 0; d8->last_value = 0;
gf->multiply.w32 = gf_w32_split_8_8_multiply; SET_FUNCTION(gf,multiply,w32,gf_w32_split_8_8_multiply)
gf->multiply_region.w32 = gf_w32_split_8_32_lazy_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w32_split_8_32_lazy_multiply_region)
basep = 1; basep = 1;
for (exp = 0; exp < 7; exp++) { for (exp = 0; exp < 7; exp++) {
for (j = 0; j < 256; j++) d8->tables[exp][0][j] = 0; for (j = 0; j < 256; j++) d8->tables[exp][0][j] = 0;
@ -2407,14 +2407,14 @@ int gf_w32_group_init(gf_t *gf)
} }
if (g_s == g_r) { if (g_s == g_r) {
gf->multiply.w32 = gf_w32_group_s_equals_r_multiply; SET_FUNCTION(gf,multiply,w32,gf_w32_group_s_equals_r_multiply)
gf->multiply_region.w32 = gf_w32_group_s_equals_r_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w32_group_s_equals_r_multiply_region)
} else { } else {
gf->multiply.w32 = gf_w32_group_multiply; SET_FUNCTION(gf,multiply,w32,gf_w32_group_multiply)
gf->multiply_region.w32 = gf_w32_group_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w32_group_multiply_region)
} }
gf->divide.w32 = NULL; SET_FUNCTION(gf,divide,w32,NULL)
gf->inverse.w32 = gf_w32_euclid; SET_FUNCTION(gf,inverse,w32,gf_w32_euclid)
return 1; return 1;
} }
@ -2666,18 +2666,18 @@ int gf_w32_composite_init(gf_t *gf)
cd->alog = gf_w16_get_mult_alog_table(h->base_gf); cd->alog = gf_w16_get_mult_alog_table(h->base_gf);
if (h->region_type & GF_REGION_ALTMAP) { if (h->region_type & GF_REGION_ALTMAP) {
gf->multiply_region.w32 = gf_w32_composite_multiply_region_alt; SET_FUNCTION(gf,multiply_region,w32,gf_w32_composite_multiply_region_alt)
} else { } else {
gf->multiply_region.w32 = gf_w32_composite_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w32_composite_multiply_region)
} }
if (cd->log == NULL) { if (cd->log == NULL) {
gf->multiply.w32 = gf_w32_composite_multiply_recursive; SET_FUNCTION(gf,multiply,w32,gf_w32_composite_multiply_recursive)
} else { } else {
gf->multiply.w32 = gf_w32_composite_multiply_inline; SET_FUNCTION(gf,multiply,w32,gf_w32_composite_multiply_inline)
} }
gf->divide.w32 = NULL; SET_FUNCTION(gf,divide,w32,NULL)
gf->inverse.w32 = gf_w32_composite_inverse; SET_FUNCTION(gf,inverse,w32,gf_w32_composite_inverse)
return 1; return 1;
} }
@ -2776,10 +2776,10 @@ int gf_w32_init(gf_t *gf)
if(h->mult_type != GF_MULT_COMPOSITE) h->prim_poly &= 0xffffffff; if(h->mult_type != GF_MULT_COMPOSITE) h->prim_poly &= 0xffffffff;
gf->multiply.w32 = NULL; SET_FUNCTION(gf,multiply,w32,NULL)
gf->divide.w32 = NULL; SET_FUNCTION(gf,divide,w32,NULL)
gf->inverse.w32 = NULL; SET_FUNCTION(gf,inverse,w32,NULL)
gf->multiply_region.w32 = NULL; SET_FUNCTION(gf,multiply_region,w32,NULL)
switch(h->mult_type) { switch(h->mult_type) {
case GF_MULT_CARRY_FREE: if (gf_w32_cfm_init(gf) == 0) return 0; break; case GF_MULT_CARRY_FREE: if (gf_w32_cfm_init(gf) == 0) return 0; break;
@ -2794,30 +2794,30 @@ int gf_w32_init(gf_t *gf)
default: return 0; default: return 0;
} }
if (h->divide_type == GF_DIVIDE_EUCLID) { if (h->divide_type == GF_DIVIDE_EUCLID) {
gf->divide.w32 = gf_w32_divide_from_inverse; SET_FUNCTION(gf,divide,w32,gf_w32_divide_from_inverse)
gf->inverse.w32 = gf_w32_euclid; SET_FUNCTION(gf,inverse,w32,gf_w32_euclid)
} else if (h->divide_type == GF_DIVIDE_MATRIX) { } else if (h->divide_type == GF_DIVIDE_MATRIX) {
gf->divide.w32 = gf_w32_divide_from_inverse; SET_FUNCTION(gf,divide,w32,gf_w32_divide_from_inverse)
gf->inverse.w32 = gf_w32_matrix; SET_FUNCTION(gf,inverse,w32,gf_w32_matrix)
} }
if (gf->inverse.w32 != NULL && gf->divide.w32 == NULL) { if (gf->inverse.w32 != NULL && gf->divide.w32 == NULL) {
gf->divide.w32 = gf_w32_divide_from_inverse; SET_FUNCTION(gf,divide,w32,gf_w32_divide_from_inverse)
} }
if (gf->inverse.w32 == NULL && gf->divide.w32 != NULL) { if (gf->inverse.w32 == NULL && gf->divide.w32 != NULL) {
gf->inverse.w32 = gf_w32_inverse_from_divide; SET_FUNCTION(gf,inverse,w32,gf_w32_inverse_from_divide)
} }
if (h->region_type == GF_REGION_CAUCHY) { if (h->region_type == GF_REGION_CAUCHY) {
gf->extract_word.w32 = gf_wgen_extract_word; SET_FUNCTION(gf,extract_word,w32,gf_wgen_extract_word)
gf->multiply_region.w32 = gf_wgen_cauchy_region; SET_FUNCTION(gf,multiply_region,w32,gf_wgen_cauchy_region)
} else if (h->region_type & GF_REGION_ALTMAP) { } else if (h->region_type & GF_REGION_ALTMAP) {
if (h->mult_type == GF_MULT_COMPOSITE) { if (h->mult_type == GF_MULT_COMPOSITE) {
gf->extract_word.w32 = gf_w32_composite_extract_word; SET_FUNCTION(gf,extract_word,w32,gf_w32_composite_extract_word)
} else { } else {
gf->extract_word.w32 = gf_w32_split_extract_word; SET_FUNCTION(gf,extract_word,w32,gf_w32_split_extract_word)
} }
} else { } else {
gf->extract_word.w32 = gf_w32_extract_word; SET_FUNCTION(gf,extract_word,w32,gf_w32_extract_word)
} }
return 1; return 1;
} }

View File

@ -311,10 +311,10 @@ int gf_w4_log_init(gf_t *gf)
return 0; return 0;
} }
gf->inverse.w32 = gf_w4_inverse_from_divide; SET_FUNCTION(gf,inverse,w32,gf_w4_inverse_from_divide)
gf->divide.w32 = gf_w4_log_divide; SET_FUNCTION(gf,divide,w32,gf_w4_log_divide)
gf->multiply.w32 = gf_w4_log_multiply; SET_FUNCTION(gf,multiply,w32,gf_w4_log_multiply)
gf->multiply_region.w32 = gf_w4_log_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w4_log_multiply_region)
return 1; return 1;
} }
@ -444,20 +444,20 @@ int gf_w4_single_table_init(gf_t *gf)
} }
} }
gf->inverse.w32 = NULL; SET_FUNCTION(gf,inverse,w32,NULL)
gf->divide.w32 = gf_w4_single_table_divide; SET_FUNCTION(gf,divide,w32,gf_w4_single_table_divide)
gf->multiply.w32 = gf_w4_single_table_multiply; SET_FUNCTION(gf,multiply,w32,gf_w4_single_table_multiply)
#if defined(INTEL_SSSE3) || defined(ARM_NEON) #if defined(INTEL_SSSE3) || defined(ARM_NEON)
if(h->region_type & (GF_REGION_NOSIMD | GF_REGION_CAUCHY)) if(h->region_type & (GF_REGION_NOSIMD | GF_REGION_CAUCHY))
gf->multiply_region.w32 = gf_w4_single_table_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w4_single_table_multiply_region)
else else
#if defined(INTEL_SSSE3) #if defined(INTEL_SSSE3)
gf->multiply_region.w32 = gf_w4_single_table_sse_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w4_single_table_sse_multiply_region)
#elif defined(ARM_NEON) #elif defined(ARM_NEON)
gf_w4_neon_single_table_init(gf); gf_w4_neon_single_table_init(gf);
#endif #endif
#else #else
gf->multiply_region.w32 = gf_w4_single_table_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w4_single_table_multiply_region)
if (h->region_type & GF_REGION_SIMD) return 0; if (h->region_type & GF_REGION_SIMD) return 0;
#endif #endif
@ -548,10 +548,10 @@ int gf_w4_double_table_init(gf_t *gf)
} }
} }
gf->inverse.w32 = NULL; SET_FUNCTION(gf,inverse,w32,NULL)
gf->divide.w32 = gf_w4_double_table_divide; SET_FUNCTION(gf,divide,w32,gf_w4_double_table_divide)
gf->multiply.w32 = gf_w4_double_table_multiply; SET_FUNCTION(gf,multiply,w32,gf_w4_double_table_multiply)
gf->multiply_region.w32 = gf_w4_double_table_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w4_double_table_multiply_region)
return 1; return 1;
} }
@ -682,10 +682,10 @@ int gf_w4_quad_table_init(gf_t *gf)
} }
} }
gf->inverse.w32 = NULL; SET_FUNCTION(gf,inverse,w32,NULL)
gf->divide.w32 = gf_w4_quad_table_divide; SET_FUNCTION(gf,divide,w32,gf_w4_quad_table_divide)
gf->multiply.w32 = gf_w4_quad_table_multiply; SET_FUNCTION(gf,multiply,w32,gf_w4_quad_table_multiply)
gf->multiply_region.w32 = gf_w4_quad_table_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w4_quad_table_multiply_region)
return 1; return 1;
} }
static static
@ -724,10 +724,10 @@ int gf_w4_quad_table_lazy_init(gf_t *gf)
} }
} }
gf->inverse.w32 = NULL; SET_FUNCTION(gf,inverse,w32,NULL)
gf->divide.w32 = gf_w4_quad_table_lazy_divide; SET_FUNCTION(gf,divide,w32,gf_w4_quad_table_lazy_divide)
gf->multiply.w32 = gf_w4_quad_table_lazy_multiply; SET_FUNCTION(gf,multiply,w32,gf_w4_quad_table_lazy_multiply)
gf->multiply_region.w32 = gf_w4_quad_table_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w4_quad_table_multiply_region)
return 1; return 1;
} }
@ -1865,26 +1865,26 @@ int gf_w4_bytwo_init(gf_t *gf)
} }
if (h->mult_type == GF_MULT_BYTWO_p) { if (h->mult_type == GF_MULT_BYTWO_p) {
gf->multiply.w32 = gf_w4_bytwo_p_multiply; SET_FUNCTION(gf,multiply,w32,gf_w4_bytwo_p_multiply)
#ifdef INTEL_SSE2 #ifdef INTEL_SSE2
if (h->region_type & GF_REGION_NOSIMD) if (h->region_type & GF_REGION_NOSIMD)
gf->multiply_region.w32 = gf_w4_bytwo_p_nosse_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w4_bytwo_p_nosse_multiply_region)
else else
gf->multiply_region.w32 = gf_w4_bytwo_p_sse_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w4_bytwo_p_sse_multiply_region)
#else #else
gf->multiply_region.w32 = gf_w4_bytwo_p_nosse_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w4_bytwo_p_nosse_multiply_region)
if (h->region_type & GF_REGION_SIMD) if (h->region_type & GF_REGION_SIMD)
return 0; return 0;
#endif #endif
} else { } else {
gf->multiply.w32 = gf_w4_bytwo_b_multiply; SET_FUNCTION(gf,multiply,w32,gf_w4_bytwo_b_multiply)
#ifdef INTEL_SSE2 #ifdef INTEL_SSE2
if (h->region_type & GF_REGION_NOSIMD) if (h->region_type & GF_REGION_NOSIMD)
gf->multiply_region.w32 = gf_w4_bytwo_b_nosse_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w4_bytwo_b_nosse_multiply_region)
else else
gf->multiply_region.w32 = gf_w4_bytwo_b_sse_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w4_bytwo_b_sse_multiply_region)
#else #else
gf->multiply_region.w32 = gf_w4_bytwo_b_nosse_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w4_bytwo_b_nosse_multiply_region)
if (h->region_type & GF_REGION_SIMD) if (h->region_type & GF_REGION_SIMD)
return 0; return 0;
#endif #endif
@ -1897,7 +1897,7 @@ static
int gf_w4_cfm_init(gf_t *gf) int gf_w4_cfm_init(gf_t *gf)
{ {
#if defined(INTEL_SSE4_PCLMUL) #if defined(INTEL_SSE4_PCLMUL)
gf->multiply.w32 = gf_w4_clm_multiply; SET_FUNCTION(gf,multiply,w32,gf_w4_clm_multiply)
return 1; return 1;
#elif defined(ARM_NEON) #elif defined(ARM_NEON)
return gf_w4_neon_cfm_init(gf); return gf_w4_neon_cfm_init(gf);
@ -1908,7 +1908,7 @@ int gf_w4_cfm_init(gf_t *gf)
static static
int gf_w4_shift_init(gf_t *gf) int gf_w4_shift_init(gf_t *gf)
{ {
gf->multiply.w32 = gf_w4_shift_multiply; SET_FUNCTION(gf,multiply,w32,gf_w4_shift_multiply)
return 1; return 1;
} }
@ -1977,11 +1977,11 @@ gf_w4_init (gf_t *gf)
h = (gf_internal_t *) gf->scratch; h = (gf_internal_t *) gf->scratch;
if (h->prim_poly == 0) h->prim_poly = 0x13; if (h->prim_poly == 0) h->prim_poly = 0x13;
h->prim_poly |= 0x10; h->prim_poly |= 0x10;
gf->multiply.w32 = NULL; SET_FUNCTION(gf,multiply,w32,NULL)
gf->divide.w32 = NULL; SET_FUNCTION(gf,divide,w32,NULL)
gf->inverse.w32 = NULL; SET_FUNCTION(gf,inverse,w32,NULL)
gf->multiply_region.w32 = NULL; SET_FUNCTION(gf,multiply_region,w32,NULL)
gf->extract_word.w32 = gf_w4_extract_word; SET_FUNCTION(gf,extract_word,w32,gf_w4_extract_word)
switch(h->mult_type) { switch(h->mult_type) {
case GF_MULT_CARRY_FREE: if (gf_w4_cfm_init(gf) == 0) return 0; break; case GF_MULT_CARRY_FREE: if (gf_w4_cfm_init(gf) == 0) return 0; break;
@ -1995,27 +1995,27 @@ gf_w4_init (gf_t *gf)
} }
if (h->divide_type == GF_DIVIDE_EUCLID) { if (h->divide_type == GF_DIVIDE_EUCLID) {
gf->divide.w32 = gf_w4_divide_from_inverse; SET_FUNCTION(gf,divide,w32,gf_w4_divide_from_inverse)
gf->inverse.w32 = gf_w4_euclid; SET_FUNCTION(gf,inverse,w32,gf_w4_euclid)
} else if (h->divide_type == GF_DIVIDE_MATRIX) { } else if (h->divide_type == GF_DIVIDE_MATRIX) {
gf->divide.w32 = gf_w4_divide_from_inverse; SET_FUNCTION(gf,divide,w32,gf_w4_divide_from_inverse)
gf->inverse.w32 = gf_w4_matrix; SET_FUNCTION(gf,inverse,w32,gf_w4_matrix)
} }
if (gf->divide.w32 == NULL) { if (gf->divide.w32 == NULL) {
gf->divide.w32 = gf_w4_divide_from_inverse; SET_FUNCTION(gf,divide,w32,gf_w4_divide_from_inverse)
if (gf->inverse.w32 == NULL) gf->inverse.w32 = gf_w4_euclid; if (gf->inverse.w32 == NULL) SET_FUNCTION(gf,inverse,w32,gf_w4_euclid)
} }
if (gf->inverse.w32 == NULL) gf->inverse.w32 = gf_w4_inverse_from_divide; if (gf->inverse.w32 == NULL) SET_FUNCTION(gf,inverse,w32,gf_w4_inverse_from_divide)
if (h->region_type == GF_REGION_CAUCHY) { if (h->region_type == GF_REGION_CAUCHY) {
gf->multiply_region.w32 = gf_wgen_cauchy_region; SET_FUNCTION(gf,multiply_region,w32,gf_wgen_cauchy_region)
gf->extract_word.w32 = gf_wgen_extract_word; SET_FUNCTION(gf,extract_word,w32,gf_wgen_extract_word)
} }
if (gf->multiply_region.w32 == NULL) { if (gf->multiply_region.w32 == NULL) {
gf->multiply_region.w32 = gf_w4_multiply_region_from_single; SET_FUNCTION(gf,multiply_region,w32,gf_w4_multiply_region_from_single)
} }
return 1; return 1;

View File

@ -697,17 +697,17 @@ gf_w64_split_16_64_lazy_multiply_region(gf_t *gf, void *src, void *dest, uint64_
static static
int gf_w64_shift_init(gf_t *gf) int gf_w64_shift_init(gf_t *gf)
{ {
gf->multiply.w64 = gf_w64_shift_multiply; SET_FUNCTION(gf,multiply,w64,gf_w64_shift_multiply)
gf->inverse.w64 = gf_w64_euclid; SET_FUNCTION(gf,inverse,w64,gf_w64_euclid)
gf->multiply_region.w64 = gf_w64_multiply_region_from_single; SET_FUNCTION(gf,multiply_region,w64,gf_w64_multiply_region_from_single)
return 1; return 1;
} }
static static
int gf_w64_cfm_init(gf_t *gf) int gf_w64_cfm_init(gf_t *gf)
{ {
gf->inverse.w64 = gf_w64_euclid; SET_FUNCTION(gf,inverse,w64,gf_w64_euclid)
gf->multiply_region.w64 = gf_w64_multiply_region_from_single; SET_FUNCTION(gf,multiply_region,w64,gf_w64_multiply_region_from_single)
#if defined(INTEL_SSE4_PCLMUL) #if defined(INTEL_SSE4_PCLMUL)
gf_internal_t *h; gf_internal_t *h;
@ -715,11 +715,11 @@ int gf_w64_cfm_init(gf_t *gf)
h = (gf_internal_t *) gf->scratch; h = (gf_internal_t *) gf->scratch;
if ((0xfffffffe00000000ULL & h->prim_poly) == 0){ if ((0xfffffffe00000000ULL & h->prim_poly) == 0){
gf->multiply.w64 = gf_w64_clm_multiply_2; SET_FUNCTION(gf,multiply,w64,gf_w64_clm_multiply_2)
gf->multiply_region.w64 = gf_w64_clm_multiply_region_from_single_2; SET_FUNCTION(gf,multiply_region,w64,gf_w64_clm_multiply_region_from_single_2)
}else if((0xfffe000000000000ULL & h->prim_poly) == 0){ }else if((0xfffe000000000000ULL & h->prim_poly) == 0){
gf->multiply.w64 = gf_w64_clm_multiply_4; SET_FUNCTION(gf,multiply,w64,gf_w64_clm_multiply_4)
gf->multiply_region.w64 = gf_w64_clm_multiply_region_from_single_4; SET_FUNCTION(gf,multiply_region,w64,gf_w64_clm_multiply_region_from_single_4)
} else { } else {
return 0; return 0;
} }
@ -1008,14 +1008,14 @@ int gf_w64_group_init(gf_t *gf)
} }
if (g_s == g_r) { if (g_s == g_r) {
gf->multiply.w64 = gf_w64_group_s_equals_r_multiply; SET_FUNCTION(gf,multiply,w64,gf_w64_group_s_equals_r_multiply)
gf->multiply_region.w64 = gf_w64_group_s_equals_r_multiply_region; SET_FUNCTION(gf,multiply_region,w64,gf_w64_group_s_equals_r_multiply_region)
} else { } else {
gf->multiply.w64 = gf_w64_group_multiply; SET_FUNCTION(gf,multiply,w64,gf_w64_group_multiply)
gf->multiply_region.w64 = gf_w64_group_multiply_region; SET_FUNCTION(gf,multiply_region,w64,gf_w64_group_multiply_region)
} }
gf->divide.w64 = NULL; SET_FUNCTION(gf,divide,w64,NULL)
gf->inverse.w64 = gf_w64_euclid; SET_FUNCTION(gf,inverse,w64,gf_w64_euclid)
return 1; return 1;
} }
@ -1455,31 +1455,31 @@ int gf_w64_bytwo_init(gf_t *gf)
h = (gf_internal_t *) gf->scratch; h = (gf_internal_t *) gf->scratch;
if (h->mult_type == GF_MULT_BYTWO_p) { if (h->mult_type == GF_MULT_BYTWO_p) {
gf->multiply.w64 = gf_w64_bytwo_p_multiply; SET_FUNCTION(gf,multiply,w64,gf_w64_bytwo_p_multiply)
#ifdef INTEL_SSE2 #ifdef INTEL_SSE2
if (h->region_type & GF_REGION_NOSIMD) if (h->region_type & GF_REGION_NOSIMD)
gf->multiply_region.w64 = gf_w64_bytwo_p_nosse_multiply_region; SET_FUNCTION(gf,multiply_region,w64,gf_w64_bytwo_p_nosse_multiply_region)
else else
gf->multiply_region.w64 = gf_w64_bytwo_p_sse_multiply_region; SET_FUNCTION(gf,multiply_region,w64,gf_w64_bytwo_p_sse_multiply_region)
#else #else
gf->multiply_region.w64 = gf_w64_bytwo_p_nosse_multiply_region; SET_FUNCTION(gf,multiply_region,w64,gf_w64_bytwo_p_nosse_multiply_region)
if(h->region_type & GF_REGION_SIMD) if(h->region_type & GF_REGION_SIMD)
return 0; return 0;
#endif #endif
} else { } else {
gf->multiply.w64 = gf_w64_bytwo_b_multiply; SET_FUNCTION(gf,multiply,w64,gf_w64_bytwo_b_multiply)
#ifdef INTEL_SSE2 #ifdef INTEL_SSE2
if (h->region_type & GF_REGION_NOSIMD) if (h->region_type & GF_REGION_NOSIMD)
gf->multiply_region.w64 = gf_w64_bytwo_b_nosse_multiply_region; SET_FUNCTION(gf,multiply_region,w64,gf_w64_bytwo_b_nosse_multiply_region)
else else
gf->multiply_region.w64 = gf_w64_bytwo_b_sse_multiply_region; SET_FUNCTION(gf,multiply_region,w64,gf_w64_bytwo_b_sse_multiply_region)
#else #else
gf->multiply_region.w64 = gf_w64_bytwo_b_nosse_multiply_region; SET_FUNCTION(gf,multiply_region,w64,gf_w64_bytwo_b_nosse_multiply_region)
if(h->region_type & GF_REGION_SIMD) if(h->region_type & GF_REGION_SIMD)
return 0; return 0;
#endif #endif
} }
gf->inverse.w64 = gf_w64_euclid; SET_FUNCTION(gf,inverse,w64,gf_w64_euclid)
return 1; return 1;
} }
@ -1653,14 +1653,14 @@ int gf_w64_composite_init(gf_t *gf)
gf_internal_t *h = (gf_internal_t *) gf->scratch; gf_internal_t *h = (gf_internal_t *) gf->scratch;
if (h->region_type & GF_REGION_ALTMAP) { if (h->region_type & GF_REGION_ALTMAP) {
gf->multiply_region.w64 = gf_w64_composite_multiply_region_alt; SET_FUNCTION(gf,multiply_region,w64,gf_w64_composite_multiply_region_alt)
} else { } else {
gf->multiply_region.w64 = gf_w64_composite_multiply_region; SET_FUNCTION(gf,multiply_region,w64,gf_w64_composite_multiply_region)
} }
gf->multiply.w64 = gf_w64_composite_multiply; SET_FUNCTION(gf,multiply,w64,gf_w64_composite_multiply)
gf->divide.w64 = NULL; SET_FUNCTION(gf,divide,w64,NULL)
gf->inverse.w64 = gf_w64_composite_inverse; SET_FUNCTION(gf,inverse,w64,gf_w64_composite_inverse)
return 1; return 1;
} }
@ -1970,9 +1970,9 @@ int gf_w64_split_init(gf_t *gf)
/* Defaults */ /* Defaults */
gf->multiply_region.w64 = gf_w64_multiply_region_from_single; SET_FUNCTION(gf,multiply_region,w64,gf_w64_multiply_region_from_single)
gf->multiply.w64 = gf_w64_bytwo_p_multiply; SET_FUNCTION(gf,multiply,w64,gf_w64_bytwo_p_multiply)
#if defined(INTEL_SSE4_PCLMUL) #if defined(INTEL_SSE4_PCLMUL)
if ((!(h->region_type & GF_REGION_NOSIMD) && if ((!(h->region_type & GF_REGION_NOSIMD) &&
@ -1980,18 +1980,18 @@ int gf_w64_split_init(gf_t *gf)
h->mult_type == GF_MULT_DEFAULT){ h->mult_type == GF_MULT_DEFAULT){
if ((0xfffffffe00000000ULL & h->prim_poly) == 0){ if ((0xfffffffe00000000ULL & h->prim_poly) == 0){
gf->multiply.w64 = gf_w64_clm_multiply_2; SET_FUNCTION(gf,multiply,w64,gf_w64_clm_multiply_2)
gf->multiply_region.w64 = gf_w64_clm_multiply_region_from_single_2; SET_FUNCTION(gf,multiply_region,w64,gf_w64_clm_multiply_region_from_single_2)
}else if((0xfffe000000000000ULL & h->prim_poly) == 0){ }else if((0xfffe000000000000ULL & h->prim_poly) == 0){
gf->multiply.w64 = gf_w64_clm_multiply_4; SET_FUNCTION(gf,multiply,w64,gf_w64_clm_multiply_4)
gf->multiply_region.w64 = gf_w64_clm_multiply_region_from_single_4; SET_FUNCTION(gf,multiply_region,w64,gf_w64_clm_multiply_region_from_single_4)
}else{ }else{
return 0; return 0;
} }
} }
#endif #endif
gf->inverse.w64 = gf_w64_euclid; SET_FUNCTION(gf,inverse,w64,gf_w64_euclid)
/* Allen: set region pointers for default mult type. Single pointers are /* Allen: set region pointers for default mult type. Single pointers are
* taken care of above (explicitly for sse, implicitly for no sse). */ * taken care of above (explicitly for sse, implicitly for no sse). */
@ -2001,7 +2001,7 @@ int gf_w64_split_init(gf_t *gf)
d4 = (struct gf_split_4_64_lazy_data *) h->private; d4 = (struct gf_split_4_64_lazy_data *) h->private;
d4->last_value = 0; d4->last_value = 0;
#if defined(INTEL_SSE4) #if defined(INTEL_SSE4)
gf->multiply_region.w64 = gf_w64_split_4_64_lazy_sse_multiply_region; SET_FUNCTION(gf,multiply_region,w64,gf_w64_split_4_64_lazy_sse_multiply_region)
#elif defined(ARCH_AARCH64) #elif defined(ARCH_AARCH64)
gf_w64_neon_split_init(gf); gf_w64_neon_split_init(gf);
#endif #endif
@ -2010,7 +2010,7 @@ int gf_w64_split_init(gf_t *gf)
if (h->mult_type == GF_MULT_DEFAULT) { if (h->mult_type == GF_MULT_DEFAULT) {
d8 = (struct gf_split_8_64_lazy_data *) h->private; d8 = (struct gf_split_8_64_lazy_data *) h->private;
d8->last_value = 0; d8->last_value = 0;
gf->multiply_region.w64 = gf_w64_split_8_64_lazy_multiply_region; SET_FUNCTION(gf,multiply_region,w64,gf_w64_split_8_64_lazy_multiply_region)
} }
#endif #endif
@ -2022,7 +2022,7 @@ int gf_w64_split_init(gf_t *gf)
if(h->region_type & GF_REGION_ALTMAP) if(h->region_type & GF_REGION_ALTMAP)
{ {
#ifdef INTEL_SSSE3 #ifdef INTEL_SSSE3
gf->multiply_region.w64 = gf_w64_split_4_64_lazy_sse_altmap_multiply_region; SET_FUNCTION(gf,multiply_region,w64,gf_w64_split_4_64_lazy_sse_altmap_multiply_region)
#elif defined(ARCH_AARCH64) #elif defined(ARCH_AARCH64)
gf_w64_neon_split_init(gf); gf_w64_neon_split_init(gf);
#else #else
@ -2033,15 +2033,15 @@ int gf_w64_split_init(gf_t *gf)
{ {
#if defined(INTEL_SSE4) || defined(ARCH_AARCH64) #if defined(INTEL_SSE4) || defined(ARCH_AARCH64)
if(h->region_type & GF_REGION_NOSIMD) if(h->region_type & GF_REGION_NOSIMD)
gf->multiply_region.w64 = gf_w64_split_4_64_lazy_multiply_region; SET_FUNCTION(gf,multiply_region,w64,gf_w64_split_4_64_lazy_multiply_region)
else else
#if defined(INTEL_SSE4) #if defined(INTEL_SSE4)
gf->multiply_region.w64 = gf_w64_split_4_64_lazy_sse_multiply_region; SET_FUNCTION(gf,multiply_region,w64,gf_w64_split_4_64_lazy_sse_multiply_region)
#elif defined(ARCH_AARCH64) #elif defined(ARCH_AARCH64)
gf_w64_neon_split_init(gf); gf_w64_neon_split_init(gf);
#endif #endif
#else #else
gf->multiply_region.w64 = gf_w64_split_4_64_lazy_multiply_region; SET_FUNCTION(gf,multiply_region,w64,gf_w64_split_4_64_lazy_multiply_region)
if(h->region_type & GF_REGION_SIMD) if(h->region_type & GF_REGION_SIMD)
return 0; return 0;
#endif #endif
@ -2050,16 +2050,16 @@ int gf_w64_split_init(gf_t *gf)
if ((h->arg1 == 8 && h->arg2 == 64) || (h->arg1 == 64 && h->arg2 == 8)) { if ((h->arg1 == 8 && h->arg2 == 64) || (h->arg1 == 64 && h->arg2 == 8)) {
d8 = (struct gf_split_8_64_lazy_data *) h->private; d8 = (struct gf_split_8_64_lazy_data *) h->private;
d8->last_value = 0; d8->last_value = 0;
gf->multiply_region.w64 = gf_w64_split_8_64_lazy_multiply_region; SET_FUNCTION(gf,multiply_region,w64,gf_w64_split_8_64_lazy_multiply_region)
} }
if ((h->arg1 == 16 && h->arg2 == 64) || (h->arg1 == 64 && h->arg2 == 16)) { if ((h->arg1 == 16 && h->arg2 == 64) || (h->arg1 == 64 && h->arg2 == 16)) {
d16 = (struct gf_split_16_64_lazy_data *) h->private; d16 = (struct gf_split_16_64_lazy_data *) h->private;
d16->last_value = 0; d16->last_value = 0;
gf->multiply_region.w64 = gf_w64_split_16_64_lazy_multiply_region; SET_FUNCTION(gf,multiply_region,w64,gf_w64_split_16_64_lazy_multiply_region)
} }
if ((h->arg1 == 8 && h->arg2 == 8)) { if ((h->arg1 == 8 && h->arg2 == 8)) {
d88 = (struct gf_split_8_8_data *) h->private; d88 = (struct gf_split_8_8_data *) h->private;
gf->multiply.w64 = gf_w64_split_8_8_multiply; SET_FUNCTION(gf,multiply,w64,gf_w64_split_8_8_multiply)
/* The performance of this guy sucks, so don't bother with a region op */ /* The performance of this guy sucks, so don't bother with a region op */
@ -2169,10 +2169,10 @@ int gf_w64_init(gf_t *gf)
} }
} }
gf->multiply.w64 = NULL; SET_FUNCTION(gf,multiply,w64,NULL)
gf->divide.w64 = NULL; SET_FUNCTION(gf,divide,w64,NULL)
gf->inverse.w64 = NULL; SET_FUNCTION(gf,inverse,w64,NULL)
gf->multiply_region.w64 = NULL; SET_FUNCTION(gf,multiply_region,w64,NULL)
switch(h->mult_type) { switch(h->mult_type) {
case GF_MULT_CARRY_FREE: if (gf_w64_cfm_init(gf) == 0) return 0; break; case GF_MULT_CARRY_FREE: if (gf_w64_cfm_init(gf) == 0) return 0; break;
@ -2186,27 +2186,27 @@ int gf_w64_init(gf_t *gf)
default: return 0; default: return 0;
} }
if (h->divide_type == GF_DIVIDE_EUCLID) { if (h->divide_type == GF_DIVIDE_EUCLID) {
gf->divide.w64 = gf_w64_divide_from_inverse; SET_FUNCTION(gf,divide,w64,gf_w64_divide_from_inverse)
gf->inverse.w64 = gf_w64_euclid; SET_FUNCTION(gf,inverse,w64,gf_w64_euclid)
} }
if (gf->inverse.w64 != NULL && gf->divide.w64 == NULL) { if (gf->inverse.w64 != NULL && gf->divide.w64 == NULL) {
gf->divide.w64 = gf_w64_divide_from_inverse; SET_FUNCTION(gf,divide,w64,gf_w64_divide_from_inverse)
} }
if (gf->inverse.w64 == NULL && gf->divide.w64 != NULL) { if (gf->inverse.w64 == NULL && gf->divide.w64 != NULL) {
gf->inverse.w64 = gf_w64_inverse_from_divide; SET_FUNCTION(gf,inverse,w64,gf_w64_inverse_from_divide)
} }
if (h->region_type == GF_REGION_CAUCHY) return 0; if (h->region_type == GF_REGION_CAUCHY) return 0;
if (h->region_type & GF_REGION_ALTMAP) { if (h->region_type & GF_REGION_ALTMAP) {
if (h->mult_type == GF_MULT_COMPOSITE) { if (h->mult_type == GF_MULT_COMPOSITE) {
gf->extract_word.w64 = gf_w64_composite_extract_word; SET_FUNCTION(gf,extract_word,w64,gf_w64_composite_extract_word)
} else if (h->mult_type == GF_MULT_SPLIT_TABLE) { } else if (h->mult_type == GF_MULT_SPLIT_TABLE) {
gf->extract_word.w64 = gf_w64_split_extract_word; SET_FUNCTION(gf,extract_word,w64,gf_w64_split_extract_word)
} }
} else { } else {
gf->extract_word.w64 = gf_w64_extract_word; SET_FUNCTION(gf,extract_word,w64,gf_w64_extract_word)
} }
return 1; return 1;

View File

@ -514,14 +514,14 @@ int gf_w8_cfm_init(gf_t *gf)
h = (gf_internal_t *) gf->scratch; h = (gf_internal_t *) gf->scratch;
if ((0xe0 & h->prim_poly) == 0){ if ((0xe0 & h->prim_poly) == 0){
gf->multiply.w32 = gf_w8_clm_multiply_2; SET_FUNCTION(gf,multiply,w32,gf_w8_clm_multiply_2)
gf->multiply_region.w32 = gf_w8_clm_multiply_region_from_single_2; SET_FUNCTION(gf,multiply_region,w32,gf_w8_clm_multiply_region_from_single_2)
}else if ((0xc0 & h->prim_poly) == 0){ }else if ((0xc0 & h->prim_poly) == 0){
gf->multiply.w32 = gf_w8_clm_multiply_3; SET_FUNCTION(gf,multiply,w32,gf_w8_clm_multiply_3)
gf->multiply_region.w32 = gf_w8_clm_multiply_region_from_single_3; SET_FUNCTION(gf,multiply_region,w32,gf_w8_clm_multiply_region_from_single_3)
}else if ((0x80 & h->prim_poly) == 0){ }else if ((0x80 & h->prim_poly) == 0){
gf->multiply.w32 = gf_w8_clm_multiply_4; SET_FUNCTION(gf,multiply,w32,gf_w8_clm_multiply_4)
gf->multiply_region.w32 = gf_w8_clm_multiply_region_from_single_4; SET_FUNCTION(gf,multiply_region,w32,gf_w8_clm_multiply_region_from_single_4)
}else{ }else{
return 0; return 0;
} }
@ -537,7 +537,7 @@ int gf_w8_cfm_init(gf_t *gf)
static static
int gf_w8_shift_init(gf_t *gf) int gf_w8_shift_init(gf_t *gf)
{ {
gf->multiply.w32 = gf_w8_shift_multiply; /* The others will be set automatically */ SET_FUNCTION(gf,multiply,w32,gf_w8_shift_multiply) /* The others will be set automatically */
return 1; return 1;
} }
@ -809,20 +809,20 @@ int gf_w8_log_init(gf_t *gf)
} while (i != 1); } while (i != 1);
if (h->mult_type == GF_MULT_LOG_TABLE) { if (h->mult_type == GF_MULT_LOG_TABLE) {
gf->inverse.w32 = gf_w8_log_inverse; SET_FUNCTION(gf,inverse,w32,gf_w8_log_inverse)
gf->divide.w32 = gf_w8_log_divide; SET_FUNCTION(gf,divide,w32,gf_w8_log_divide)
gf->multiply.w32 = gf_w8_log_multiply; SET_FUNCTION(gf,multiply,w32,gf_w8_log_multiply)
gf->multiply_region.w32 = gf_w8_log_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w8_log_multiply_region)
} else if (h->mult_type == GF_MULT_LOG_ZERO) { } else if (h->mult_type == GF_MULT_LOG_ZERO) {
gf->inverse.w32 = gf_w8_logzero_small_inverse; SET_FUNCTION(gf,inverse,w32,gf_w8_logzero_small_inverse)
gf->divide.w32 = gf_w8_logzero_small_divide; SET_FUNCTION(gf,divide,w32,gf_w8_logzero_small_divide)
gf->multiply.w32 = gf_w8_logzero_small_multiply; SET_FUNCTION(gf,multiply,w32,gf_w8_logzero_small_multiply)
gf->multiply_region.w32 = gf_w8_logzero_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w8_logzero_multiply_region)
} else { } else {
gf->inverse.w32 = gf_w8_logzero_inverse; SET_FUNCTION(gf,inverse,w32,gf_w8_logzero_inverse)
gf->divide.w32 = gf_w8_logzero_divide; SET_FUNCTION(gf,divide,w32,gf_w8_logzero_divide)
gf->multiply.w32 = gf_w8_logzero_multiply; SET_FUNCTION(gf,multiply,w32,gf_w8_logzero_multiply)
gf->multiply_region.w32 = gf_w8_logzero_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w8_logzero_multiply_region)
} }
return 1; return 1;
} }
@ -1102,19 +1102,19 @@ int gf_w8_split_init(gf_t *gf)
} }
} }
gf->multiply.w32 = gf_w8_split_multiply; SET_FUNCTION(gf,multiply,w32,gf_w8_split_multiply)
#if defined(INTEL_SSSE3) || defined(ARM_NEON) #if defined(INTEL_SSSE3) || defined(ARM_NEON)
if (h->region_type & GF_REGION_NOSIMD) if (h->region_type & GF_REGION_NOSIMD)
gf->multiply_region.w32 = gf_w8_split_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w8_split_multiply_region)
else else
#if defined(INTEL_SSSE3) #if defined(INTEL_SSSE3)
gf->multiply_region.w32 = gf_w8_split_multiply_region_sse; SET_FUNCTION(gf,multiply_region,w32,gf_w8_split_multiply_region_sse)
#elif defined(ARM_NEON) #elif defined(ARM_NEON)
gf_w8_neon_split_init(gf); gf_w8_neon_split_init(gf);
#endif #endif
#else #else
gf->multiply_region.w32 = gf_w8_split_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w8_split_multiply_region)
if(h->region_type & GF_REGION_SIMD) if(h->region_type & GF_REGION_SIMD)
return 0; return 0;
#endif #endif
@ -1201,29 +1201,29 @@ int gf_w8_table_init(gf_t *gf)
} }
} }
gf->inverse.w32 = NULL; /* Will set from divide */ SET_FUNCTION(gf,inverse,w32,NULL) /* Will set from divide */
switch (scase) { switch (scase) {
case 0: case 0:
gf->divide.w32 = gf_w8_table_divide; SET_FUNCTION(gf,divide,w32,gf_w8_table_divide)
gf->multiply.w32 = gf_w8_table_multiply; SET_FUNCTION(gf,multiply,w32,gf_w8_table_multiply)
gf->multiply_region.w32 = gf_w8_table_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w8_table_multiply_region)
break; break;
case 1: case 1:
gf->divide.w32 = gf_w8_double_table_divide; SET_FUNCTION(gf,divide,w32,gf_w8_double_table_divide)
gf->multiply.w32 = gf_w8_double_table_multiply; SET_FUNCTION(gf,multiply,w32,gf_w8_double_table_multiply)
gf->multiply_region.w32 = gf_w8_double_table_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w8_double_table_multiply_region)
break; break;
case 2: case 2:
gf->divide.w32 = gf_w8_double_table_lazy_divide; SET_FUNCTION(gf,divide,w32,gf_w8_double_table_lazy_divide)
gf->multiply.w32 = gf_w8_double_table_lazy_multiply; SET_FUNCTION(gf,multiply,w32,gf_w8_double_table_lazy_multiply)
gf->multiply_region.w32 = gf_w8_double_table_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w8_double_table_multiply_region)
break; break;
case 3: case 3:
#if defined(INTEL_SSSE3) || defined(ARM_NEON) #if defined(INTEL_SSSE3) || defined(ARM_NEON)
gf->divide.w32 = gf_w8_default_divide; SET_FUNCTION(gf,divide,w32,gf_w8_default_divide)
gf->multiply.w32 = gf_w8_default_multiply; SET_FUNCTION(gf,multiply,w32,gf_w8_default_multiply)
#if defined(INTEL_SSSE3) #if defined(INTEL_SSSE3)
gf->multiply_region.w32 = gf_w8_split_multiply_region_sse; SET_FUNCTION(gf,multiply_region,w32,gf_w8_split_multiply_region_sse)
#elif defined(ARM_NEON) #elif defined(ARM_NEON)
gf_w8_neon_split_init(gf); gf_w8_neon_split_init(gf);
#endif #endif
@ -1472,18 +1472,18 @@ int gf_w8_composite_init(gf_t *gf)
cd->mult_table = gf_w4_get_mult_table(h->base_gf); cd->mult_table = gf_w4_get_mult_table(h->base_gf);
if (h->region_type & GF_REGION_ALTMAP) { if (h->region_type & GF_REGION_ALTMAP) {
gf->multiply_region.w32 = gf_w8_composite_multiply_region_alt; SET_FUNCTION(gf,multiply_region,w32,gf_w8_composite_multiply_region_alt)
} else { } else {
gf->multiply_region.w32 = gf_w8_composite_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w8_composite_multiply_region)
} }
if (cd->mult_table == NULL) { if (cd->mult_table == NULL) {
gf->multiply.w32 = gf_w8_composite_multiply_recursive; SET_FUNCTION(gf,multiply,w32,gf_w8_composite_multiply_recursive)
} else { } else {
gf->multiply.w32 = gf_w8_composite_multiply_inline; SET_FUNCTION(gf,multiply,w32,gf_w8_composite_multiply_inline)
} }
gf->divide.w32 = NULL; SET_FUNCTION(gf,divide,w32,NULL)
gf->inverse.w32 = gf_w8_composite_inverse; SET_FUNCTION(gf,inverse,w32,gf_w8_composite_inverse)
return 1; return 1;
} }
@ -2190,26 +2190,26 @@ int gf_w8_bytwo_init(gf_t *gf)
} }
if (h->mult_type == GF_MULT_BYTWO_p) { if (h->mult_type == GF_MULT_BYTWO_p) {
gf->multiply.w32 = gf_w8_bytwo_p_multiply; SET_FUNCTION(gf,multiply,w32,gf_w8_bytwo_p_multiply)
#ifdef INTEL_SSE2 #ifdef INTEL_SSE2
if (h->region_type & GF_REGION_NOSIMD) if (h->region_type & GF_REGION_NOSIMD)
gf->multiply_region.w32 = gf_w8_bytwo_p_nosse_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w8_bytwo_p_nosse_multiply_region)
else else
gf->multiply_region.w32 = gf_w8_bytwo_p_sse_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w8_bytwo_p_sse_multiply_region)
#else #else
gf->multiply_region.w32 = gf_w8_bytwo_p_nosse_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w8_bytwo_p_nosse_multiply_region)
if(h->region_type & GF_REGION_SIMD) if(h->region_type & GF_REGION_SIMD)
return 0; return 0;
#endif #endif
} else { } else {
gf->multiply.w32 = gf_w8_bytwo_b_multiply; SET_FUNCTION(gf,multiply,w32,gf_w8_bytwo_b_multiply)
#ifdef INTEL_SSE2 #ifdef INTEL_SSE2
if (h->region_type & GF_REGION_NOSIMD) if (h->region_type & GF_REGION_NOSIMD)
gf->multiply_region.w32 = gf_w8_bytwo_b_nosse_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w8_bytwo_b_nosse_multiply_region)
else else
gf->multiply_region.w32 = gf_w8_bytwo_b_sse_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w8_bytwo_b_sse_multiply_region)
#else #else
gf->multiply_region.w32 = gf_w8_bytwo_b_nosse_multiply_region; SET_FUNCTION(gf,multiply_region,w32,gf_w8_bytwo_b_nosse_multiply_region)
if(h->region_type & GF_REGION_SIMD) if(h->region_type & GF_REGION_SIMD)
return 0; return 0;
#endif #endif
@ -2304,11 +2304,11 @@ int gf_w8_init(gf_t *gf)
h->prim_poly |= 0x100; h->prim_poly |= 0x100;
} }
gf->multiply.w32 = NULL; SET_FUNCTION(gf,multiply,w32,NULL)
gf->divide.w32 = NULL; SET_FUNCTION(gf,divide,w32,NULL)
gf->inverse.w32 = NULL; SET_FUNCTION(gf,inverse,w32,NULL)
gf->multiply_region.w32 = NULL; SET_FUNCTION(gf,multiply_region,w32,NULL)
gf->extract_word.w32 = gf_w8_extract_word; SET_FUNCTION(gf,extract_word,w32,gf_w8_extract_word)
switch(h->mult_type) { switch(h->mult_type) {
case GF_MULT_DEFAULT: case GF_MULT_DEFAULT:
@ -2326,31 +2326,31 @@ int gf_w8_init(gf_t *gf)
} }
if (h->divide_type == GF_DIVIDE_EUCLID) { if (h->divide_type == GF_DIVIDE_EUCLID) {
gf->divide.w32 = gf_w8_divide_from_inverse; SET_FUNCTION(gf,divide,w32,gf_w8_divide_from_inverse)
gf->inverse.w32 = gf_w8_euclid; SET_FUNCTION(gf,inverse,w32,gf_w8_euclid)
} else if (h->divide_type == GF_DIVIDE_MATRIX) { } else if (h->divide_type == GF_DIVIDE_MATRIX) {
gf->divide.w32 = gf_w8_divide_from_inverse; SET_FUNCTION(gf,divide,w32,gf_w8_divide_from_inverse)
gf->inverse.w32 = gf_w8_matrix; SET_FUNCTION(gf,inverse,w32,gf_w8_matrix)
} }
if (gf->divide.w32 == NULL) { if (gf->divide.w32 == NULL) {
gf->divide.w32 = gf_w8_divide_from_inverse; SET_FUNCTION(gf,divide,w32,gf_w8_divide_from_inverse)
if (gf->inverse.w32 == NULL) gf->inverse.w32 = gf_w8_euclid; if (gf->inverse.w32 == NULL) SET_FUNCTION(gf,inverse,w32,gf_w8_euclid)
} }
if (gf->inverse.w32 == NULL) gf->inverse.w32 = gf_w8_inverse_from_divide; if (gf->inverse.w32 == NULL) SET_FUNCTION(gf,inverse,w32,gf_w8_inverse_from_divide)
if (h->mult_type == GF_MULT_COMPOSITE && (h->region_type & GF_REGION_ALTMAP)) { if (h->mult_type == GF_MULT_COMPOSITE && (h->region_type & GF_REGION_ALTMAP)) {
gf->extract_word.w32 = gf_w8_composite_extract_word; SET_FUNCTION(gf,extract_word,w32,gf_w8_composite_extract_word)
} }
if (h->region_type == GF_REGION_CAUCHY) { if (h->region_type == GF_REGION_CAUCHY) {
gf->multiply_region.w32 = gf_wgen_cauchy_region; SET_FUNCTION(gf,multiply_region,w32,gf_wgen_cauchy_region)
gf->extract_word.w32 = gf_wgen_extract_word; SET_FUNCTION(gf,extract_word,w32,gf_wgen_extract_word)
} }
if (gf->multiply_region.w32 == NULL) { if (gf->multiply_region.w32 == NULL) {
gf->multiply_region.w32 = gf_w8_multiply_region_from_single; SET_FUNCTION(gf,multiply_region,w32,gf_w8_multiply_region_from_single)
} }
return 1; return 1;

View File

@ -178,8 +178,8 @@ gf_wgen_shift_multiply (gf_t *gf, uint32_t a32, uint32_t b32)
static static
int gf_wgen_shift_init(gf_t *gf) int gf_wgen_shift_init(gf_t *gf)
{ {
gf->multiply.w32 = gf_wgen_shift_multiply; SET_FUNCTION(gf,multiply,w32,gf_wgen_shift_multiply)
gf->inverse.w32 = gf_wgen_euclid; SET_FUNCTION(gf,inverse,w32,gf_wgen_euclid)
return 1; return 1;
} }
@ -211,8 +211,8 @@ gf_wgen_bytwo_b_multiply (gf_t *gf, gf_val_32_t a, gf_val_32_t b)
static static
int gf_wgen_bytwo_b_init(gf_t *gf) int gf_wgen_bytwo_b_init(gf_t *gf)
{ {
gf->multiply.w32 = gf_wgen_bytwo_b_multiply; SET_FUNCTION(gf,multiply,w32,gf_wgen_bytwo_b_multiply)
gf->inverse.w32 = gf_wgen_euclid; SET_FUNCTION(gf,inverse,w32,gf_wgen_euclid)
return 1; return 1;
} }
@ -247,8 +247,8 @@ gf_wgen_bytwo_p_multiply (gf_t *gf, gf_val_32_t a, gf_val_32_t b)
static static
int gf_wgen_bytwo_p_init(gf_t *gf) int gf_wgen_bytwo_p_init(gf_t *gf)
{ {
gf->multiply.w32 = gf_wgen_bytwo_p_multiply; SET_FUNCTION(gf,multiply,w32,gf_wgen_bytwo_p_multiply)
gf->inverse.w32 = gf_wgen_euclid; SET_FUNCTION(gf,inverse,w32,gf_wgen_euclid)
return 1; return 1;
} }
@ -453,12 +453,12 @@ int gf_wgen_group_init(gf_t *gf)
} }
if (g_s == g_r) { if (g_s == g_r) {
gf->multiply.w32 = gf_wgen_group_s_equals_r_multiply; SET_FUNCTION(gf,multiply,w32,gf_wgen_group_s_equals_r_multiply)
} else { } else {
gf->multiply.w32 = gf_wgen_group_multiply; SET_FUNCTION(gf,multiply,w32,gf_wgen_group_multiply)
} }
gf->divide.w32 = NULL; SET_FUNCTION(gf,divide,w32,NULL)
gf->divide.w32 = NULL; SET_FUNCTION(gf,divide,w32,NULL)
return 1; return 1;
} }
@ -519,8 +519,8 @@ int gf_wgen_table_8_init(gf_t *gf)
} }
} }
gf->multiply.w32 = gf_wgen_table_8_multiply; SET_FUNCTION(gf,multiply,w32,gf_wgen_table_8_multiply)
gf->divide.w32 = gf_wgen_table_8_divide; SET_FUNCTION(gf,divide,w32,gf_wgen_table_8_divide)
return 1; return 1;
} }
@ -580,8 +580,8 @@ int gf_wgen_table_16_init(gf_t *gf)
} }
} }
gf->multiply.w32 = gf_wgen_table_16_multiply; SET_FUNCTION(gf,multiply,w32,gf_wgen_table_16_multiply)
gf->divide.w32 = gf_wgen_table_16_divide; SET_FUNCTION(gf,divide,w32,gf_wgen_table_16_divide)
return 1; return 1;
} }
@ -670,8 +670,8 @@ int gf_wgen_log_8_init(gf_t *gf)
return 0; return 0;
} }
gf->multiply.w32 = gf_wgen_log_8_multiply; SET_FUNCTION(gf,multiply,w32,gf_wgen_log_8_multiply)
gf->divide.w32 = gf_wgen_log_8_divide; SET_FUNCTION(gf,divide,w32,gf_wgen_log_8_divide)
return 1; return 1;
} }
@ -746,8 +746,8 @@ int gf_wgen_log_16_init(gf_t *gf)
return 0; return 0;
} }
gf->multiply.w32 = gf_wgen_log_16_multiply; SET_FUNCTION(gf,multiply,w32,gf_wgen_log_16_multiply)
gf->divide.w32 = gf_wgen_log_16_divide; SET_FUNCTION(gf,divide,w32,gf_wgen_log_16_divide)
return 1; return 1;
} }
@ -821,8 +821,8 @@ int gf_wgen_log_32_init(gf_t *gf)
return 0; return 0;
} }
gf->multiply.w32 = gf_wgen_log_32_multiply; SET_FUNCTION(gf,multiply,w32,gf_wgen_log_32_multiply)
gf->divide.w32 = gf_wgen_log_32_divide; SET_FUNCTION(gf,divide,w32,gf_wgen_log_32_divide)
return 1; return 1;
} }
@ -975,11 +975,11 @@ int gf_wgen_init(gf_t *gf)
} }
} }
gf->multiply.w32 = NULL; SET_FUNCTION(gf,multiply,w32,NULL)
gf->divide.w32 = NULL; SET_FUNCTION(gf,divide,w32,NULL)
gf->inverse.w32 = NULL; SET_FUNCTION(gf,inverse,w32,NULL)
gf->multiply_region.w32 = gf_wgen_cauchy_region; SET_FUNCTION(gf,multiply_region,w32,gf_wgen_cauchy_region)
gf->extract_word.w32 = gf_wgen_extract_word; SET_FUNCTION(gf,extract_word,w32,gf_wgen_extract_word)
switch(h->mult_type) { switch(h->mult_type) {
case GF_MULT_DEFAULT: case GF_MULT_DEFAULT:
@ -1000,20 +1000,20 @@ int gf_wgen_init(gf_t *gf)
default: return 0; default: return 0;
} }
if (h->divide_type == GF_DIVIDE_EUCLID) { if (h->divide_type == GF_DIVIDE_EUCLID) {
gf->divide.w32 = gf_wgen_divide_from_inverse; SET_FUNCTION(gf,divide,w32,gf_wgen_divide_from_inverse)
gf->inverse.w32 = gf_wgen_euclid; SET_FUNCTION(gf,inverse,w32,gf_wgen_euclid)
} else if (h->divide_type == GF_DIVIDE_MATRIX) { } else if (h->divide_type == GF_DIVIDE_MATRIX) {
gf->divide.w32 = gf_wgen_divide_from_inverse; SET_FUNCTION(gf,divide,w32,gf_wgen_divide_from_inverse)
gf->inverse.w32 = gf_wgen_matrix; SET_FUNCTION(gf,inverse,w32,gf_wgen_matrix)
} }
if (gf->inverse.w32== NULL && gf->divide.w32 == NULL) gf->inverse.w32 = gf_wgen_euclid; if (gf->inverse.w32== NULL && gf->divide.w32 == NULL) SET_FUNCTION(gf,inverse,w32,gf_wgen_euclid)
if (gf->inverse.w32 != NULL && gf->divide.w32 == NULL) { if (gf->inverse.w32 != NULL && gf->divide.w32 == NULL) {
gf->divide.w32 = gf_wgen_divide_from_inverse; SET_FUNCTION(gf,divide,w32,gf_wgen_divide_from_inverse)
} }
if (gf->inverse.w32 == NULL && gf->divide.w32 != NULL) { if (gf->inverse.w32 == NULL && gf->divide.w32 != NULL) {
gf->inverse.w32 = gf_wgen_inverse_from_divide; SET_FUNCTION(gf,inverse,w32,gf_wgen_inverse_from_divide)
} }
return 1; return 1;
} }

View File

@ -270,7 +270,7 @@ void gf_w16_neon_split_init(gf_t *gf)
gf_internal_t *h = (gf_internal_t *) gf->scratch; gf_internal_t *h = (gf_internal_t *) gf->scratch;
if (h->region_type & GF_REGION_ALTMAP) if (h->region_type & GF_REGION_ALTMAP)
gf->multiply_region.w32 = gf_w16_split_4_16_lazy_altmap_multiply_region_neon; SET_FUNCTION(gf,multiply_region,w32,gf_w16_split_4_16_lazy_altmap_multiply_region_neon)
else else
gf->multiply_region.w32 = gf_w16_split_4_16_lazy_multiply_region_neon; SET_FUNCTION(gf,multiply_region,w32,gf_w16_split_4_16_lazy_multiply_region_neon)
} }

View File

@ -262,8 +262,8 @@ void gf_w32_neon_split_init(gf_t *gf)
gf_internal_t *h = (gf_internal_t *) gf->scratch; gf_internal_t *h = (gf_internal_t *) gf->scratch;
if (h->region_type & GF_REGION_ALTMAP) if (h->region_type & GF_REGION_ALTMAP)
gf->multiply_region.w32 = gf_w32_split_4_32_lazy_altmap_multiply_region_neon; SET_FUNCTION(gf,multiply_region,w32,gf_w32_split_4_32_lazy_altmap_multiply_region_neon)
else else
gf->multiply_region.w32 = gf_w32_split_4_32_lazy_multiply_region_neon; SET_FUNCTION(gf,multiply_region,w32,gf_w32_split_4_32_lazy_multiply_region_neon)
} }

View File

@ -235,13 +235,13 @@ gf_w4_single_table_multiply_region_neon(gf_t *gf, void *src, void *dest,
int gf_w4_neon_cfm_init(gf_t *gf) int gf_w4_neon_cfm_init(gf_t *gf)
{ {
// single clm multiplication probably pointless // single clm multiplication probably pointless
gf->multiply.w32 = gf_w4_neon_clm_multiply; SET_FUNCTION(gf,multiply,w32,gf_w4_neon_clm_multiply)
gf->multiply_region.w32 = gf_w4_neon_clm_multiply_region_from_single; SET_FUNCTION(gf,multiply_region,w32,gf_w4_neon_clm_multiply_region_from_single)
return 1; return 1;
} }
void gf_w4_neon_single_table_init(gf_t *gf) void gf_w4_neon_single_table_init(gf_t *gf)
{ {
gf->multiply_region.w32 = gf_w4_single_table_multiply_region_neon; SET_FUNCTION(gf,multiply_region,w32,gf_w4_single_table_multiply_region_neon)
} }

View File

@ -326,8 +326,8 @@ void gf_w64_neon_split_init(gf_t *gf)
gf_internal_t *h = (gf_internal_t *) gf->scratch; gf_internal_t *h = (gf_internal_t *) gf->scratch;
if (h->region_type & GF_REGION_ALTMAP) if (h->region_type & GF_REGION_ALTMAP)
gf->multiply_region.w64 = gf_w64_split_4_64_lazy_altmap_multiply_region_neon; SET_FUNCTION(gf,multiply_region,w64,gf_w64_split_4_64_lazy_altmap_multiply_region_neon)
else else
gf->multiply_region.w64 = gf_w64_split_4_64_lazy_multiply_region_neon; SET_FUNCTION(gf,multiply_region,w64,gf_w64_split_4_64_lazy_multiply_region_neon)
} }

View File

@ -188,14 +188,14 @@ int gf_w8_neon_cfm_init(gf_t *gf)
h = (gf_internal_t *) gf->scratch; h = (gf_internal_t *) gf->scratch;
if ((0xe0 & h->prim_poly) == 0){ if ((0xe0 & h->prim_poly) == 0){
gf->multiply.w32 = gf_w8_neon_clm_multiply_2; SET_FUNCTION(gf,multiply,w32,gf_w8_neon_clm_multiply_2)
gf->multiply_region.w32 = gf_w8_neon_clm_multiply_region_from_single_2; SET_FUNCTION(gf,multiply_region,w32,gf_w8_neon_clm_multiply_region_from_single_2)
}else if ((0xc0 & h->prim_poly) == 0){ }else if ((0xc0 & h->prim_poly) == 0){
gf->multiply.w32 = gf_w8_neon_clm_multiply_3; SET_FUNCTION(gf,multiply,w32,gf_w8_neon_clm_multiply_3)
gf->multiply_region.w32 = gf_w8_neon_clm_multiply_region_from_single_3; SET_FUNCTION(gf,multiply_region,w32,gf_w8_neon_clm_multiply_region_from_single_3)
}else if ((0x80 & h->prim_poly) == 0){ }else if ((0x80 & h->prim_poly) == 0){
gf->multiply.w32 = gf_w8_neon_clm_multiply_4; SET_FUNCTION(gf,multiply,w32,gf_w8_neon_clm_multiply_4)
gf->multiply_region.w32 = gf_w8_neon_clm_multiply_region_from_single_4; SET_FUNCTION(gf,multiply_region,w32,gf_w8_neon_clm_multiply_region_from_single_4)
}else{ }else{
return 0; return 0;
} }
@ -298,5 +298,5 @@ gf_w8_split_multiply_region_neon(gf_t *gf, void *src, void *dest, gf_val_32_t va
void gf_w8_neon_split_init(gf_t *gf) void gf_w8_neon_split_init(gf_t *gf)
{ {
gf->multiply_region.w32 = gf_w8_split_multiply_region_neon; SET_FUNCTION(gf,multiply_region,w32,gf_w8_split_multiply_region_neon)
} }

View File

@ -39,7 +39,7 @@ static char *divides[NDIVS] = { "MATRIX", "EUCLID" };
void usage(char *s) void usage(char *s)
{ {
fprintf(stderr, "usage: gf_methods w -BADC -LUMDRB\n"); fprintf(stderr, "usage: gf_methods w -BADC -LXUMDRB\n");
fprintf(stderr, "\n"); fprintf(stderr, "\n");
fprintf(stderr, " w can be 1-32, 64, 128\n"); fprintf(stderr, " w can be 1-32, 64, 128\n");
fprintf(stderr, "\n"); fprintf(stderr, "\n");
@ -50,6 +50,7 @@ void usage(char *s)
fprintf(stderr, " Combinations are fine.\n"); fprintf(stderr, " Combinations are fine.\n");
fprintf(stderr, "\n"); fprintf(stderr, "\n");
fprintf(stderr, " -L Simply lists methods\n"); fprintf(stderr, " -L Simply lists methods\n");
fprintf(stderr, " -X List methods and functions selected (compile with DEBUG_FUNCTIONS)\n");
fprintf(stderr, " -U Produces calls to gf_unit\n"); fprintf(stderr, " -U Produces calls to gf_unit\n");
fprintf(stderr, " -M Produces calls to time_tool.sh for single multiplications\n"); fprintf(stderr, " -M Produces calls to time_tool.sh for single multiplications\n");
fprintf(stderr, " -D Produces calls to time_tool.sh for single divisions\n"); fprintf(stderr, " -D Produces calls to time_tool.sh for single divisions\n");
@ -63,6 +64,19 @@ void usage(char *s)
exit(1); exit(1);
} }
void print_methods(gf_t *gf)
{
#ifdef DEBUG_FUNCTIONS
gf_internal_t *h = (gf_internal_t*) gf->scratch;
printf("multiply = %s\n", h->multiply);
printf("divide = %s\n", h->divide);
printf("inverse = %s\n", h->inverse);
printf("multiply_region = %s\n", h->multiply_region);
printf("extract_word = %s\n", h->extract_word);
#endif
}
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
int m, r, d, w, i, sa, j, k, reset, ok; int m, r, d, w, i, sa, j, k, reset, ok;
@ -99,12 +113,12 @@ int main(int argc, char *argv[])
} }
} }
if (strchr("LUMDRB", argv[3][1]) == NULL) { usage("Bad -LUMDRB"); } if (strchr("LXUMDRB", argv[3][1]) == NULL) { usage("Bad -LXUMDRB"); }
listing = argv[3][1]; listing = argv[3][1];
if (listing == 'U') { if (listing == 'U') {
w_str = "../test/gf_unit %d A -1"; w_str = "../test/gf_unit %d A -1";
} else if (listing == 'L') { } else if (listing == 'L' || listing == 'X') {
w_str = "w=%d:"; w_str = "w=%d:";
} else { } else {
w_str = strdup("sh time_tool.sh X %d"); w_str = strdup("sh time_tool.sh X %d");
@ -192,6 +206,8 @@ int main(int argc, char *argv[])
printf(w_str, w); printf(w_str, w);
for (j = 0; j < sa; j++) printf(" %s", gf_argv[j]); for (j = 0; j < sa; j++) printf(" %s", gf_argv[j]);
printf("\n"); printf("\n");
if (listing == 'X')
print_methods(&gf);
gf_free(&gf, 1); gf_free(&gf, 1);
} else if (_gf_errno == GF_E_DEFAULT) { } else if (_gf_errno == GF_E_DEFAULT) {
fprintf(stderr, "Unlabeled failed method: w=%d:", w); fprintf(stderr, "Unlabeled failed method: w=%d:", w);
@ -212,6 +228,8 @@ int main(int argc, char *argv[])
printf(w_str, w); printf(w_str, w);
for (j = 0; j < sa; j++) printf(" %s", gf_argv[j]); for (j = 0; j < sa; j++) printf(" %s", gf_argv[j]);
printf("\n"); printf("\n");
if (listing == 'X')
print_methods(&gf);
gf_free(&gf, 1); gf_free(&gf, 1);
} else if (_gf_errno == GF_E_DEFAULT) { } else if (_gf_errno == GF_E_DEFAULT) {
fprintf(stderr, "Unlabeled failed method: w=%d:", w); fprintf(stderr, "Unlabeled failed method: w=%d:", w);