On Fri, Feb 23, 2018 at 11:44:40AM -0800, Steve Ellcey wrote: > I have a question about loop vectorization, OpenMP, and libmvec. I am > experimenting with this on Aarch64 and looking at what exists on x86 > and trying to understand the relationship (if there is one) between the > vector library (libmvec) and OpenMP (libgomp).
There is no connection to libgomp, just to OpenMP #pragma omp declare simd, which is now also available using the simd attribute in GCC in a simplified way. Neither #pragma omp simd nor #pragma omp declare simd need any library support, the former just expresses strong desire to vectorize the loop, some guarantees about it and perhaps some further details on variable behavior. #pragma omp declare simd is a way to require multiple entry-points of a function, scalar and one or more vector versions on definitions, or assume definition is accompanied by those extra versions. If you don't have any preexisting vectorized library, I'd suggest to follow what libmvec does and use the simd attribute. A precondition is to define an ABI and mangling. For mangling on Intel GCC uses modified https://software.intel.com/sites/default/files/managed/b4/c8/Intel-Vector-Function-ABI.pdf mangling, instead of the x/y/Y/z/Z letters we use b/c/d/e letters and don't use __regcall underlying calling convention, just normal calling conventions. For AArch64, dunno if you want to define one style for pre-SVE and another one for SVE or even have multiple versions of the former or latter. After designing it, config/aarch64/ needs to implement the simd_clone_compute_vecsize_and_simdlen target hook, and once this is done, you can implement the library, either in assembly or in C code using the simd attribute or #pragma omp declare simd. Jakub