mojo
mojo copied to clipboard
[BUG] Error on `return` a `SIMD[ , 2]` in `alias`
Bug description
Hello, it is a bug experienced by @soraros , on the chat:
fn f() -> SIMD[DType.float32, 2]:
return SIMD[DType.float32, 2](0, 1)
fn main():
alias v = f()
print(v)
failed to fold operation
pop.simd.insertelement
It works great with:
-
return SIMD[DType.float32, 2](0)
-
fn f() -> SIMD[DType.float32, 2] as output: output = SIMD[DType.float32, 2](0,1) fn main(): alias v = f() print(v)
-
fn f() -> SIMD[DType.float32, 2]: s = SIMD[DType.float32, 2]() s[0] = 0 s[1] = 1 return s fn main(): alias v = f() print(v)
Maybe the overload SIMD.__init__
with *args
?
Steps to reproduce
Nothing special, it is in the description.
System information
- `Ubuntu 23.10`
- `mojo 2024.10.205 (26f6391e)`
- `magic 0.3.0`