# Simple loop won't vectorize

**URL:** <https://discourse.julialang.org/t/simple-loop-wont-vectorize/20169>\
**Category:** New to Julia\
**Created:** [January 28, 2019, 5:21am UTC](https://discourse.julialang.org/t/simple-loop-wont-vectorize/20169 "2019-01-28T05:21:10Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![bennedich](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bennedich/32/4894_2.png) [@bennedich](https://discourse.julialang.org/u/bennedich)\
**Post date:** [January 28, 2019, 8:31am UTC](https://discourse.julialang.org/t/simple-loop-wont-vectorize/20169/7 "2019-01-28T08:31:43Z")

</div>

I am seeing the same thing:

```julia
julia> @btime (s = 0.0; @simd for i in 1:10^9 s += i * 1.23 end; s)
  713.254 ms (0 allocations: 0 bytes)
6.150000006112102e17

julia> @btime (s = 0.0; @simd for i in Int32(1):Int32(10^9) s += i * 1.23 end; s)
  130.840 ms (0 allocations: 0 bytes)
6.150000006112102e17

```

Both cases seem to SIMD, based on the native code, but only the `Int32` case generates sane code. I’d love to understand what’s going on here.

---

_[View the full topic](https://discourse.julialang.org/t/simple-loop-wont-vectorize/20169)._
