how to enable vector intrinsic functions in fortran frontend

Sa Liu SALIU@de.ibm.com
Mon Nov 5 18:39:00 GMT 2007


There are some more questions concerning implementation of vector 
intrinsics:

- I think we got agreement on declaration of vector type by something like 
VECTOR(INTEGER(1), 16). I'd like to have a macro defining the default 
vector size for each target, e.g. 16 for PowerPC and SPU, so that the 
second parameter could be omitted to keep compatibility with the XLF 
syntax.

- About target specific scalar types, e.g. pixel, in C it has been done by 
preprocessor, defining "__pixel=__attribute__((altivec(pixel__))) unsigned 
short". But there is no preprocessing in Fortran. I still have no idea how 
to declare them without adding new keyword to Fortran frontend.

- To add the vector intrinsics to the namespace, I could imagine adding 
similar files like mathbuiltins.def to define a list of builtin functions 
for each target, say vmx-builtins.def and spu-builtins.def. But this might 
be duplicated work, since in backend the targetm.init_builtins already 
handls this list. The problems, in backend the vector builtins are mixed 
together with other target specific builtin functions, which we certainly 
don't want to touch. We could think of separate them to a different set, 
but I'm not aware how much the workload could be. Currently I prefer to 
add def files to fortran frontend to have a relatively neat solution. 

- As to arguments checking, in C this is implemented by 
targetm.resolve_overloaded_builtin. In this function, the data types are 
checked to be compatible by function lang_hooks.types_compatible_p. I 
think we could implement this function in Fortran as well, so that the 
whole checking and resolving stuff won't bother Fortran frontend. But is 
there any problems to move resolve_overloaded_builtin function from 
C-specific backend file (tm-c.c) to common file(tm.c)? Does each frontend 
support function overloading? As far as I know Java, Ada and Fortran 90 do 
support overloading, is there any specific reason to keep the 
resolve_overloaded_builtin function as C-specific? It would be fine if we 
could reuse these functions.

Thanks!
Sa



More information about the Fortran mailing list