1// RUN: mlir-opt %s --convert-vector-to-llvm='enable-index-optimizations=1' | FileCheck %s --check-prefix=CMP32 2// RUN: mlir-opt %s --convert-vector-to-llvm='enable-index-optimizations=0' | FileCheck %s --check-prefix=CMP64 3 4// CMP32-LABEL: llvm.func @genbool_var_1d( 5// CMP32-SAME: %[[A:.*]]: !llvm.i64) 6// CMP32: %[[T0:.*]] = llvm.mlir.constant(dense<[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]> : vector<11xi32>) : !llvm.vec<11 x i32> 7// CMP32: %[[T1:.*]] = llvm.trunc %[[A]] : !llvm.i64 to !llvm.i32 8// CMP32: %[[T2:.*]] = llvm.mlir.undef : !llvm.vec<11 x i32> 9// CMP32: %[[T3:.*]] = llvm.mlir.constant(0 : i32) : !llvm.i32 10// CMP32: %[[T4:.*]] = llvm.insertelement %[[T1]], %[[T2]][%[[T3]] : !llvm.i32] : !llvm.vec<11 x i32> 11// CMP32: %[[T5:.*]] = llvm.shufflevector %[[T4]], %[[T2]] [0 : i32, 0 : i32, 0 : i32, 0 : i32, 0 : i32, 0 : i32, 0 : i32, 0 : i32, 0 : i32, 0 : i32, 0 : i32] : !llvm.vec<11 x i32>, !llvm.vec<11 x i32> 12// CMP32: %[[T6:.*]] = llvm.icmp "slt" %[[T0]], %[[T5]] : !llvm.vec<11 x i32> 13// CMP32: llvm.return %[[T6]] : !llvm.vec<11 x i1> 14 15// CMP64-LABEL: llvm.func @genbool_var_1d( 16// CMP64-SAME: %[[A:.*]]: !llvm.i64) 17// CMP64: %[[T0:.*]] = llvm.mlir.constant(dense<[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]> : vector<11xi64>) : !llvm.vec<11 x i64> 18// CMP64: %[[T1:.*]] = llvm.mlir.undef : !llvm.vec<11 x i64> 19// CMP64: %[[T2:.*]] = llvm.mlir.constant(0 : i32) : !llvm.i32 20// CMP64: %[[T3:.*]] = llvm.insertelement %[[A]], %[[T1]][%[[T2]] : !llvm.i32] : !llvm.vec<11 x i64> 21// CMP64: %[[T4:.*]] = llvm.shufflevector %[[T3]], %[[T1]] [0 : i32, 0 : i32, 0 : i32, 0 : i32, 0 : i32, 0 : i32, 0 : i32, 0 : i32, 0 : i32, 0 : i32, 0 : i32] : !llvm.vec<11 x i64>, !llvm.vec<11 x i64> 22// CMP64: %[[T5:.*]] = llvm.icmp "slt" %[[T0]], %[[T4]] : !llvm.vec<11 x i64> 23// CMP64: llvm.return %[[T5]] : !llvm.vec<11 x i1> 24 25func @genbool_var_1d(%arg0: index) -> vector<11xi1> { 26 %0 = vector.create_mask %arg0 : vector<11xi1> 27 return %0 : vector<11xi1> 28} 29 30// CMP32-LABEL: llvm.func @transfer_read_1d 31// CMP32: %[[C:.*]] = llvm.mlir.constant(dense<[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]> : vector<16xi32>) : !llvm.vec<16 x i32> 32// CMP32: %[[A:.*]] = llvm.add %{{.*}}, %[[C]] : !llvm.vec<16 x i32> 33// CMP32: %[[M:.*]] = llvm.icmp "slt" %[[A]], %{{.*}} : !llvm.vec<16 x i32> 34// CMP32: %[[L:.*]] = llvm.intr.masked.load %{{.*}}, %[[M]], %{{.*}} 35// CMP32: llvm.return %[[L]] : !llvm.vec<16 x float> 36 37// CMP64-LABEL: llvm.func @transfer_read_1d 38// CMP64: %[[C:.*]] = llvm.mlir.constant(dense<[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]> : vector<16xi64>) : !llvm.vec<16 x i64> 39// CMP64: %[[A:.*]] = llvm.add %{{.*}}, %[[C]] : !llvm.vec<16 x i64> 40// CMP64: %[[M:.*]] = llvm.icmp "slt" %[[A]], %{{.*}} : !llvm.vec<16 x i64> 41// CMP64: %[[L:.*]] = llvm.intr.masked.load %{{.*}}, %[[M]], %{{.*}} 42// CMP64: llvm.return %[[L]] : !llvm.vec<16 x float> 43 44func @transfer_read_1d(%A : memref<?xf32>, %i: index) -> vector<16xf32> { 45 %d = constant -1.0: f32 46 %f = vector.transfer_read %A[%i], %d {permutation_map = affine_map<(d0) -> (d0)>} : memref<?xf32>, vector<16xf32> 47 return %f : vector<16xf32> 48} 49