1// RUN: mlir-opt %s -convert-vector-to-scf -convert-scf-to-cf -convert-vector-to-llvm="enable-x86vector" -convert-func-to-llvm -reconcile-unrealized-casts | \ 2// RUN: mlir-translate --mlir-to-llvmir | \ 3// RUN: %lli --entry-function=entry --mattr="avx512bw" --dlopen=%mlir_c_runner_utils | \ 4// RUN: FileCheck %s 5 6func.func @entry() -> i32 { 7 %i0 = arith.constant 0 : i32 8 9 %a = arith.constant dense<[1., 0., 0., 2., 4., 3., 5., 7., 8., 1., 5., 5., 3., 1., 0., 7.]> : vector<16xf32> 10 %k = arith.constant dense<[1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0]> : vector<16xi1> 11 %r1 = x86vector.avx512.mask.compress %k, %a : vector<16xf32> 12 %r2 = x86vector.avx512.mask.compress %k, %a {constant_src = dense<5.0> : vector<16xf32>} : vector<16xf32> 13 14 vector.print %r1 : vector<16xf32> 15 // CHECK: ( 1, 0, 2, 4, 5, 5, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0 ) 16 17 vector.print %r2 : vector<16xf32> 18 // CHECK: ( 1, 0, 2, 4, 5, 5, 3, 1, 0, 5, 5, 5, 5, 5, 5, 5 ) 19 20 %src = arith.constant dense<[0., 2., 1., 8., 6., 4., 4., 3., 2., 8., 5., 6., 3., 7., 6., 9.]> : vector<16xf32> 21 %r3 = x86vector.avx512.mask.compress %k, %a, %src : vector<16xf32>, vector<16xf32> 22 23 vector.print %r3 : vector<16xf32> 24 // CHECK: ( 1, 0, 2, 4, 5, 5, 3, 1, 0, 8, 5, 6, 3, 7, 6, 9 ) 25 26 return %i0 : i32 27} 28