https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104116
--- Comment #5 from Avinash Jayakar <avinashd at gcc dot gnu.org> --- Created attachment 62265 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=62265&action=edit Proposed patch for vectorized floor mod implementation Currently implemented only the floor mod operator using the following logic input: x %[fl] y output: ... vec_r = x % y (using the existing logic) vec_cond = (x ^ y) & ( vec_r < 0) vec_add_for_signed = vec_cond ? (y) : 0 result = vec_r + vec_add_for_signed I tested with the same test case for fortran, function arr_modulo(a) integer(kind=4) :: a(1024) a(:) = modulo (a(:), 39) end function With different values, it works properly. I will test a few more cases. But I wanted to know if heading in the right direction.