While this has been a problem in the past with latest clang version 16.0.6 on
linux and a simple example:
const
Size = 10000006
proc dot(a, b: seq[float]): seq[float] =
result = newSeq[float](Size)
for j in 0 ..< 200: # some repetitions
for i in 0 ..< Size:
result[i] = a[i] * b[i]
proc main =
var a = newSeq[float](Size)
var b = newSeq[float](Size)
var c = a.dot(b)
main()
RunIt seems that it is correctly autovectorized:
