Skip to content

Commit 0ea48bd

Browse files
committed
test: update tests
1 parent 76ad596 commit 0ea48bd

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

flang/test/HLFIR/simplify-hlfir-intrinsics-product.fir

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ func.func @product_box_known_extents(%arg0: !fir.box<!fir.array<2x3xi32>>) -> !h
1010
// CHECK-SAME: %[[ARG0:.*]]: !fir.box<!fir.array<2x3xi32>>) -> !hlfir.expr<2xi32> {
1111
// CHECK: %[[CONSTANT_0:.*]] = arith.constant 0 : index
1212
// CHECK: %[[CONSTANT_1:.*]] = arith.constant 1 : index
13-
// CHECK: %[[CONSTANT_2:.*]] = arith.constant 0 : i32
13+
// CHECK: %[[CONSTANT_2:.*]] = arith.constant 1 : i32
1414
// CHECK: %[[CONSTANT_3:.*]] = arith.constant 2 : index
1515
// CHECK: %[[CONSTANT_4:.*]] = arith.constant 3 : index
1616
// CHECK: %[[SHAPE_0:.*]] = fir.shape %[[CONSTANT_3]] : (index) -> !fir.shape<1>
@@ -42,7 +42,7 @@ func.func @product_expr_known_extents(%arg0: !hlfir.expr<2x3xi32>) -> !hlfir.exp
4242
// CHECK-LABEL: func.func @product_expr_known_extents(
4343
// CHECK-SAME: %[[ARG0:.*]]: !hlfir.expr<2x3xi32>) -> !hlfir.expr<3xi32> {
4444
// CHECK: %[[CONSTANT_0:.*]] = arith.constant 1 : index
45-
// CHECK: %[[CONSTANT_1:.*]] = arith.constant 0 : i32
45+
// CHECK: %[[CONSTANT_1:.*]] = arith.constant 1 : i32
4646
// CHECK: %[[CONSTANT_2:.*]] = arith.constant 2 : index
4747
// CHECK: %[[CONSTANT_3:.*]] = arith.constant 3 : index
4848
// CHECK: %[[SHAPE_0:.*]] = fir.shape %[[CONSTANT_3]] : (index) -> !fir.shape<1>
@@ -58,6 +58,7 @@ func.func @product_expr_known_extents(%arg0: !hlfir.expr<2x3xi32>) -> !hlfir.exp
5858
// CHECK: return %[[ELEMENTAL_0]] : !hlfir.expr<3xi32>
5959
// CHECK: }
6060

61+
6162
// box with unknown extent
6263
func.func @product_box_unknown_extent1(%arg0: !fir.box<!fir.array<?x3xcomplex<f64>>>) -> !hlfir.expr<3xcomplex<f64>> {
6364
%cst = arith.constant 1 : i32
@@ -95,6 +96,7 @@ func.func @product_box_unknown_extent1(%arg0: !fir.box<!fir.array<?x3xcomplex<f6
9596
// CHECK: return %[[ELEMENTAL_0]] : !hlfir.expr<3xcomplex<f64>>
9697
// CHECK: }
9798

99+
98100
func.func @product_box_unknown_extent2(%arg0: !fir.box<!fir.array<?x3xcomplex<f64>>>) -> !hlfir.expr<?xcomplex<f64>> {
99101
%cst = arith.constant 2 : i32
100102
%res = hlfir.product %arg0 dim %cst : (!fir.box<!fir.array<?x3xcomplex<f64>>>, i32) -> !hlfir.expr<?xcomplex<f64>>
@@ -131,6 +133,7 @@ func.func @product_box_unknown_extent2(%arg0: !fir.box<!fir.array<?x3xcomplex<f6
131133
// CHECK: return %[[ELEMENTAL_0]] : !hlfir.expr<?xcomplex<f64>>
132134
// CHECK: }
133135

136+
134137
// expr with unknown extent
135138
func.func @product_expr_unknown_extent1(%arg0: !hlfir.expr<?x3xf32>) -> !hlfir.expr<3xf32> {
136139
%cst = arith.constant 1 : i32
@@ -157,6 +160,7 @@ func.func @product_expr_unknown_extent1(%arg0: !hlfir.expr<?x3xf32>) -> !hlfir.e
157160
// CHECK: return %[[ELEMENTAL_0]] : !hlfir.expr<3xf32>
158161
// CHECK: }
159162

163+
160164
func.func @product_expr_unknown_extent2(%arg0: !hlfir.expr<?x3xf32>) -> !hlfir.expr<?xf32> {
161165
%cst = arith.constant 2 : i32
162166
%res = hlfir.product %arg0 dim %cst : (!hlfir.expr<?x3xf32>, i32) -> !hlfir.expr<?xf32>
@@ -259,6 +263,7 @@ func.func @product_scalar_boxed_mask(%arg0: !hlfir.expr<?x3xf32>, %mask: !fir.bo
259263
// CHECK: return %[[ELEMENTAL_0]] : !hlfir.expr<3xf32>
260264
// CHECK: }
261265

266+
262267
// array mask
263268
func.func @product_array_mask(%arg0: !hlfir.expr<?x3xf32>, %mask: !fir.box<!fir.array<?x3x!fir.logical<1>>>) -> !hlfir.expr<?xf32> {
264269
%cst = arith.constant 2 : i32
@@ -309,6 +314,7 @@ func.func @product_array_mask(%arg0: !hlfir.expr<?x3xf32>, %mask: !fir.box<!fir.
309314
// CHECK: return %[[ELEMENTAL_0]] : !hlfir.expr<?xf32>
310315
// CHECK: }
311316

317+
312318
// array expr mask
313319
func.func @product_array_expr_mask(%arg0: !hlfir.expr<?x3xf32>, %mask: !hlfir.expr<?x3x!fir.logical<1>>) -> !hlfir.expr<?xf32> {
314320
%cst = arith.constant 2 : i32
@@ -368,6 +374,7 @@ func.func @product_unordered_reduction(%arg0: !hlfir.expr<2x3xf32>) -> !hlfir.ex
368374
// CHECK: return %[[ELEMENTAL_0]] : !hlfir.expr<3xf32>
369375
// CHECK: }
370376

377+
371378
// total 1d reduction
372379
func.func @product_total_1d_reduction(%arg0: !fir.box<!fir.array<3xi32>>) -> i32 {
373380
%cst = arith.constant 1 : i32
@@ -378,7 +385,7 @@ func.func @product_total_1d_reduction(%arg0: !fir.box<!fir.array<3xi32>>) -> i32
378385
// CHECK-SAME: %[[ARG0:.*]]: !fir.box<!fir.array<3xi32>>) -> i32 {
379386
// CHECK: %[[CONSTANT_0:.*]] = arith.constant 0 : index
380387
// CHECK: %[[CONSTANT_1:.*]] = arith.constant 3 : index
381-
// CHECK: %[[CONSTANT_2:.*]] = arith.constant 0 : i32
388+
// CHECK: %[[CONSTANT_2:.*]] = arith.constant 1 : i32
382389
// CHECK: %[[CONSTANT_3:.*]] = arith.constant 1 : index
383390
// CHECK: %[[DO_LOOP_0:.*]] = fir.do_loop %[[VAL_0:.*]] = %[[CONSTANT_3]] to %[[CONSTANT_1]] step %[[CONSTANT_3]] unordered iter_args(%[[VAL_1:.*]] = %[[CONSTANT_2]]) -> (i32) {
384391
// CHECK: %[[BOX_DIMS_0:.*]]:3 = fir.box_dims %[[ARG0]], %[[CONSTANT_0]] : (!fir.box<!fir.array<3xi32>>, index) -> (index, index, index)
@@ -400,7 +407,7 @@ func.func @product_total_2d_reduction(%arg0: !fir.box<!fir.array<?x3xi32>>) -> i
400407
// CHECK-LABEL: func.func @product_total_2d_reduction(
401408
// CHECK-SAME: %[[ARG0:.*]]: !fir.box<!fir.array<?x3xi32>>) -> i32 {
402409
// CHECK: %[[CONSTANT_0:.*]] = arith.constant 1 : index
403-
// CHECK: %[[CONSTANT_1:.*]] = arith.constant 0 : i32
410+
// CHECK: %[[CONSTANT_1:.*]] = arith.constant 1 : i32
404411
// CHECK: %[[CONSTANT_2:.*]] = arith.constant 3 : index
405412
// CHECK: %[[CONSTANT_3:.*]] = arith.constant 0 : index
406413
// CHECK: %[[BOX_DIMS_0:.*]]:3 = fir.box_dims %[[ARG0]], %[[CONSTANT_3]] : (!fir.box<!fir.array<?x3xi32>>, index) -> (index, index, index)
@@ -422,6 +429,7 @@ func.func @product_total_2d_reduction(%arg0: !fir.box<!fir.array<?x3xi32>>) -> i
422429
// CHECK: return %[[DO_LOOP_0]] : i32
423430
// CHECK: }
424431

432+
425433
// negative: invalid dim==0
426434
func.func @product_invalid_dim0(%arg0: !hlfir.expr<2x3xi32>) -> !hlfir.expr<3xi32> {
427435
%cst = arith.constant 0 : i32

0 commit comments

Comments
 (0)