25 #include "pips_config.h"
32 #include "resources.h"
53 #define VECTOR_POSTFIX "vec"
107 int index_loaded = 0;
112 perms[index_loaded] = index_perm;
150 size_t nb_expressions =
gen_length(expressions);
153 else if(nb_expressions <= 8 ) {
154 int perm [1+nb_expressions];
155 perm[nb_expressions]=0;
171 bool invalidate=
false;
183 if(invalidate)
break;
281 for(
int i=0; i<n;i++)
284 if(curr > elem_size) elem_size=curr;
289 "to partially filled register\n", name);
307 bool bTagDiff =
false;
310 for(i = 0; i < argc; i++)
340 if(width>mwidth)mwidth=width;
476 pips_debug(3,
"distance between %s and %s is %"PRIdPTR
"\n",
479 result= idistance == ref_offset+ref_offset*lastOffset;
482 pips_debug(3,
"distance between %s and %s is too complexd\n",
496 string result = NULL;
562 case 8:
prefix[2] =
'q';
break;
563 case 16:
prefix[2] =
'h';
break;
564 case 32:
prefix[2] =
's';
break;
565 case 64:
prefix[2] =
'd';
break;
612 if( strstr(ename,pattern0) )
614 else if( strstr(ename,pattern1) )
645 #define SAC_ALIGNED_VECTOR_NAME "pdata"
673 static int number = 0;
681 case 8:
prefix[2] =
'q';
break;
682 case 16:
prefix[2] =
'h';
break;
683 case 32:
prefix[2] =
's';
break;
684 case 64:
prefix[2] =
'd';
break;
706 pips_assert(
"buffer doesnot overflow",number<10000);
707 sprintf(name,
"%s%u", vname,number++);
787 isLoad?realVectName:lsTypeTmp,
788 isLoad?lsTypeTmp:realVectName);
804 static char *funcNames[6][2] = { { NULL,NULL},{NULL,NULL},{NULL,NULL},{NULL,NULL}};
805 if(!funcNames[0][0]) {
821 bool all_scalar =
false;
822 bool all_same_aligned_ref =
false;
823 bool all_same_ref =
true;
847 argsType = CONSEC_REFS;
864 if (argsType == OTHER)
880 else if (argsType == CONSEC_REFS)
903 pips_assert(
"all reference are the same, so it's an 'other' kind\n",argsType==OTHER);
973 for(
list iter = replacements;!
ENDP(iter);
POP(iter))
995 argsType=CONSEC_REFS;
999 if(all_same_aligned_ref)
1001 argsType=CONSEC_REFS;
1010 char* tofree = NULL;
1014 case MASKED_CONSEC_REFS:
1061 asprintf(&functionName,
"%s%s", funcNames[argsType][isLoad], lsType);
1062 if(tofree)
free(tofree);
1079 if (perms[0] == 4 && perms[1] == 3 && perms[2] == 2 && perms[3] == 1) {
1080 asprintf(&sshuffle,
"SIMD_INVERT_%s",
1095 asprintf(&sshuffle,
"SIMD_SHUFFLE_%s",
1151 register void * hiter = NULL;
1179 for(
int i=nbargs-1; i>=0; i--)
1197 list first = statements;
1218 for( index = 0, j = i;
1220 index++, j =
CDR(j) )
1240 pips_debug(3,
"make_simd_statements : simd\n");
int get_int_property(const string)
call make_call(entity a1, list a2)
basic make_basic_typedef(entity _field_)
value make_value_unknown(void)
value make_value_expression(expression _field_)
syntax make_syntax_call(call _field_)
expression make_expression(syntax a1, normalized a2)
type make_type_variable(variable _field_)
storage make_storage_rom(void)
syntax make_syntax_sizeofexpression(sizeofexpression _field_)
type copy_type(type p)
TYPE.
void free_reference(reference p)
basic make_basic_int(intptr_t _field_)
expression copy_expression(expression p)
EXPRESSION.
reference make_reference(entity a1, list a2)
basic make_basic_float(intptr_t _field_)
dimension make_dimension(expression a1, expression a2, list a3)
sizeofexpression make_sizeofexpression_type(type _field_)
variable make_variable(basic a1, list a2, list a3)
instruction make_instruction_call(call _field_)
value copy_value(value p)
VALUE.
bool expression_consistent_p(expression p)
void free_expression(expression p)
reference copy_reference(reference p)
REFERENCE.
bool entity_consistent_p(entity p)
simdstatement make_simdstatement(opcode a1, intptr_t a2, entity *a3, expression *a4)
opcode make_opcode(string a1, intptr_t a2, list a3, float a4)
@ QI_REF_TOK
REFERENCE_TOK
list load_proper_rw_effects_list(statement)
#define effect_any_reference(e)
FI: cannot be used as a left hand side.
const char * local_name(const char *s)
Does not take care of block scopes and returns a pointer.
char * get_string_property(const char *)
bool get_bool_property(const string)
FC 2015-07-20: yuk, moved out to prevent an include cycle dependency include "properties....
union gen_chunk * gen_chunkp
void gen_full_free_list(list l)
bool references_may_conflict_p(reference r1, reference r2)
Check if two references may conflict.
statement make_block_statement(list)
Make a block statement from a list of statement.
statement instruction_to_statement(instruction)
Build a statement from a give instruction.
statement get_current_module_statement(void)
Get the current module statement.
entity get_current_module_entity(void)
Get the entity of the current module.
void replace_entity(void *s, entity old, entity new)
per variable version of replace_entities.
void replace_entity_by_expression(void *s, entity ent, expression exp)
replace all reference to entity ent by expression exp in s.
#define ENDP(l)
Test if a list is empty.
list gen_nreverse(list cp)
reverse a list in place
#define POP(l)
Modify a list pointer to point on the next element of the list.
void gen_remove_once(list *pl, const void *o)
Remove the first occurence of o in list pl:
#define REFCAR(pc)
Get the adress of the first element of a list.
#define NIL
The empty list (nil in Lisp)
list gen_copy_seq(list l)
Copy a list structure.
size_t gen_length(const list l)
list gen_cons(const void *item, const list next)
#define CONS(_t_, _i_, _l_)
List element cell constructor (insert an element at the beginning of a list)
#define CAR(pcons)
Get the value of the first element of a list.
void gen_free_list(list l)
free the spine of the list
list gen_last(list l)
Return the last element of a list.
#define FOREACH(_fe_CASTER, _fe_item, _fe_list)
Apply/map an instruction block on all the elements of a list.
#define CDR(pcons)
Get the list less its first element.
gen_chunk gen_nth(int n, const list l)
to be used as ENTITY(gen_nth(3, l))...
list gen_full_copy_list(list l)
Copy a list structure with element copy.
bool gen_equals(const list l0, const list l1, gen_eq_func_t equals)
compares two lists using the functor given in parameters returns true if for all n,...
statement make_assign_statement(expression, expression)
void insert_statement(statement, statement, bool)
This is the normal entry point.
hash_table hash_table_make(hash_key_type key_type, size_t size)
void hash_put(hash_table htp, const void *key, const void *val)
This functions stores a couple (key,val) in the hash table pointed to by htp.
void hash_table_free(hash_table htp)
this function deletes a hash table that is no longer useful.
void * hash_del(hash_table htp, const void *key)
this function removes from the hash table pointed to by htp the couple whose key is equal to key.
void * hash_table_scan(hash_table htp, void *hentryp_arg, void **pkey, void **pval)
bool expression_constant_p(expression)
HPFC module by Fabien COELHO.
#define new_statements(p)
#define _
A substitute for POSIX 2008 <stddef.h>, for platforms that have issues.
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
#define pips_user_warning
#define same_stringn_p(a, b, c)
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
#define pips_internal_error
#define TOP_LEVEL_MODULE_NAME
Module containing the global variables in Fortran and C.
string strlower(string, const char *)
string strupper(string, const char *)
string concatenate(const char *,...)
Return the concatenation of the given strings.
#define hash_put_or_update(h, k, v)
#define HASH_FOREACH(key_type, k, value_type, v, ht)
#define hash_table_undefined_p(h)
#define hash_table_undefined
Value of an undefined hash_table.
#define HASH_DEFAULT_SIZE
#define same_string_p(s1, s2)
list set_to_list(const set)
create a list from a set the set is not freed
bool(* gen_eq_func_t)(const void *, const void *)
string expression_to_string(expression e)
void set_bool_property(const char *, bool)
static const char * prefix
#define make_expression_list(stats...)
#define binary_call_rhs(c)
#define MINUS_OPERATOR_NAME
#define PLUS_OPERATOR_NAME
#define NORMALIZE_EXPRESSION(e)
#define expression_scalar_p(e)
#define call_to_statement(c)
#define ADDRESS_OF_OPERATOR_NAME
#define binary_call_lhs(c)
#define MULTIPLY_OPERATOR_NAME
const char * entity_user_name(entity e)
Since entity_local_name may contain PIPS special characters such as prefixes (label,...
entity FindEntity(const char *package, const char *name)
Retrieve an entity from its package/module name and its local name.
const char * entity_local_name(entity e)
entity_local_name modified so that it does not core when used in vect_fprint, since someone thought t...
entity FindOrCreateEntity(const char *package, const char *local_name)
Problem: A functional global entity may be referenced without parenthesis or CALL keyword in a functi...
entity entity_field_to_entity_struct(entity f)
bool same_entity_p(entity e1, entity e2)
predicates on entities
bool c_module_p(entity m)
Test if a module "m" is written in C.
bool same_struct_entity_p(const entity e0, const entity e1)
entity make_entity_copy(entity e)
Create a copy of an entity, with (almost) identical type, storage and initial value if move_initializ...
bool entity_field_p(entity e)
e is the field of a structure
bool fortran_module_p(entity m)
Test if a module is in Fortran.
entity module_name_to_runtime_entity(const char *name)
similar to module_name_to_entity but generates a warning and a stub if the entity is not found
entity entity_intrinsic(const char *name)
FI: I do not understand this function name (see next one!).
bool expression_integer_value(expression e, intptr_t *pval)
expression reference_to_expression(reference r)
expression make_entity_expression(entity e, cons *inds)
bool simplify_expression(expression *pexp)
use polynomials to simplify an expression in some cases this operation can change the basic of the ex...
bool expression_field_p(expression e)
The expression is of kind "s.a", where "s" is a struct and a "a" field.
bool expression_call_p(expression e)
expression entity_to_expression(entity e)
if v is a constant, returns a constant call.
bool expression_equal_p(expression e1, expression e2)
Syntactic equality e1==e2.
call expression_call(expression e)
void update_expression_syntax(expression e, syntax s)
frees expression syntax of e and replace it by the new syntax s
expression int_to_expression(_int i)
transform an int into an expression and generate the corresponding entity if necessary; it is not cle...
expression make_op_exp(char *op_name, expression exp1, expression exp2)
================================================================
bool expression_reference_p(expression e)
Test if an expression is a reference.
reference expression_reference(expression e)
Short cut, meaningful only if expression_reference_p(e) holds.
expression reference_offset(reference ref)
computes the offset of a C reference with its origin
entity expression_to_entity(expression e)
just returns the entity of an expression, or entity_undefined
bool same_expression_p(expression e1, expression e2)
this is slightly different from expression_equal_p, as it will return true for a+b vs b+a
expression call_to_expression(call c)
Build an expression that call a function or procedure.
basic basic_of_expression(expression)
basic basic_of_expression(expression exp): Makes a basic of the same basic as the expression "exp".
int basic_type_size(basic)
See also SizeOfElements()
void AddLocalEntityToDeclarations(entity, entity, statement)
Add the variable entity e to the list of variables of the function module.
bool entity_scalar_p(entity)
The concrete type of e is a scalar type.
int dimension_size(dimension)
this function computes the size of a dimension.
void AddEntityToCurrentModule(entity)
Add a variable entity to the current module declarations.
bool formal_parameter_p(entity)
_int SizeOfElements(basic)
This function returns the length in bytes of the Fortran or C type represented by a basic,...
entity make_new_scalar_variable_with_prefix(const char *, entity, basic)
Create a new scalar variable of type b in the given module.
basic basic_of_expressions(list, bool)
basic basic_of_reference(reference)
Retrieves the basic of a reference in a newly allocated basic object.
#define normalized_undefined
#define syntax_reference_p(x)
struct _newgen_struct_value_ * value
#define syntax_reference(x)
#define reference_variable(x)
#define basic_typedef_p(x)
#define entity_storage(x)
#define basic_overloaded_p(x)
#define EXPRESSION(x)
EXPRESSION.
#define entity_undefined_p(x)
#define expression_undefined
#define CONSTANT(x)
CONSTANT.
#define reference_indices(x)
#define expression_undefined_p(x)
#define variable_dimensions(x)
#define statement_undefined_p(x)
#define expression_syntax(x)
#define type_variable_p(x)
#define variable_basic(x)
#define statement_undefined
#define STATEMENT(x)
STATEMENT.
#define entity_initial(x)
#define SIMD_BROADCAST_SUFFIX
#define SIMD_GENERIC_SUFFIX
#define SIMD_MASKED_SUFFIX
simd_loop_const_elim.c
#define SIMD_CONSTANT_SUFFIX
simdstatement make_simd_statements(set opkinds, list statements)
statement make_shuffle_statement(entity *from, list expressions, int *perms)
static bool simd_vector_expression_p(expression e)
expression is an simd vector if it is a reference array containing VECTOR_POSTFIX in its name
static basic get_typedefed_array(const char *type_name, basic b, list dims)
static statement make_loadsave_statement(int argc, list args, bool isLoad)
static entity make_new_simd_vector_with_prefix(int itemSize, int nbItems, enum basic_utype basicTag, const char *vname)
static expression offset_of_struct(entity e)
static entity expressions_to_vector(list expressions, statement *shuffle)
list generate_simd_code(simdstatement ssi, float *simdCost)
opcode generate_opcode(string name, list types, float cost)
auto-guess vector size
#define SAC_ALIGNED_VECTOR_NAME
static entity do_expressions_to_vector(list expressions)
static string get_vect_name_from_data(int argc, list exps)
bool expression_reference_or_field_p(expression e)
static enum basic_utype get_basic_from_opcode(opcode oc, int argNum)
static bool sac_aligned_expression_p(expression e)
static void make_permutations_indexes(list exp_final, list exp_loaded, int *perms)
This function will create the permutations indexes that will allow the creation of exp_final from exp...
static hash_table vector_to_expressions
static simdstatement make_simd_statement(opcodeClass kind, opcode oc, list *args)
static expression sreference_offset(reference r)
computes the offset between an entity and its reference
static bool consecutive_expression_p(expression e0, int lastOffset, expression e1)
static void replace_subscript(expression e)
static statement generate_load_statement(simdstatement si, int line)
bool simd_vector_entity_p(entity e)
bool sac_aligned_entity_p(entity e)
static void update_vector_to_expressions(entity e, list exps)
static statement generate_exec_statement(simdstatement ss)
static opcode get_optimal_opcode(opcodeClass kind, int argc, list *args)
Computes the optimal opcode for simdizing 'argc' statements of the 'kind' operation,...
static statement make_exec_statement_from_opcode(opcode oc, list args)
static statement generate_save_statement(simdstatement si)
void init_vector_to_expressions()
codegen.c
static statement make_save_statement(int argc, list args)
void invalidate_expressions_in_statement(statement s)
void reset_vector_to_expressions()
expression distance_between_expression(const expression exp0, const expression exp1)
computes the distance betwwen two expression
static statement make_exec_statement_from_name(string ename, list args)
static entity try_all_permutations(list expressions, list remainder, list exp_org, statement *shuffle, int *perms)
static bool loadstore_type_conversion_string(int argc, list args, string *lsType, bool isLoad)
This function change the "load/store type" to XX_TO_XX if a conversion is needed.
int get_subwordSize_from_opcode(opcode oc, int argNum)
static expression distance_between_entity(const entity e0, const entity e1)
static string get_simd_vector_type(list lExp)
static entity make_new_simd_vector(int itemSize, int nbItems, enum basic_utype basicTag)
static statement make_load_statement(int argc, list args)
statement sac_current_block
match get_statement_match_of_kind(statement, opcodeClass)
simdizer.c
instruction sac_real_current_instruction
#define opcodeClass_nbArgs(x)
#define simdstatement_undefined
#define opcode_vectorSize(x)
#define simdstatement_nbArgs(x)
#define simdstatement_opcode(x)
#define opcode_undefined_p(x)
#define opcodeClass_opcodes(x)
#define simdstatement_vectors(x)
#define OPCODECLASS(x)
OPCODECLASS.
#define opcode_argType(x)
#define simdstatement_arguments(x)
static int line
FLEX_SCANNER.
void shuffle(int n, float r[n], float r3[n], float r2[n], float a[n], float b[n])
FI: I do not understand why the type is duplicated at the set level.
The structure used to build lists in NewGen.
struct vector vector
test de chernikovaa
#define exp
Avoid some warnings from "gcc -Wshadow".