@@ -126,9 +126,47 @@ func.func @test_array_array_comp_1(%arg0: !fir.ref<!fir.array<100x!fir.type<t_ar
126
126
// CHECK: %[[VAL_9:.*]] = fir.field_index array_comp, !fir.type<t_array{scalar_i:i32,array_comp:!fir.array<10x20xf32>}>
127
127
// CHECK: %[[VAL_10:.*]] = arith.constant 1 : index
128
128
// CHECK: %[[VAL_11:.*]] = arith.constant 1 : index
129
- // CHECK: %[[VAL_12:.*]] = fir.slice %[[VAL_11]], %[[VAL_1]], %[[VAL_10]] path %[[VAL_9]], %[[VAL_7]], %[[VAL_8]] : (index, index, index, !fir.field, index, index) -> !fir.slice<1>
129
+ // CHECK: %[[ANOTHER_ONE:.*]] = arith.constant 1 : index
130
+ // CHECK: %[[VAL_7B:.*]] = arith.subi %[[VAL_7]], %[[ANOTHER_ONE]] : index
131
+ // CHECK: %[[VAL_8B:.*]] = arith.subi %[[VAL_8]], %[[ANOTHER_ONE]] : index
132
+ // CHECK: %[[VAL_12:.*]] = fir.slice %[[VAL_11]], %[[VAL_1]], %[[VAL_10]] path %[[VAL_9]], %[[VAL_7B]], %[[VAL_8B]] : (index, index, index, !fir.field, index, index) -> !fir.slice<1>
130
133
// CHECK: %[[VAL_13:.*]] = fir.embox %[[VAL_3]](%[[VAL_2]]) {{\[}}%[[VAL_12]]] : (!fir.ref<!fir.array<100x!fir.type<t_array{scalar_i:i32,array_comp:!fir.array<10x20xf32>}>>>, !fir.shape<1>, !fir.slice<1>) -> !fir.box<!fir.array<100xf32>>
131
134
135
+
136
+ func.func @test_array_array_comp_1_with_lbs(%arg0: !fir.ref<!fir.array<100x!fir.type<t_array{scalar_i:i32,array_comp:!fir.array<10x20xf32>}>>>) {
137
+ %c100 = arith.constant 100 : index
138
+ %0 = fir.shape %c100 : (index) -> !fir.shape<1>
139
+ %1:2 = hlfir.declare %arg0(%0) {uniq_name = "a"} : (!fir.ref<!fir.array<100x!fir.type<t_array{scalar_i:i32,array_comp:!fir.array<10x20xf32>}>>>, !fir.shape<1>) -> (!fir.ref<!fir.array<100x!fir.type<t_array{scalar_i:i32,array_comp:!fir.array<10x20xf32>}>>>, !fir.ref<!fir.array<100x!fir.type<t_array{scalar_i:i32,array_comp:!fir.array<10x20xf32>}>>>)
140
+ %c10 = arith.constant 10 : index
141
+ %c20 = arith.constant 20 : index
142
+ %c42 = arith.constant 42 : index
143
+ %c43 = arith.constant 43 : index
144
+ %5 = fir.shape_shift %c42, %c10, %c43, %c20 : (index, index, index, index) -> !fir.shapeshift<2>
145
+ %c45 = arith.constant 45 : index
146
+ %c47 = arith.constant 47 : index
147
+ %6 = hlfir.designate %1#0{"array_comp"} <%5> (%c45, %c47) shape %0 : (!fir.ref<!fir.array<100x!fir.type<t_array{scalar_i:i32,array_comp:!fir.array<10x20xf32>}>>>, !fir.shapeshift<2>, index, index, !fir.shape<1>) -> !fir.box<!fir.array<100xf32>>
148
+ return
149
+ }
150
+ // CHECK-LABEL: func.func @test_array_array_comp_1_with_lbs(
151
+ // CHECK: %[[VAL_1:.*]] = arith.constant 100 : index
152
+ // CHECK: %[[VAL_2:.*]] = fir.shape %[[VAL_1]] : (index) -> !fir.shape<1>
153
+ // CHECK: %[[VAL_3:.*]] = fir.declare %{{.*}}(%[[VAL_2]]) {uniq_name = "a"} : (!fir.ref<!fir.array<100x!fir.type<t_array{scalar_i:i32,array_comp:!fir.array<10x20xf32>}>>>, !fir.shape<1>) -> !fir.ref<!fir.array<100x!fir.type<t_array{scalar_i:i32,array_comp:!fir.array<10x20xf32>}>>>
154
+ // CHECK: %[[VAL_4:.*]] = arith.constant 10 : index
155
+ // CHECK: %[[VAL_5:.*]] = arith.constant 20 : index
156
+ // CHECK: %[[VAL_6:.*]] = arith.constant 42 : index
157
+ // CHECK: %[[VAL_7:.*]] = arith.constant 43 : index
158
+ // CHECK: %[[VAL_8:.*]] = fir.shape_shift %[[VAL_6]], %[[VAL_4]], %[[VAL_7]], %[[VAL_5]] : (index, index, index, index) -> !fir.shapeshift<2>
159
+ // CHECK: %[[VAL_9:.*]] = arith.constant 45 : index
160
+ // CHECK: %[[VAL_10:.*]] = arith.constant 47 : index
161
+ // CHECK: %[[VAL_11:.*]] = fir.field_index array_comp, !fir.type<t_array{scalar_i:i32,array_comp:!fir.array<10x20xf32>}>
162
+ // CHECK: %[[VAL_12:.*]] = arith.constant 1 : index
163
+ // CHECK: %[[VAL_13:.*]] = arith.constant 1 : index
164
+ // CHECK: %[[VAL_14:.*]] = arith.subi %[[VAL_9]], %[[VAL_6]] : index
165
+ // CHECK: %[[VAL_15:.*]] = arith.subi %[[VAL_10]], %[[VAL_7]] : index
166
+ // CHECK: %[[VAL_16:.*]] = fir.slice %[[VAL_13]], %[[VAL_1]], %[[VAL_12]] path %[[VAL_11]], %[[VAL_14]], %[[VAL_15]] : (index, index, index, !fir.field, index, index) -> !fir.slice<1>
167
+ // CHECK: %[[VAL_17:.*]] = fir.embox %[[VAL_3]](%[[VAL_2]]) {{\[}}%[[VAL_16]]] : (!fir.ref<!fir.array<100x!fir.type<t_array{scalar_i:i32,array_comp:!fir.array<10x20xf32>}>>>, !fir.shape<1>, !fir.slice<1>) -> !fir.box<!fir.array<100xf32>>
168
+
169
+
132
170
func.func @test_array_comp_slice(%arg0: !fir.ref<!fir.type<t_array{scalar_i:i32,array_comp:!fir.array<10x20xf32>}>>) {
133
171
%0:2 = hlfir.declare %arg0 {uniq_name = "ga"} : (!fir.ref<!fir.type<t_array{scalar_i:i32,array_comp:!fir.array<10x20xf32>}>>) -> (!fir.ref<!fir.type<t_array{scalar_i:i32,array_comp:!fir.array<10x20xf32>}>>, !fir.ref<!fir.type<t_array{scalar_i:i32,array_comp:!fir.array<10x20xf32>}>>)
134
172
%c10 = arith.constant 10 : index
0 commit comments