Behavior of clause linear on omp declare simd (original) (raw)

November 25, 2024, 1:39pm 1

For this function

#pragma omp declare simd notinbranch,linear(input_1, input_2)          
float add_floats(const float* input_1, const float* input_2) noexcept {
        return *input_1 + *input_2;
}

clang currently creates the following mangled vector function name _ZGVbN4l4l4__Z10add_floatsPKfS0_ (c.f. Compiler Explorer). The parameters declared as linear result in the fragment l4l4 - so clang seems to consider the size of a float when creating this fragment. Is this correct?

From the OpenMP-specification I would expect that the literal stride is given here, as the default stride is 1, I would expect the following mangled name _ZGVbN4l1l1__Z10add_floatsPKfS0_. In the Vector Function Application Binary Interface I also do not find any reference to the size of the parameter.

Do I miss something or is the mangled name created by clang faulty?

fscheler November 25, 2024, 2:52pm 3

Thanks for your reply! I already came across the Vector ABI document, so I must have missed the part that specifies this. gcc behaves the same way, so I assume this should be correct.