1b8a021dbSAart Bik// NOTE: Assertions have been autogenerated by utils/generate-test-checks.py 206a65ce5SPeiming Liu// RUN: mlir-opt %s --sparse-reinterpret-map -sparsification | FileCheck %s 3b8a021dbSAart Bik 4dbe1be9aSYinying Li#SV = #sparse_tensor.encoding<{ map = (d0) -> (d0 : compressed) }> 5b8a021dbSAart Bik 6b8a021dbSAart Bik#trait2 = { 7b8a021dbSAart Bik indexing_maps = [ 8b8a021dbSAart Bik affine_map<(i) -> (i)>, // a 9b8a021dbSAart Bik affine_map<(i) -> (i)>, // b 10b8a021dbSAart Bik affine_map<(i) -> (i)> // x (out) 11b8a021dbSAart Bik ], 12b8a021dbSAart Bik iterator_types = ["parallel"], 13b8a021dbSAart Bik doc = "x(i) = a(i) OP b(i)" 14b8a021dbSAart Bik} 15b8a021dbSAart Bik 16622eb169SAart Bik#traitc = { 17622eb169SAart Bik indexing_maps = [ 18622eb169SAart Bik affine_map<(i) -> (i)>, // a 19622eb169SAart Bik affine_map<(i) -> (i)> // x (out) 20622eb169SAart Bik ], 21622eb169SAart Bik iterator_types = ["parallel"], 22622eb169SAart Bik doc = "x(i) = a(i) OP c" 23622eb169SAart Bik} 24622eb169SAart Bik 25b8a021dbSAart Bik// CHECK-LABEL: func @add( 26c5a67e16SYinying Li// CHECK-SAME: %[[VAL_0:.*]]: tensor<32xi64, #sparse{{[0-9]*}}>, 27b8a021dbSAart Bik// CHECK-SAME: %[[VAL_1:.*]]: tensor<32xi64>, 28c66303c2SMatthias Springer// CHECK-SAME: %[[VAL_2:.*]]: tensor<32xi64>) -> tensor<32xi64> { 29a54f4eaeSMogball// CHECK-DAG: %[[VAL_3:.*]] = arith.constant 32 : index 30a54f4eaeSMogball// CHECK-DAG: %[[VAL_4:.*]] = arith.constant 0 : index 31a54f4eaeSMogball// CHECK-DAG: %[[VAL_5:.*]] = arith.constant true 32a54f4eaeSMogball// CHECK-DAG: %[[VAL_6:.*]] = arith.constant 1 : index 33a02010b3SPeiming Liu// CHECK-DAG: %[[VAL_7:.*]] = sparse_tensor.positions %[[VAL_0]] {level = 0 : index} : tensor<32xi64, #sparse{{[0-9]*}}> 34a02010b3SPeiming Liu// CHECK-DAG: %[[VAL_8:.*]] = sparse_tensor.coordinates %[[VAL_0]] {level = 0 : index} : tensor<32xi64, #sparse{{[0-9]*}}> 35a02010b3SPeiming Liu// CHECK-DAG: %[[VAL_9:.*]] = sparse_tensor.values %[[VAL_0]] : tensor<32xi64, #sparse{{[0-9]*}}> 36*ced2fc78SChristopher Bate// CHECK-DAG: %[[VAL_10:.*]] = bufferization.to_memref %[[VAL_1]] : tensor<32xi64> to memref<32xi64> 37*ced2fc78SChristopher Bate// CHECK-DAG: %[[VAL_11:.*]] = bufferization.to_memref %[[VAL_2]] : tensor<32xi64> to memref<32xi64> 38b8a021dbSAart Bik// CHECK: %[[VAL_12:.*]] = memref.load %[[VAL_7]]{{\[}}%[[VAL_4]]] : memref<?xindex> 39b8a021dbSAart Bik// CHECK: %[[VAL_13:.*]] = memref.load %[[VAL_7]]{{\[}}%[[VAL_6]]] : memref<?xindex> 40b8a021dbSAart Bik// CHECK: %[[VAL_14:.*]]:2 = scf.while (%[[VAL_15:.*]] = %[[VAL_12]], %[[VAL_16:.*]] = %[[VAL_4]]) : (index, index) -> (index, index) { 41a54f4eaeSMogball// CHECK: %[[VAL_17:.*]] = arith.cmpi ult, %[[VAL_15]], %[[VAL_13]] : index 42b8a021dbSAart Bik// CHECK: scf.condition(%[[VAL_17]]) %[[VAL_15]], %[[VAL_16]] : index, index 43b8a021dbSAart Bik// CHECK: } do { 44b8a021dbSAart Bik// CHECK: ^bb0(%[[VAL_18:.*]]: index, %[[VAL_19:.*]]: index): 45b8a021dbSAart Bik// CHECK: %[[VAL_20:.*]] = memref.load %[[VAL_8]]{{\[}}%[[VAL_18]]] : memref<?xindex> 46a54f4eaeSMogball// CHECK: %[[VAL_21:.*]] = arith.cmpi eq, %[[VAL_20]], %[[VAL_19]] : index 47b8a021dbSAart Bik// CHECK: scf.if %[[VAL_21]] { 48b8a021dbSAart Bik// CHECK: %[[VAL_22:.*]] = memref.load %[[VAL_9]]{{\[}}%[[VAL_18]]] : memref<?xi64> 49b8a021dbSAart Bik// CHECK: %[[VAL_23:.*]] = memref.load %[[VAL_10]]{{\[}}%[[VAL_19]]] : memref<32xi64> 50a54f4eaeSMogball// CHECK: %[[VAL_24:.*]] = arith.addi %[[VAL_22]], %[[VAL_23]] : i64 51b8a021dbSAart Bik// CHECK: memref.store %[[VAL_24]], %[[VAL_11]]{{\[}}%[[VAL_19]]] : memref<32xi64> 52b8a021dbSAart Bik// CHECK: } else { 53b8a021dbSAart Bik// CHECK: scf.if %[[VAL_5]] { 54b8a021dbSAart Bik// CHECK: %[[VAL_25:.*]] = memref.load %[[VAL_10]]{{\[}}%[[VAL_19]]] : memref<32xi64> 55b8a021dbSAart Bik// CHECK: memref.store %[[VAL_25]], %[[VAL_11]]{{\[}}%[[VAL_19]]] : memref<32xi64> 56b8a021dbSAart Bik// CHECK: } else { 57b8a021dbSAart Bik// CHECK: } 58b8a021dbSAart Bik// CHECK: } 59a54f4eaeSMogball// CHECK: %[[VAL_26:.*]] = arith.cmpi eq, %[[VAL_20]], %[[VAL_19]] : index 60a54f4eaeSMogball// CHECK: %[[VAL_27:.*]] = arith.addi %[[VAL_18]], %[[VAL_6]] : index 61dec8af70SRiver Riddle// CHECK: %[[VAL_28:.*]] = arith.select %[[VAL_26]], %[[VAL_27]], %[[VAL_18]] : index 62a54f4eaeSMogball// CHECK: %[[VAL_29:.*]] = arith.addi %[[VAL_19]], %[[VAL_6]] : index 63b8a021dbSAart Bik// CHECK: scf.yield %[[VAL_28]], %[[VAL_29]] : index, index 64b8a021dbSAart Bik// CHECK: } 65b8a021dbSAart Bik// CHECK: scf.for %[[VAL_30:.*]] = %[[VAL_31:.*]]#1 to %[[VAL_3]] step %[[VAL_6]] { 66b8a021dbSAart Bik// CHECK: %[[VAL_32:.*]] = memref.load %[[VAL_10]]{{\[}}%[[VAL_30]]] : memref<32xi64> 67b8a021dbSAart Bik// CHECK: memref.store %[[VAL_32]], %[[VAL_11]]{{\[}}%[[VAL_30]]] : memref<32xi64> 68b8a021dbSAart Bik// CHECK: } 6957470abcSAlexander Belyaev// CHECK: %[[VAL_33:.*]] = bufferization.to_tensor %[[VAL_11]] : memref<32xi64> 70b8a021dbSAart Bik// CHECK: return %[[VAL_33]] : tensor<32xi64> 71b8a021dbSAart Bik// CHECK: } 72fb35cd3bSRiver Riddlefunc.func @add(%arga: tensor<32xi64, #SV>, 73b8a021dbSAart Bik %argb: tensor<32xi64>, 74c66303c2SMatthias Springer %argx: tensor<32xi64>) -> tensor<32xi64> { 75b8a021dbSAart Bik %0 = linalg.generic #trait2 76b8a021dbSAart Bik ins(%arga, %argb: tensor<32xi64, #SV>, tensor<32xi64>) 77b8a021dbSAart Bik outs(%argx: tensor<32xi64>) { 78b8a021dbSAart Bik ^bb(%a: i64, %b: i64, %x: i64): 79a54f4eaeSMogball %0 = arith.addi %a, %b : i64 80b8a021dbSAart Bik linalg.yield %0 : i64 81b8a021dbSAart Bik } -> tensor<32xi64> 82b8a021dbSAart Bik return %0 : tensor<32xi64> 83b8a021dbSAart Bik} 84b8a021dbSAart Bik 85b8a021dbSAart Bik// CHECK-LABEL: func @sub( 86c5a67e16SYinying Li// CHECK-SAME: %[[VAL_0:.*]]: tensor<32xi64, #sparse{{[0-9]*}}>, 87b8a021dbSAart Bik// CHECK-SAME: %[[VAL_1:.*]]: tensor<32xi64>, 88c66303c2SMatthias Springer// CHECK-SAME: %[[VAL_2:.*]]: tensor<32xi64>) -> tensor<32xi64> { 89a54f4eaeSMogball// CHECK-DAG: %[[VAL_3:.*]] = arith.constant 32 : index 90a54f4eaeSMogball// CHECK-DAG: %[[VAL_4:.*]] = arith.constant 0 : index 91a54f4eaeSMogball// CHECK-DAG: %[[VAL_5:.*]] = arith.constant true 92a54f4eaeSMogball// CHECK-DAG: %[[VAL_6:.*]] = arith.constant 1 : index 93a54f4eaeSMogball// CHECK-DAG: %[[VAL_7:.*]] = arith.constant 0 : i64 94a02010b3SPeiming Liu// CHECK-DAG: %[[VAL_8:.*]] = sparse_tensor.positions %[[VAL_0]] {level = 0 : index} : tensor<32xi64, #sparse{{[0-9]*}}> 95a02010b3SPeiming Liu// CHECK-DAG: %[[VAL_9:.*]] = sparse_tensor.coordinates %[[VAL_0]] {level = 0 : index} : tensor<32xi64, #sparse{{[0-9]*}}> 96a02010b3SPeiming Liu// CHECK-DAG: %[[VAL_10:.*]] = sparse_tensor.values %[[VAL_0]] : tensor<32xi64, #sparse{{[0-9]*}}> 97*ced2fc78SChristopher Bate// CHECK-DAG: %[[VAL_11:.*]] = bufferization.to_memref %[[VAL_1]] : tensor<32xi64> to memref<32xi64> 98*ced2fc78SChristopher Bate// CHECK-DAG: %[[VAL_12:.*]] = bufferization.to_memref %[[VAL_2]] : tensor<32xi64> to memref<32xi64> 99b8a021dbSAart Bik// CHECK: %[[VAL_13:.*]] = memref.load %[[VAL_8]]{{\[}}%[[VAL_4]]] : memref<?xindex> 100b8a021dbSAart Bik// CHECK: %[[VAL_14:.*]] = memref.load %[[VAL_8]]{{\[}}%[[VAL_6]]] : memref<?xindex> 101b8a021dbSAart Bik// CHECK: %[[VAL_15:.*]]:2 = scf.while (%[[VAL_16:.*]] = %[[VAL_13]], %[[VAL_17:.*]] = %[[VAL_4]]) : (index, index) -> (index, index) { 102a54f4eaeSMogball// CHECK: %[[VAL_18:.*]] = arith.cmpi ult, %[[VAL_16]], %[[VAL_14]] : index 103b8a021dbSAart Bik// CHECK: scf.condition(%[[VAL_18]]) %[[VAL_16]], %[[VAL_17]] : index, index 104b8a021dbSAart Bik// CHECK: } do { 105b8a021dbSAart Bik// CHECK: ^bb0(%[[VAL_19:.*]]: index, %[[VAL_20:.*]]: index): 106b8a021dbSAart Bik// CHECK: %[[VAL_21:.*]] = memref.load %[[VAL_9]]{{\[}}%[[VAL_19]]] : memref<?xindex> 107a54f4eaeSMogball// CHECK: %[[VAL_22:.*]] = arith.cmpi eq, %[[VAL_21]], %[[VAL_20]] : index 108b8a021dbSAart Bik// CHECK: scf.if %[[VAL_22]] { 109b8a021dbSAart Bik// CHECK: %[[VAL_23:.*]] = memref.load %[[VAL_10]]{{\[}}%[[VAL_19]]] : memref<?xi64> 110b8a021dbSAart Bik// CHECK: %[[VAL_24:.*]] = memref.load %[[VAL_11]]{{\[}}%[[VAL_20]]] : memref<32xi64> 111a54f4eaeSMogball// CHECK: %[[VAL_25:.*]] = arith.subi %[[VAL_23]], %[[VAL_24]] : i64 112b8a021dbSAart Bik// CHECK: memref.store %[[VAL_25]], %[[VAL_12]]{{\[}}%[[VAL_20]]] : memref<32xi64> 113b8a021dbSAart Bik// CHECK: } else { 114b8a021dbSAart Bik// CHECK: scf.if %[[VAL_5]] { 115b8a021dbSAart Bik// CHECK: %[[VAL_26:.*]] = memref.load %[[VAL_11]]{{\[}}%[[VAL_20]]] : memref<32xi64> 116a54f4eaeSMogball// CHECK: %[[VAL_27:.*]] = arith.subi %[[VAL_7]], %[[VAL_26]] : i64 117b8a021dbSAart Bik// CHECK: memref.store %[[VAL_27]], %[[VAL_12]]{{\[}}%[[VAL_20]]] : memref<32xi64> 118b8a021dbSAart Bik// CHECK: } else { 119b8a021dbSAart Bik// CHECK: } 120b8a021dbSAart Bik// CHECK: } 121a54f4eaeSMogball// CHECK: %[[VAL_28:.*]] = arith.cmpi eq, %[[VAL_21]], %[[VAL_20]] : index 122a54f4eaeSMogball// CHECK: %[[VAL_29:.*]] = arith.addi %[[VAL_19]], %[[VAL_6]] : index 123dec8af70SRiver Riddle// CHECK: %[[VAL_30:.*]] = arith.select %[[VAL_28]], %[[VAL_29]], %[[VAL_19]] : index 124a54f4eaeSMogball// CHECK: %[[VAL_31:.*]] = arith.addi %[[VAL_20]], %[[VAL_6]] : index 125b8a021dbSAart Bik// CHECK: scf.yield %[[VAL_30]], %[[VAL_31]] : index, index 126b8a021dbSAart Bik// CHECK: } 127b8a021dbSAart Bik// CHECK: scf.for %[[VAL_32:.*]] = %[[VAL_33:.*]]#1 to %[[VAL_3]] step %[[VAL_6]] { 128b8a021dbSAart Bik// CHECK: %[[VAL_34:.*]] = memref.load %[[VAL_11]]{{\[}}%[[VAL_32]]] : memref<32xi64> 129a54f4eaeSMogball// CHECK: %[[VAL_35:.*]] = arith.subi %[[VAL_7]], %[[VAL_34]] : i64 130b8a021dbSAart Bik// CHECK: memref.store %[[VAL_35]], %[[VAL_12]]{{\[}}%[[VAL_32]]] : memref<32xi64> 131b8a021dbSAart Bik// CHECK: } 13257470abcSAlexander Belyaev// CHECK: %[[VAL_36:.*]] = bufferization.to_tensor %[[VAL_12]] : memref<32xi64> 133b8a021dbSAart Bik// CHECK: return %[[VAL_36]] : tensor<32xi64> 134b8a021dbSAart Bik// CHECK: } 135fb35cd3bSRiver Riddlefunc.func @sub(%arga: tensor<32xi64, #SV>, 136b8a021dbSAart Bik %argb: tensor<32xi64>, 137c66303c2SMatthias Springer %argx: tensor<32xi64>) -> tensor<32xi64> { 138b8a021dbSAart Bik %0 = linalg.generic #trait2 139b8a021dbSAart Bik ins(%arga, %argb: tensor<32xi64, #SV>, tensor<32xi64>) 140b8a021dbSAart Bik outs(%argx: tensor<32xi64>) { 141b8a021dbSAart Bik ^bb(%a: i64, %b: i64, %x: i64): 142a54f4eaeSMogball %0 = arith.subi %a, %b : i64 143b8a021dbSAart Bik linalg.yield %0 : i64 144b8a021dbSAart Bik } -> tensor<32xi64> 145b8a021dbSAart Bik return %0 : tensor<32xi64> 146b8a021dbSAart Bik} 147b8a021dbSAart Bik 148b8a021dbSAart Bik// CHECK-LABEL: func @mul( 149c5a67e16SYinying Li// CHECK-SAME: %[[VAL_0:.*]]: tensor<32xi64, #sparse{{[0-9]*}}>, 150b8a021dbSAart Bik// CHECK-SAME: %[[VAL_1:.*]]: tensor<32xi64>, 151c66303c2SMatthias Springer// CHECK-SAME: %[[VAL_2:.*]]: tensor<32xi64>) -> tensor<32xi64> { 152a54f4eaeSMogball// CHECK-DAG: %[[VAL_3:.*]] = arith.constant 0 : index 153a54f4eaeSMogball// CHECK-DAG: %[[VAL_4:.*]] = arith.constant 1 : index 154a02010b3SPeiming Liu// CHECK-DAG: %[[VAL_5:.*]] = sparse_tensor.positions %[[VAL_0]] {level = 0 : index} : tensor<32xi64, #sparse{{[0-9]*}}> 155a02010b3SPeiming Liu// CHECK-DAG: %[[VAL_6:.*]] = sparse_tensor.coordinates %[[VAL_0]] {level = 0 : index} : tensor<32xi64, #sparse{{[0-9]*}}> 156a02010b3SPeiming Liu// CHECK-DAG: %[[VAL_7:.*]] = sparse_tensor.values %[[VAL_0]] : tensor<32xi64, #sparse{{[0-9]*}}> 157*ced2fc78SChristopher Bate// CHECK-DAG: %[[VAL_8:.*]] = bufferization.to_memref %[[VAL_1]] : tensor<32xi64> to memref<32xi64> 158*ced2fc78SChristopher Bate// CHECK-DAG: %[[VAL_9:.*]] = bufferization.to_memref %[[VAL_2]] : tensor<32xi64> to memref<32xi64> 159b8a021dbSAart Bik// CHECK: %[[VAL_10:.*]] = memref.load %[[VAL_5]]{{\[}}%[[VAL_3]]] : memref<?xindex> 160b8a021dbSAart Bik// CHECK: %[[VAL_11:.*]] = memref.load %[[VAL_5]]{{\[}}%[[VAL_4]]] : memref<?xindex> 161b8a021dbSAart Bik// CHECK: scf.for %[[VAL_12:.*]] = %[[VAL_10]] to %[[VAL_11]] step %[[VAL_4]] { 162b8a021dbSAart Bik// CHECK: %[[VAL_13:.*]] = memref.load %[[VAL_6]]{{\[}}%[[VAL_12]]] : memref<?xindex> 163b8a021dbSAart Bik// CHECK: %[[VAL_14:.*]] = memref.load %[[VAL_7]]{{\[}}%[[VAL_12]]] : memref<?xi64> 164b8a021dbSAart Bik// CHECK: %[[VAL_15:.*]] = memref.load %[[VAL_8]]{{\[}}%[[VAL_13]]] : memref<32xi64> 165a54f4eaeSMogball// CHECK: %[[VAL_16:.*]] = arith.muli %[[VAL_14]], %[[VAL_15]] : i64 166b8a021dbSAart Bik// CHECK: memref.store %[[VAL_16]], %[[VAL_9]]{{\[}}%[[VAL_13]]] : memref<32xi64> 167b8a021dbSAart Bik// CHECK: } 16857470abcSAlexander Belyaev// CHECK: %[[VAL_17:.*]] = bufferization.to_tensor %[[VAL_9]] : memref<32xi64> 169b8a021dbSAart Bik// CHECK: return %[[VAL_17]] : tensor<32xi64> 170b8a021dbSAart Bik// CHECK: } 171fb35cd3bSRiver Riddlefunc.func @mul(%arga: tensor<32xi64, #SV>, 172b8a021dbSAart Bik %argb: tensor<32xi64>, 173c66303c2SMatthias Springer %argx: tensor<32xi64>) -> tensor<32xi64> { 174b8a021dbSAart Bik %0 = linalg.generic #trait2 175b8a021dbSAart Bik ins(%arga, %argb: tensor<32xi64, #SV>, tensor<32xi64>) 176b8a021dbSAart Bik outs(%argx: tensor<32xi64>) { 177b8a021dbSAart Bik ^bb(%a: i64, %b: i64, %x: i64): 178a54f4eaeSMogball %0 = arith.muli %a, %b : i64 179b8a021dbSAart Bik linalg.yield %0 : i64 180b8a021dbSAart Bik } -> tensor<32xi64> 181b8a021dbSAart Bik return %0 : tensor<32xi64> 182b8a021dbSAart Bik} 183622eb169SAart Bik 184622eb169SAart Bik// CHECK-LABEL: func @divsbyc( 185c5a67e16SYinying Li// CHECK-SAME: %[[VAL_0:.*]]: tensor<32xi64, #sparse{{[0-9]*}}>, 186c66303c2SMatthias Springer// CHECK-SAME: %[[VAL_1:.*]]: tensor<32xi64>) -> tensor<32xi64> { 187a54f4eaeSMogball// CHECK-DAG: %[[VAL_2:.*]] = arith.constant 2 : i64 188a54f4eaeSMogball// CHECK-DAG: %[[VAL_3:.*]] = arith.constant 0 : index 189a54f4eaeSMogball// CHECK-DAG: %[[VAL_4:.*]] = arith.constant 1 : index 190a02010b3SPeiming Liu// CHECK-DAG: %[[VAL_5:.*]] = sparse_tensor.positions %[[VAL_0]] {level = 0 : index} : tensor<32xi64, #sparse{{[0-9]*}}> 191a02010b3SPeiming Liu// CHECK-DAG: %[[VAL_6:.*]] = sparse_tensor.coordinates %[[VAL_0]] {level = 0 : index} : tensor<32xi64, #sparse{{[0-9]*}}> 192a02010b3SPeiming Liu// CHECK-DAG: %[[VAL_7:.*]] = sparse_tensor.values %[[VAL_0]] : tensor<32xi64, #sparse{{[0-9]*}}> 193*ced2fc78SChristopher Bate// CHECK-DAG: %[[VAL_8:.*]] = bufferization.to_memref %[[VAL_1]] : tensor<32xi64> to memref<32xi64> 194622eb169SAart Bik// CHECK: %[[VAL_9:.*]] = memref.load %[[VAL_5]]{{\[}}%[[VAL_3]]] : memref<?xindex> 195622eb169SAart Bik// CHECK: %[[VAL_10:.*]] = memref.load %[[VAL_5]]{{\[}}%[[VAL_4]]] : memref<?xindex> 196622eb169SAart Bik// CHECK: scf.for %[[VAL_11:.*]] = %[[VAL_9]] to %[[VAL_10]] step %[[VAL_4]] { 197622eb169SAart Bik// CHECK: %[[VAL_12:.*]] = memref.load %[[VAL_6]]{{\[}}%[[VAL_11]]] : memref<?xindex> 198622eb169SAart Bik// CHECK: %[[VAL_13:.*]] = memref.load %[[VAL_7]]{{\[}}%[[VAL_11]]] : memref<?xi64> 199a54f4eaeSMogball// CHECK: %[[VAL_14:.*]] = arith.divsi %[[VAL_13]], %[[VAL_2]] : i64 200622eb169SAart Bik// CHECK: memref.store %[[VAL_14]], %[[VAL_8]]{{\[}}%[[VAL_12]]] : memref<32xi64> 201622eb169SAart Bik// CHECK: } 20257470abcSAlexander Belyaev// CHECK: %[[VAL_15:.*]] = bufferization.to_tensor %[[VAL_8]] : memref<32xi64> 203622eb169SAart Bik// CHECK: return %[[VAL_15]] : tensor<32xi64> 204622eb169SAart Bik// CHECK: } 205fb35cd3bSRiver Riddlefunc.func @divsbyc(%arga: tensor<32xi64, #SV>, 206c66303c2SMatthias Springer %argx: tensor<32xi64>) -> tensor<32xi64> { 207a54f4eaeSMogball %c = arith.constant 2 : i64 208622eb169SAart Bik %0 = linalg.generic #traitc 209622eb169SAart Bik ins(%arga: tensor<32xi64, #SV>) 210622eb169SAart Bik outs(%argx: tensor<32xi64>) { 211622eb169SAart Bik ^bb(%a: i64, %x: i64): 212a54f4eaeSMogball %0 = arith.divsi %a, %c : i64 213622eb169SAart Bik linalg.yield %0 : i64 214622eb169SAart Bik } -> tensor<32xi64> 215622eb169SAart Bik return %0 : tensor<32xi64> 216622eb169SAart Bik} 217622eb169SAart Bik 218622eb169SAart Bik// CHECK-LABEL: func @divubyc( 219c5a67e16SYinying Li// CHECK-SAME: %[[VAL_0:.*]]: tensor<32xi64, #sparse{{[0-9]*}}>, 220c66303c2SMatthias Springer// CHECK-SAME: %[[VAL_1:.*]]: tensor<32xi64>) -> tensor<32xi64> { 221a54f4eaeSMogball// CHECK-DAG: %[[VAL_2:.*]] = arith.constant 2 : i64 222a54f4eaeSMogball// CHECK-DAG: %[[VAL_3:.*]] = arith.constant 0 : index 223a54f4eaeSMogball// CHECK-DAG: %[[VAL_4:.*]] = arith.constant 1 : index 224a02010b3SPeiming Liu// CHECK-DAG: %[[VAL_5:.*]] = sparse_tensor.positions %[[VAL_0]] {level = 0 : index} : tensor<32xi64, #sparse{{[0-9]*}}> 225a02010b3SPeiming Liu// CHECK-DAG: %[[VAL_6:.*]] = sparse_tensor.coordinates %[[VAL_0]] {level = 0 : index} : tensor<32xi64, #sparse{{[0-9]*}}> 226a02010b3SPeiming Liu// CHECK-DAG: %[[VAL_7:.*]] = sparse_tensor.values %[[VAL_0]] : tensor<32xi64, #sparse{{[0-9]*}}> 227*ced2fc78SChristopher Bate// CHECK-DAG: %[[VAL_8:.*]] = bufferization.to_memref %[[VAL_1]] : tensor<32xi64> to memref<32xi64> 228622eb169SAart Bik// CHECK: %[[VAL_9:.*]] = memref.load %[[VAL_5]]{{\[}}%[[VAL_3]]] : memref<?xindex> 229622eb169SAart Bik// CHECK: %[[VAL_10:.*]] = memref.load %[[VAL_5]]{{\[}}%[[VAL_4]]] : memref<?xindex> 230622eb169SAart Bik// CHECK: scf.for %[[VAL_11:.*]] = %[[VAL_9]] to %[[VAL_10]] step %[[VAL_4]] { 231622eb169SAart Bik// CHECK: %[[VAL_12:.*]] = memref.load %[[VAL_6]]{{\[}}%[[VAL_11]]] : memref<?xindex> 232622eb169SAart Bik// CHECK: %[[VAL_13:.*]] = memref.load %[[VAL_7]]{{\[}}%[[VAL_11]]] : memref<?xi64> 233a54f4eaeSMogball// CHECK: %[[VAL_14:.*]] = arith.divui %[[VAL_13]], %[[VAL_2]] : i64 234622eb169SAart Bik// CHECK: memref.store %[[VAL_14]], %[[VAL_8]]{{\[}}%[[VAL_12]]] : memref<32xi64> 235622eb169SAart Bik// CHECK: } 23657470abcSAlexander Belyaev// CHECK: %[[VAL_15:.*]] = bufferization.to_tensor %[[VAL_8]] : memref<32xi64> 237622eb169SAart Bik// CHECK: return %[[VAL_15]] : tensor<32xi64> 238622eb169SAart Bik// CHECK: } 239fb35cd3bSRiver Riddlefunc.func @divubyc(%arga: tensor<32xi64, #SV>, 240c66303c2SMatthias Springer %argx: tensor<32xi64>) -> tensor<32xi64> { 241a54f4eaeSMogball %c = arith.constant 2 : i64 242622eb169SAart Bik %0 = linalg.generic #traitc 243622eb169SAart Bik ins(%arga: tensor<32xi64, #SV>) 244622eb169SAart Bik outs(%argx: tensor<32xi64>) { 245622eb169SAart Bik ^bb(%a: i64, %x: i64): 246a54f4eaeSMogball %0 = arith.divui %a, %c : i64 247622eb169SAart Bik linalg.yield %0 : i64 248622eb169SAart Bik } -> tensor<32xi64> 249622eb169SAart Bik return %0 : tensor<32xi64> 250622eb169SAart Bik} 25145b3cfe8SAart Bik 25245b3cfe8SAart Bik// CHECK-LABEL: func @and( 253c5a67e16SYinying Li// CHECK-SAME: %[[VAL_0:.*]]: tensor<32xi64, #sparse{{[0-9]*}}>, 25445b3cfe8SAart Bik// CHECK-SAME: %[[VAL_1:.*]]: tensor<32xi64>, 255c66303c2SMatthias Springer// CHECK-SAME: %[[VAL_2:.*]]: tensor<32xi64>) -> tensor<32xi64> { 256a54f4eaeSMogball// CHECK-DAG: %[[VAL_3:.*]] = arith.constant 0 : index 257a54f4eaeSMogball// CHECK-DAG: %[[VAL_4:.*]] = arith.constant 1 : index 258a02010b3SPeiming Liu// CHECK-DAG: %[[VAL_5:.*]] = sparse_tensor.positions %[[VAL_0]] {level = 0 : index} : tensor<32xi64, #sparse{{[0-9]*}}> to memref<?xindex> 259a02010b3SPeiming Liu// CHECK-DAG: %[[VAL_6:.*]] = sparse_tensor.coordinates %[[VAL_0]] {level = 0 : index} : tensor<32xi64, #sparse{{[0-9]*}}> to memref<?xindex> 260a02010b3SPeiming Liu// CHECK-DAG: %[[VAL_7:.*]] = sparse_tensor.values %[[VAL_0]] : tensor<32xi64, #sparse{{[0-9]*}}> to memref<?xi64> 261*ced2fc78SChristopher Bate// CHECK-DAG: %[[VAL_8:.*]] = bufferization.to_memref %[[VAL_1]] : tensor<32xi64> to memref<32xi64> 262*ced2fc78SChristopher Bate// CHECK-DAG: %[[VAL_9:.*]] = bufferization.to_memref %[[VAL_2]] : tensor<32xi64> to memref<32xi64> 26345b3cfe8SAart Bik// CHECK: %[[VAL_10:.*]] = memref.load %[[VAL_5]]{{\[}}%[[VAL_3]]] : memref<?xindex> 26445b3cfe8SAart Bik// CHECK: %[[VAL_11:.*]] = memref.load %[[VAL_5]]{{\[}}%[[VAL_4]]] : memref<?xindex> 26545b3cfe8SAart Bik// CHECK: scf.for %[[VAL_12:.*]] = %[[VAL_10]] to %[[VAL_11]] step %[[VAL_4]] { 26645b3cfe8SAart Bik// CHECK: %[[VAL_13:.*]] = memref.load %[[VAL_6]]{{\[}}%[[VAL_12]]] : memref<?xindex> 26745b3cfe8SAart Bik// CHECK: %[[VAL_14:.*]] = memref.load %[[VAL_7]]{{\[}}%[[VAL_12]]] : memref<?xi64> 26845b3cfe8SAart Bik// CHECK: %[[VAL_15:.*]] = memref.load %[[VAL_8]]{{\[}}%[[VAL_13]]] : memref<32xi64> 269a54f4eaeSMogball// CHECK: %[[VAL_16:.*]] = arith.andi %[[VAL_14]], %[[VAL_15]] : i64 27045b3cfe8SAart Bik// CHECK: memref.store %[[VAL_16]], %[[VAL_9]]{{\[}}%[[VAL_13]]] : memref<32xi64> 27145b3cfe8SAart Bik// CHECK: } 27257470abcSAlexander Belyaev// CHECK: %[[VAL_17:.*]] = bufferization.to_tensor %[[VAL_9]] : memref<32xi64> 27345b3cfe8SAart Bik// CHECK: return %[[VAL_17]] : tensor<32xi64> 27445b3cfe8SAart Bik// CHECK: } 275fb35cd3bSRiver Riddlefunc.func @and(%arga: tensor<32xi64, #SV>, 27645b3cfe8SAart Bik %argb: tensor<32xi64>, 277c66303c2SMatthias Springer %argx: tensor<32xi64>) -> tensor<32xi64> { 27845b3cfe8SAart Bik %0 = linalg.generic #trait2 27945b3cfe8SAart Bik ins(%arga, %argb: tensor<32xi64, #SV>, tensor<32xi64>) 28045b3cfe8SAart Bik outs(%argx: tensor<32xi64>) { 28145b3cfe8SAart Bik ^bb(%a: i64, %b: i64, %x: i64): 282a54f4eaeSMogball %0 = arith.andi %a, %b : i64 28345b3cfe8SAart Bik linalg.yield %0 : i64 28445b3cfe8SAart Bik } -> tensor<32xi64> 28545b3cfe8SAart Bik return %0 : tensor<32xi64> 28645b3cfe8SAart Bik} 28745b3cfe8SAart Bik 28845b3cfe8SAart Bik// CHECK-LABEL: func @or( 289c5a67e16SYinying Li// CHECK-SAME: %[[VAL_0:.*]]: tensor<32xi64, #sparse{{[0-9]*}}>, 29045b3cfe8SAart Bik// CHECK-SAME: %[[VAL_1:.*]]: tensor<32xi64>, 291c66303c2SMatthias Springer// CHECK-SAME: %[[VAL_2:.*]]: tensor<32xi64>) -> tensor<32xi64> { 292a54f4eaeSMogball// CHECK-DAG: %[[VAL_3:.*]] = arith.constant 32 : index 293a54f4eaeSMogball// CHECK-DAG: %[[VAL_4:.*]] = arith.constant 0 : index 294a54f4eaeSMogball// CHECK-DAG: %[[VAL_5:.*]] = arith.constant true 295a54f4eaeSMogball// CHECK-DAG: %[[VAL_6:.*]] = arith.constant 1 : index 296a02010b3SPeiming Liu// CHECK-DAG: %[[VAL_7:.*]] = sparse_tensor.positions %[[VAL_0]] {level = 0 : index} : tensor<32xi64, #sparse{{[0-9]*}}> to memref<?xindex> 297a02010b3SPeiming Liu// CHECK-DAG: %[[VAL_8:.*]] = sparse_tensor.coordinates %[[VAL_0]] {level = 0 : index} : tensor<32xi64, #sparse{{[0-9]*}}> to memref<?xindex> 298a02010b3SPeiming Liu// CHECK-DAG: %[[VAL_9:.*]] = sparse_tensor.values %[[VAL_0]] : tensor<32xi64, #sparse{{[0-9]*}}> to memref<?xi64> 299*ced2fc78SChristopher Bate// CHECK-DAG: %[[VAL_10:.*]] = bufferization.to_memref %[[VAL_1]] : tensor<32xi64> to memref<32xi64> 300*ced2fc78SChristopher Bate// CHECK-DAG: %[[VAL_11:.*]] = bufferization.to_memref %[[VAL_2]] : tensor<32xi64> to memref<32xi64> 30145b3cfe8SAart Bik// CHECK: %[[VAL_12:.*]] = memref.load %[[VAL_7]]{{\[}}%[[VAL_4]]] : memref<?xindex> 30245b3cfe8SAart Bik// CHECK: %[[VAL_13:.*]] = memref.load %[[VAL_7]]{{\[}}%[[VAL_6]]] : memref<?xindex> 30345b3cfe8SAart Bik// CHECK: %[[VAL_14:.*]]:2 = scf.while (%[[VAL_15:.*]] = %[[VAL_12]], %[[VAL_16:.*]] = %[[VAL_4]]) : (index, index) -> (index, index) { 304a54f4eaeSMogball// CHECK: %[[VAL_17:.*]] = arith.cmpi ult, %[[VAL_15]], %[[VAL_13]] : index 30545b3cfe8SAart Bik// CHECK: scf.condition(%[[VAL_17]]) %[[VAL_15]], %[[VAL_16]] : index, index 30645b3cfe8SAart Bik// CHECK: } do { 30745b3cfe8SAart Bik// CHECK: ^bb0(%[[VAL_18:.*]]: index, %[[VAL_19:.*]]: index): 30845b3cfe8SAart Bik// CHECK: %[[VAL_20:.*]] = memref.load %[[VAL_8]]{{\[}}%[[VAL_18]]] : memref<?xindex> 309a54f4eaeSMogball// CHECK: %[[VAL_21:.*]] = arith.cmpi eq, %[[VAL_20]], %[[VAL_19]] : index 31045b3cfe8SAart Bik// CHECK: scf.if %[[VAL_21]] { 31145b3cfe8SAart Bik// CHECK: %[[VAL_22:.*]] = memref.load %[[VAL_9]]{{\[}}%[[VAL_18]]] : memref<?xi64> 31245b3cfe8SAart Bik// CHECK: %[[VAL_23:.*]] = memref.load %[[VAL_10]]{{\[}}%[[VAL_19]]] : memref<32xi64> 313a54f4eaeSMogball// CHECK: %[[VAL_24:.*]] = arith.ori %[[VAL_22]], %[[VAL_23]] : i64 31445b3cfe8SAart Bik// CHECK: memref.store %[[VAL_24]], %[[VAL_11]]{{\[}}%[[VAL_19]]] : memref<32xi64> 31545b3cfe8SAart Bik// CHECK: } else { 31645b3cfe8SAart Bik// CHECK: scf.if %[[VAL_5]] { 31745b3cfe8SAart Bik// CHECK: %[[VAL_25:.*]] = memref.load %[[VAL_10]]{{\[}}%[[VAL_19]]] : memref<32xi64> 31845b3cfe8SAart Bik// CHECK: memref.store %[[VAL_25]], %[[VAL_11]]{{\[}}%[[VAL_19]]] : memref<32xi64> 31945b3cfe8SAart Bik// CHECK: } else { 32045b3cfe8SAart Bik// CHECK: } 32145b3cfe8SAart Bik// CHECK: } 322a54f4eaeSMogball// CHECK: %[[VAL_26:.*]] = arith.cmpi eq, %[[VAL_20]], %[[VAL_19]] : index 323a54f4eaeSMogball// CHECK: %[[VAL_27:.*]] = arith.addi %[[VAL_18]], %[[VAL_6]] : index 324dec8af70SRiver Riddle// CHECK: %[[VAL_28:.*]] = arith.select %[[VAL_26]], %[[VAL_27]], %[[VAL_18]] : index 325a54f4eaeSMogball// CHECK: %[[VAL_29:.*]] = arith.addi %[[VAL_19]], %[[VAL_6]] : index 32645b3cfe8SAart Bik// CHECK: scf.yield %[[VAL_28]], %[[VAL_29]] : index, index 32745b3cfe8SAart Bik// CHECK: } 32845b3cfe8SAart Bik// CHECK: scf.for %[[VAL_30:.*]] = %[[VAL_31:.*]]#1 to %[[VAL_3]] step %[[VAL_6]] { 32945b3cfe8SAart Bik// CHECK: %[[VAL_32:.*]] = memref.load %[[VAL_10]]{{\[}}%[[VAL_30]]] : memref<32xi64> 33045b3cfe8SAart Bik// CHECK: memref.store %[[VAL_32]], %[[VAL_11]]{{\[}}%[[VAL_30]]] : memref<32xi64> 33145b3cfe8SAart Bik// CHECK: } 33257470abcSAlexander Belyaev// CHECK: %[[VAL_33:.*]] = bufferization.to_tensor %[[VAL_11]] : memref<32xi64> 33345b3cfe8SAart Bik// CHECK: return %[[VAL_33]] : tensor<32xi64> 33445b3cfe8SAart Bik// CHECK: } 335fb35cd3bSRiver Riddlefunc.func @or(%arga: tensor<32xi64, #SV>, 33645b3cfe8SAart Bik %argb: tensor<32xi64>, 337c66303c2SMatthias Springer %argx: tensor<32xi64>) -> tensor<32xi64> { 33845b3cfe8SAart Bik %0 = linalg.generic #trait2 33945b3cfe8SAart Bik ins(%arga, %argb: tensor<32xi64, #SV>, tensor<32xi64>) 34045b3cfe8SAart Bik outs(%argx: tensor<32xi64>) { 34145b3cfe8SAart Bik ^bb(%a: i64, %b: i64, %x: i64): 342a54f4eaeSMogball %0 = arith.ori %a, %b : i64 34345b3cfe8SAart Bik linalg.yield %0 : i64 34445b3cfe8SAart Bik } -> tensor<32xi64> 34545b3cfe8SAart Bik return %0 : tensor<32xi64> 34645b3cfe8SAart Bik} 34745b3cfe8SAart Bik 348123e8dfcSAart Bik// CHECK-LABEL: func @xor( 349c5a67e16SYinying Li// CHECK-SAME: %[[VAL_0:.*]]: tensor<32xi64, #sparse{{[0-9]*}}>, 350123e8dfcSAart Bik// CHECK-SAME: %[[VAL_1:.*]]: tensor<32xi64>, 351c66303c2SMatthias Springer// CHECK-SAME: %[[VAL_2:.*]]: tensor<32xi64>) -> tensor<32xi64> { 352a54f4eaeSMogball// CHECK-DAG: %[[VAL_3:.*]] = arith.constant 32 : index 353a54f4eaeSMogball// CHECK-DAG: %[[VAL_4:.*]] = arith.constant 0 : index 354a54f4eaeSMogball// CHECK-DAG: %[[VAL_5:.*]] = arith.constant true 355a54f4eaeSMogball// CHECK-DAG: %[[VAL_6:.*]] = arith.constant 1 : index 356a02010b3SPeiming Liu// CHECK-DAG: %[[VAL_7:.*]] = sparse_tensor.positions %[[VAL_0]] {level = 0 : index} : tensor<32xi64, #sparse{{[0-9]*}}> to memref<?xindex> 357a02010b3SPeiming Liu// CHECK-DAG: %[[VAL_8:.*]] = sparse_tensor.coordinates %[[VAL_0]] {level = 0 : index} : tensor<32xi64, #sparse{{[0-9]*}}> to memref<?xindex> 358a02010b3SPeiming Liu// CHECK-DAG: %[[VAL_9:.*]] = sparse_tensor.values %[[VAL_0]] : tensor<32xi64, #sparse{{[0-9]*}}> to memref<?xi64> 359*ced2fc78SChristopher Bate// CHECK-DAG: %[[VAL_10:.*]] = bufferization.to_memref %[[VAL_1]] : tensor<32xi64> to memref<32xi64> 360*ced2fc78SChristopher Bate// CHECK-DAG: %[[VAL_11:.*]] = bufferization.to_memref %[[VAL_2]] : tensor<32xi64> to memref<32xi64> 361123e8dfcSAart Bik// CHECK: %[[VAL_12:.*]] = memref.load %[[VAL_7]]{{\[}}%[[VAL_4]]] : memref<?xindex> 362123e8dfcSAart Bik// CHECK: %[[VAL_13:.*]] = memref.load %[[VAL_7]]{{\[}}%[[VAL_6]]] : memref<?xindex> 363123e8dfcSAart Bik// CHECK: %[[VAL_14:.*]]:2 = scf.while (%[[VAL_15:.*]] = %[[VAL_12]], %[[VAL_16:.*]] = %[[VAL_4]]) : (index, index) -> (index, index) { 364a54f4eaeSMogball// CHECK: %[[VAL_17:.*]] = arith.cmpi ult, %[[VAL_15]], %[[VAL_13]] : index 365123e8dfcSAart Bik// CHECK: scf.condition(%[[VAL_17]]) %[[VAL_15]], %[[VAL_16]] : index, index 366123e8dfcSAart Bik// CHECK: } do { 367123e8dfcSAart Bik// CHECK: ^bb0(%[[VAL_18:.*]]: index, %[[VAL_19:.*]]: index): 368123e8dfcSAart Bik// CHECK: %[[VAL_20:.*]] = memref.load %[[VAL_8]]{{\[}}%[[VAL_18]]] : memref<?xindex> 369a54f4eaeSMogball// CHECK: %[[VAL_21:.*]] = arith.cmpi eq, %[[VAL_20]], %[[VAL_19]] : index 370123e8dfcSAart Bik// CHECK: scf.if %[[VAL_21]] { 371123e8dfcSAart Bik// CHECK: %[[VAL_22:.*]] = memref.load %[[VAL_9]]{{\[}}%[[VAL_18]]] : memref<?xi64> 372123e8dfcSAart Bik// CHECK: %[[VAL_23:.*]] = memref.load %[[VAL_10]]{{\[}}%[[VAL_19]]] : memref<32xi64> 373a54f4eaeSMogball// CHECK: %[[VAL_24:.*]] = arith.xori %[[VAL_22]], %[[VAL_23]] : i64 374123e8dfcSAart Bik// CHECK: memref.store %[[VAL_24]], %[[VAL_11]]{{\[}}%[[VAL_19]]] : memref<32xi64> 375123e8dfcSAart Bik// CHECK: } else { 376123e8dfcSAart Bik// CHECK: scf.if %[[VAL_5]] { 377123e8dfcSAart Bik// CHECK: %[[VAL_25:.*]] = memref.load %[[VAL_10]]{{\[}}%[[VAL_19]]] : memref<32xi64> 378123e8dfcSAart Bik// CHECK: memref.store %[[VAL_25]], %[[VAL_11]]{{\[}}%[[VAL_19]]] : memref<32xi64> 379123e8dfcSAart Bik// CHECK: } else { 380123e8dfcSAart Bik// CHECK: } 381123e8dfcSAart Bik// CHECK: } 382a54f4eaeSMogball// CHECK: %[[VAL_26:.*]] = arith.cmpi eq, %[[VAL_20]], %[[VAL_19]] : index 383a54f4eaeSMogball// CHECK: %[[VAL_27:.*]] = arith.addi %[[VAL_18]], %[[VAL_6]] : index 384dec8af70SRiver Riddle// CHECK: %[[VAL_28:.*]] = arith.select %[[VAL_26]], %[[VAL_27]], %[[VAL_18]] : index 385a54f4eaeSMogball// CHECK: %[[VAL_29:.*]] = arith.addi %[[VAL_19]], %[[VAL_6]] : index 386123e8dfcSAart Bik// CHECK: scf.yield %[[VAL_28]], %[[VAL_29]] : index, index 387123e8dfcSAart Bik// CHECK: } 388123e8dfcSAart Bik// CHECK: scf.for %[[VAL_30:.*]] = %[[VAL_31:.*]]#1 to %[[VAL_3]] step %[[VAL_6]] { 389123e8dfcSAart Bik// CHECK: %[[VAL_32:.*]] = memref.load %[[VAL_10]]{{\[}}%[[VAL_30]]] : memref<32xi64> 390123e8dfcSAart Bik// CHECK: memref.store %[[VAL_32]], %[[VAL_11]]{{\[}}%[[VAL_30]]] : memref<32xi64> 391123e8dfcSAart Bik// CHECK: } 39257470abcSAlexander Belyaev// CHECK: %[[VAL_33:.*]] = bufferization.to_tensor %[[VAL_11]] : memref<32xi64> 393123e8dfcSAart Bik// CHECK: return %[[VAL_33]] : tensor<32xi64> 394123e8dfcSAart Bik// CHECK: } 395fb35cd3bSRiver Riddlefunc.func @xor(%arga: tensor<32xi64, #SV>, 396123e8dfcSAart Bik %argb: tensor<32xi64>, 397c66303c2SMatthias Springer %argx: tensor<32xi64>) -> tensor<32xi64> { 398123e8dfcSAart Bik %0 = linalg.generic #trait2 399123e8dfcSAart Bik ins(%arga, %argb: tensor<32xi64, #SV>, tensor<32xi64>) 400123e8dfcSAart Bik outs(%argx: tensor<32xi64>) { 401123e8dfcSAart Bik ^bb(%a: i64, %b: i64, %x: i64): 402a54f4eaeSMogball %0 = arith.xori %a, %b : i64 403123e8dfcSAart Bik linalg.yield %0 : i64 404123e8dfcSAart Bik } -> tensor<32xi64> 405123e8dfcSAart Bik return %0 : tensor<32xi64> 406123e8dfcSAart Bik} 4072b6e4332SAart Bik 4082b6e4332SAart Bik// CHECK-LABEL: func @ashrbyc( 409c5a67e16SYinying Li// CHECK-SAME: %[[VAL_0:.*]]: tensor<32xi64, #sparse{{[0-9]*}}>, 410c66303c2SMatthias Springer// CHECK-SAME: %[[VAL_1:.*]]: tensor<32xi64>) -> tensor<32xi64> { 411a54f4eaeSMogball// CHECK-DAG: %[[VAL_2:.*]] = arith.constant 2 : i64 412a54f4eaeSMogball// CHECK-DAG: %[[VAL_3:.*]] = arith.constant 0 : index 413a54f4eaeSMogball// CHECK-DAG: %[[VAL_4:.*]] = arith.constant 1 : index 414a02010b3SPeiming Liu// CHECK-DAG: %[[VAL_5:.*]] = sparse_tensor.positions %[[VAL_0]] {level = 0 : index} : tensor<32xi64, #sparse{{[0-9]*}}> to memref<?xindex> 415a02010b3SPeiming Liu// CHECK-DAG: %[[VAL_6:.*]] = sparse_tensor.coordinates %[[VAL_0]] {level = 0 : index} : tensor<32xi64, #sparse{{[0-9]*}}> to memref<?xindex> 416a02010b3SPeiming Liu// CHECK-DAG: %[[VAL_7:.*]] = sparse_tensor.values %[[VAL_0]] : tensor<32xi64, #sparse{{[0-9]*}}> to memref<?xi64> 417*ced2fc78SChristopher Bate// CHECK-DAG: %[[VAL_8:.*]] = bufferization.to_memref %[[VAL_1]] : tensor<32xi64> to memref<32xi64> 4182b6e4332SAart Bik// CHECK: %[[VAL_9:.*]] = memref.load %[[VAL_5]]{{\[}}%[[VAL_3]]] : memref<?xindex> 4192b6e4332SAart Bik// CHECK: %[[VAL_10:.*]] = memref.load %[[VAL_5]]{{\[}}%[[VAL_4]]] : memref<?xindex> 4202b6e4332SAart Bik// CHECK: scf.for %[[VAL_11:.*]] = %[[VAL_9]] to %[[VAL_10]] step %[[VAL_4]] { 4212b6e4332SAart Bik// CHECK: %[[VAL_12:.*]] = memref.load %[[VAL_6]]{{\[}}%[[VAL_11]]] : memref<?xindex> 4222b6e4332SAart Bik// CHECK: %[[VAL_13:.*]] = memref.load %[[VAL_7]]{{\[}}%[[VAL_11]]] : memref<?xi64> 423a54f4eaeSMogball// CHECK: %[[VAL_14:.*]] = arith.shrsi %[[VAL_13]], %[[VAL_2]] : i64 4242b6e4332SAart Bik// CHECK: memref.store %[[VAL_14]], %[[VAL_8]]{{\[}}%[[VAL_12]]] : memref<32xi64> 4252b6e4332SAart Bik// CHECK: } 42657470abcSAlexander Belyaev// CHECK: %[[VAL_15:.*]] = bufferization.to_tensor %[[VAL_8]] : memref<32xi64> 4272b6e4332SAart Bik// CHECK: return %[[VAL_15]] : tensor<32xi64> 4282b6e4332SAart Bik// CHECK: } 429fb35cd3bSRiver Riddlefunc.func @ashrbyc(%arga: tensor<32xi64, #SV>, 430c66303c2SMatthias Springer %argx: tensor<32xi64>) -> tensor<32xi64> { 431a54f4eaeSMogball %c = arith.constant 2 : i64 4322b6e4332SAart Bik %0 = linalg.generic #traitc 4332b6e4332SAart Bik ins(%arga: tensor<32xi64, #SV>) 4342b6e4332SAart Bik outs(%argx: tensor<32xi64>) { 4352b6e4332SAart Bik ^bb(%a: i64, %x: i64): 436a54f4eaeSMogball %0 = arith.shrsi %a, %c : i64 4372b6e4332SAart Bik linalg.yield %0 : i64 4382b6e4332SAart Bik } -> tensor<32xi64> 4392b6e4332SAart Bik return %0 : tensor<32xi64> 4402b6e4332SAart Bik} 4412b6e4332SAart Bik 4422b6e4332SAart Bik// CHECK-LABEL: func @lsrbyc( 443c5a67e16SYinying Li// CHECK-SAME: %[[VAL_0:.*]]: tensor<32xi64, #sparse{{[0-9]*}}>, 444c66303c2SMatthias Springer// CHECK-SAME: %[[VAL_1:.*]]: tensor<32xi64>) -> tensor<32xi64> { 445a54f4eaeSMogball// CHECK-DAG: %[[VAL_2:.*]] = arith.constant 2 : i64 446a54f4eaeSMogball// CHECK-DAG: %[[VAL_3:.*]] = arith.constant 0 : index 447a54f4eaeSMogball// CHECK-DAG: %[[VAL_4:.*]] = arith.constant 1 : index 448a02010b3SPeiming Liu// CHECK-DAG: %[[VAL_5:.*]] = sparse_tensor.positions %[[VAL_0]] {level = 0 : index} : tensor<32xi64, #sparse{{[0-9]*}}> to memref<?xindex> 449a02010b3SPeiming Liu// CHECK-DAG: %[[VAL_6:.*]] = sparse_tensor.coordinates %[[VAL_0]] {level = 0 : index} : tensor<32xi64, #sparse{{[0-9]*}}> to memref<?xindex> 450a02010b3SPeiming Liu// CHECK-DAG: %[[VAL_7:.*]] = sparse_tensor.values %[[VAL_0]] : tensor<32xi64, #sparse{{[0-9]*}}> to memref<?xi64> 451*ced2fc78SChristopher Bate// CHECK-DAG: %[[VAL_8:.*]] = bufferization.to_memref %[[VAL_1]] : tensor<32xi64> to memref<32xi64> 4522b6e4332SAart Bik// CHECK: %[[VAL_9:.*]] = memref.load %[[VAL_5]]{{\[}}%[[VAL_3]]] : memref<?xindex> 4532b6e4332SAart Bik// CHECK: %[[VAL_10:.*]] = memref.load %[[VAL_5]]{{\[}}%[[VAL_4]]] : memref<?xindex> 4542b6e4332SAart Bik// CHECK: scf.for %[[VAL_11:.*]] = %[[VAL_9]] to %[[VAL_10]] step %[[VAL_4]] { 4552b6e4332SAart Bik// CHECK: %[[VAL_12:.*]] = memref.load %[[VAL_6]]{{\[}}%[[VAL_11]]] : memref<?xindex> 4562b6e4332SAart Bik// CHECK: %[[VAL_13:.*]] = memref.load %[[VAL_7]]{{\[}}%[[VAL_11]]] : memref<?xi64> 457a54f4eaeSMogball// CHECK: %[[VAL_14:.*]] = arith.shrui %[[VAL_13]], %[[VAL_2]] : i64 4582b6e4332SAart Bik// CHECK: memref.store %[[VAL_14]], %[[VAL_8]]{{\[}}%[[VAL_12]]] : memref<32xi64> 4592b6e4332SAart Bik// CHECK: } 46057470abcSAlexander Belyaev// CHECK: %[[VAL_15:.*]] = bufferization.to_tensor %[[VAL_8]] : memref<32xi64> 4612b6e4332SAart Bik// CHECK: return %[[VAL_15]] : tensor<32xi64> 4622b6e4332SAart Bik// CHECK: } 463fb35cd3bSRiver Riddlefunc.func @lsrbyc(%arga: tensor<32xi64, #SV>, 464c66303c2SMatthias Springer %argx: tensor<32xi64>) -> tensor<32xi64> { 465a54f4eaeSMogball %c = arith.constant 2 : i64 4662b6e4332SAart Bik %0 = linalg.generic #traitc 4672b6e4332SAart Bik ins(%arga: tensor<32xi64, #SV>) 4682b6e4332SAart Bik outs(%argx: tensor<32xi64>) { 4692b6e4332SAart Bik ^bb(%a: i64, %x: i64): 470a54f4eaeSMogball %0 = arith.shrui %a, %c : i64 4712b6e4332SAart Bik linalg.yield %0 : i64 4722b6e4332SAart Bik } -> tensor<32xi64> 4732b6e4332SAart Bik return %0 : tensor<32xi64> 4742b6e4332SAart Bik} 4752b6e4332SAart Bik 4762b6e4332SAart Bik// CHECK-LABEL: func @lslbyc( 477c5a67e16SYinying Li// CHECK-SAME: %[[VAL_0:.*]]: tensor<32xi64, #sparse{{[0-9]*}}>, 478c66303c2SMatthias Springer// CHECK-SAME: %[[VAL_1:.*]]: tensor<32xi64>) -> tensor<32xi64> { 479a54f4eaeSMogball// CHECK-DAG: %[[VAL_2:.*]] = arith.constant 2 : i64 480a54f4eaeSMogball// CHECK-DAG: %[[VAL_3:.*]] = arith.constant 0 : index 481a54f4eaeSMogball// CHECK-DAG: %[[VAL_4:.*]] = arith.constant 1 : index 482a02010b3SPeiming Liu// CHECK-DAG: %[[VAL_5:.*]] = sparse_tensor.positions %[[VAL_0]] {level = 0 : index} : tensor<32xi64, #sparse{{[0-9]*}}> to memref<?xindex> 483a02010b3SPeiming Liu// CHECK-DAG: %[[VAL_6:.*]] = sparse_tensor.coordinates %[[VAL_0]] {level = 0 : index} : tensor<32xi64, #sparse{{[0-9]*}}> to memref<?xindex> 484a02010b3SPeiming Liu// CHECK-DAG: %[[VAL_7:.*]] = sparse_tensor.values %[[VAL_0]] : tensor<32xi64, #sparse{{[0-9]*}}> to memref<?xi64> 485*ced2fc78SChristopher Bate// CHECK-DAG: %[[VAL_8:.*]] = bufferization.to_memref %[[VAL_1]] : tensor<32xi64> to memref<32xi64> 4862b6e4332SAart Bik// CHECK: %[[VAL_9:.*]] = memref.load %[[VAL_5]]{{\[}}%[[VAL_3]]] : memref<?xindex> 4872b6e4332SAart Bik// CHECK: %[[VAL_10:.*]] = memref.load %[[VAL_5]]{{\[}}%[[VAL_4]]] : memref<?xindex> 4882b6e4332SAart Bik// CHECK: scf.for %[[VAL_11:.*]] = %[[VAL_9]] to %[[VAL_10]] step %[[VAL_4]] { 4892b6e4332SAart Bik// CHECK: %[[VAL_12:.*]] = memref.load %[[VAL_6]]{{\[}}%[[VAL_11]]] : memref<?xindex> 4902b6e4332SAart Bik// CHECK: %[[VAL_13:.*]] = memref.load %[[VAL_7]]{{\[}}%[[VAL_11]]] : memref<?xi64> 491a54f4eaeSMogball// CHECK: %[[VAL_14:.*]] = arith.shli %[[VAL_13]], %[[VAL_2]] : i64 4922b6e4332SAart Bik// CHECK: memref.store %[[VAL_14]], %[[VAL_8]]{{\[}}%[[VAL_12]]] : memref<32xi64> 4932b6e4332SAart Bik// CHECK: } 49457470abcSAlexander Belyaev// CHECK: %[[VAL_15:.*]] = bufferization.to_tensor %[[VAL_8]] : memref<32xi64> 4952b6e4332SAart Bik// CHECK: return %[[VAL_15]] : tensor<32xi64> 4962b6e4332SAart Bik// CHECK: } 497fb35cd3bSRiver Riddlefunc.func @lslbyc(%arga: tensor<32xi64, #SV>, 498c66303c2SMatthias Springer %argx: tensor<32xi64>) -> tensor<32xi64> { 499a54f4eaeSMogball %c = arith.constant 2 : i64 5002b6e4332SAart Bik %0 = linalg.generic #traitc 5012b6e4332SAart Bik ins(%arga: tensor<32xi64, #SV>) 5022b6e4332SAart Bik outs(%argx: tensor<32xi64>) { 5032b6e4332SAart Bik ^bb(%a: i64, %x: i64): 504a54f4eaeSMogball %0 = arith.shli %a, %c : i64 5052b6e4332SAart Bik linalg.yield %0 : i64 5062b6e4332SAart Bik } -> tensor<32xi64> 5072b6e4332SAart Bik return %0 : tensor<32xi64> 5082b6e4332SAart Bik} 509