1// RUN: mlir-opt -shape-to-shape-lowering -split-input-file %s | FileCheck %s 2 3// CHECK-LABEL: func @num_elements_to_reduce( 4// CHECK-SAME: [[ARG:%.*]]: !shape.shape) -> [[SIZE_TY:!.*]] { 5func @num_elements_to_reduce(%shape : !shape.shape) -> !shape.size { 6 %num_elements = shape.num_elements %shape 7 return %num_elements : !shape.size 8} 9// CHECK: [[C1:%.*]] = shape.const_size 1 10// CHECK: [[NUM_ELEMENTS:%.*]] = shape.reduce([[ARG]], [[C1]]) -> [[SIZE_TY]] 11// CHECK: ^bb0({{.*}}: index, [[DIM:%.*]]: [[SIZE_TY]], [[ACC:%.*]]: [[SIZE_TY]] 12// CHECK: [[NEW_ACC:%.*]] = shape.mul [[DIM]], [[ACC]] 13// CHECK: shape.yield [[NEW_ACC]] : [[SIZE_TY]] 14// CHECK: } 15// CHECK: return [[NUM_ELEMENTS]] : [[SIZE_TY]] 16 17