brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.6 KiB · 84270ee Raw
37 lines · plain
1// RUN: mlir-opt %s -convert-vector-to-scf -convert-scf-to-cf -convert-cf-to-llvm \2// RUN: -convert-vector-to-llvm -convert-index-to-llvm -finalize-memref-to-llvm -convert-func-to-llvm -convert-arith-to-llvm \3// RUN: -reconcile-unrealized-casts | \4// RUN: mlir-translate -mlir-to-llvmir | \5// RUN: %lli --entry-function=entry \6// RUN:      --dlopen=%mlir_native_utils_lib_dir/libmlir_c_runner_utils%shlibext | \7// RUN: FileCheck %s8 9// %mlir_native_utils_lib_dir is incorrect on Windows10// UNSUPPORTED: system-windows11 12memref.global "private" @gv_i32 : memref<20xi32> =13    dense<[0, 1, 2, 3, 4, 5, 6, 7, 8, 9,14           10, 11, 12, 13, 14, 15, 16, 17, 18, 19]>15 16func.func @entry() -> i32 {17  %c0 = arith.constant 0 : index18  %c10 = arith.constant 10 : index19  %mem_i32 = memref.get_global @gv_i32 : memref<20xi32>20  // When the vectors are defined as dense constant vector,21  // the vp intrinsic will be optimized/eliminated on some backend (e.g. X86).22  // So this test case loads the vector from a memref to test the vp intrinsic23  // backend support.24  %vec1 = vector.load %mem_i32[%c0] : memref<20xi32>, vector<8xi32>25  %vec2 = vector.load %mem_i32[%c10] : memref<20xi32>, vector<8xi32>26  %mask = arith.constant dense<[1, 0, 1, 0, 1, 0, 1, 0]> : vector<8xi1>27  %evl = arith.constant 4 : i3228 29  %res = "llvm.intr.vp.add" (%vec1, %vec2, %mask, %evl) :30         (vector<8xi32>, vector<8xi32>, vector<8xi1>, i32) -> vector<8xi32>31  vector.print %res : vector<8xi32>32  // CHECK: ( 10, {{.*}}, 14, {{.*}}, {{.*}}, {{.*}}, {{.*}}, {{.*}} )33 34  %ret = arith.constant 0 : i3235  return %ret : i3236}37