This commit is contained in:
commit
568474d52f
1591 files changed
+528213
No files matched your search
@@ -0,0 +1,16 @@
|
||||
# probe: SIMD arithmetic, broadcasting, and reductions
|
||||
# status: the expected output is Programming+'s interpreter's prediction; corpus.py verify confirms or refutes it on godbolt
|
||||
# expect-stdout: [1.5, 2.0, -3.0, 4.25]
|
||||
# expect-stdout: [3.0, 4.0, -6.0, 8.5]
|
||||
# expect-stdout: [2.5, 3.0, -2.0, 5.25]
|
||||
# expect-stdout: 4.75 4.25 -3.0
|
||||
# expect-stdout: [6, 2, 8, 2] 12
|
||||
def main():
|
||||
var v = SIMD[DType.float32, 4](1.5, 2.0, -3.0, 4.25)
|
||||
var w = SIMD[DType.float32, 4](2.0)
|
||||
print(v)
|
||||
print(v * w)
|
||||
print(v + 1.0)
|
||||
print(v.reduce_add(), v.reduce_max(), v.reduce_min())
|
||||
var k = SIMD[DType.int32, 4](3, 1, 4, 1)
|
||||
print(k * 2, k.reduce_mul())
|
||||
Reference in new issue
Block a user