[stdlib][simd] Add test for simd construction checks by josiahls · Pull Request #6348 · modular/modular

Note, currently @always_inline("builtin") basically strips the asserts out of the code.

Summary

SIMD _simd_construction_checks is noop due to @always_inline("builtin")

When you run the test, you will notice that _simd_construction_checks isn't the thing that fails.

def main() raises:
    ^
/home/mojo_user/momanim/third_party/modular/mojo/stdlib/test/builtin/test_simd_compile_fail.mojo:18:49: note: call expansion failed with parameter value(s): (..., "size": 3)
    _simd_construction_checks2[DType.float32, 3]()
                                                ^
mojo/stdlib/std/builtin/simd.mojo:255:5: note: function instantiation failed
mojo/stdlib/std/builtin/simd.mojo:265:5: note: constraint failed: simd width must be power of 2
/home/mojo_user/momanim/.pixi/envs/stdlib-dev/bin/mojo: error: failed to run the pass manager

Testing

I have a compile fail test that demos this.

Checklist

  • PR is small and focused — consider splitting larger changes into a
    sequence of smaller PRs
  • I ran ./bazelw run format to format my changes
  • I added or updated tests to cover my changes