i had a query earlier about libmvec vector functions in fortran: https://gcc.gnu.org/ml/gcc/2017-11/msg00007.html
but there were no simple solutions to make math functions vectorizable in fortran, because it's hard to make libc headers with simd attributes visible to the fortran front end. i think a possible workaround is to have a dummy libmvec implementation in libgcc.a (or more likely as a separate libgccmvec.a) that just calls scalar functions from libm like vdouble _ZGVbN2v_sin(vdouble x) { return (vdouble){sin(x[0]), sin(x[1])}; } and similarly for all relevant single and double precision functions for all vector lengths and other supported variants. then gcc knows that there is an implementation for these functions available and with the right link order a better implementation from libmvec can override these dummy implementations. (the cost model cannot assume a faster vector algorithm than the scalar one though) - this allows vectorizing loops with math functions even in fortran, - and on targets without a libmvec implementation (but with a vector abi), - and allows users to provide their own vector math implementation more easily without hacking around glibc math.h (which may not support vector math or only enable it for a small subset of math functions). gcc needs a new cflag and ldflag to enable this. (maybe -mveclibabi= already present in x86 and ppc can be used for this)