James Newling 0cb98c721b
[mlir][vector] Replace vector.splat with vector.broadcast in some tests (#152230)
Splat is deprecated, and being prepared for removal in a future release.

https://discourse.llvm.org/t/rfc-mlir-vector-deprecate-then-remove-vector-splat/87143/5

The command I used, catches almost every splat op: 
 ```
perl -i -pe
's/vector\.splat\s+(\S+)\s*:\s*vector<((?:\[?\d+\]?x)*)\s*([^>]+)>/vector.broadcast
$1 : $3 to vector<$2$3>/g' filename
 ```
2025-08-07 08:28:04 -07:00

25 lines
756 B
MLIR

// RUN: mlir-opt %s -test-lower-to-llvm | \
// RUN: mlir-runner -e entry -entry-point-result=void \
// RUN: -shared-libs=%mlir_c_runner_utils | \
// RUN: FileCheck %s
func.func @entry() {
%f1 = arith.constant 1.0 : f32
%f2 = arith.constant 2.0 : f32
%v1 = vector.broadcast %f1 : f32 to vector<2x4xf32>
%v2 = vector.broadcast %f2 : f32 to vector<2x4xf32>
vector.print %v1 : vector<2x4xf32>
vector.print %v2 : vector<2x4xf32>
//
// Test vectors:
//
// CHECK: ( ( 1, 1, 1, 1 ), ( 1, 1, 1, 1 ) )
// CHECK: ( ( 2, 2, 2, 2 ), ( 2, 2, 2, 2 ) )
%v3 = vector.interleave %v1, %v2 : vector<2x4xf32> -> vector<2x8xf32>
vector.print %v3 : vector<2x8xf32>
// CHECK: ( ( 1, 2, 1, 2, 1, 2, 1, 2 ), ( 1, 2, 1, 2, 1, 2, 1, 2 ) )
return
}