1 // RUN: mlir-opt %s -convert-vector-to-scf -convert-scf-to-cf \
2 // RUN: -convert-vector-to-llvm='reassociate-fp-reductions' \
3 // RUN: -convert-func-to-llvm -reconcile-unrealized-casts | \
4 // RUN: mlir-cpu-runner -e entry -entry-point-result=void \
5 // RUN: -shared-libs=%mlir_c_runner_utils | \
9 // Construct test vector, numerically very stable.
10 %f1 = arith.constant 1.0: f64
11 %f2 = arith.constant 2.0: f64
12 %f3 = arith.constant 3.0: f64
13 %v0 = vector.broadcast %f1 : f64 to vector<64xf64>
14 %v1 = vector.insert %f2, %v0[11] : f64 into vector<64xf64>
15 %v2 = vector.insert %f3, %v1[52] : f64 into vector<64xf64>
16 vector.print %v2 : vector<64xf64>
20 // CHECK: ( 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 )
22 // Various vector reductions. Not full functional unit tests, but
23 // a simple integration test to see if the code runs end-to-end.
24 %0 = vector.reduction <add>, %v2 : vector<64xf64> into f64
27 %1 = vector.reduction <mul>, %v2 : vector<64xf64> into f64
30 %2 = vector.reduction <minimumf>, %v2 : vector<64xf64> into f64
33 %3 = vector.reduction <maximumf>, %v2 : vector<64xf64> into f64
36 %4 = vector.reduction <minf>, %v2 : vector<64xf64> into f64
39 %5 = vector.reduction <maxf>, %v2 : vector<64xf64> into f64