| 1 |
// RUN: tco %s | FileCheck %s |
| 2 |
// RUN: %flang_fc1 -emit-llvm %s -o - | FileCheck %s |
| 3 |
|
| 4 |
// CHECK-LABEL: define void @x( |
| 5 |
func.func @x(%arr : !fir.ref<!fir.array<10xf32>>) { |
| 6 |
%1 = arith.constant 0 : index |
| 7 |
%2 = arith.constant 9 : index |
| 8 |
%stepvar = arith.constant 1 : index |
| 9 |
// CHECK: alloca [10 x float], i64 1 |
| 10 |
%a = fir.alloca !fir.array<10xf32> |
| 11 |
fir.do_loop %iv = %1 to %2 step %stepvar unordered { |
| 12 |
%3 = fir.coordinate_of %arr, %iv : (!fir.ref<!fir.array<10xf32>>, index) -> !fir.ref<f32> |
| 13 |
// CHECK: %[[reg10:.*]] = load float, ptr |
| 14 |
%4 = fir.load %3 : !fir.ref<f32> |
| 15 |
// CHECK: %[[reg11:.*]] = getelementptr [10 x float], ptr |
| 16 |
%5 = fir.coordinate_of %a, %iv : (!fir.ref<!fir.array<10xf32>>, index) -> !fir.ref<f32> |
| 17 |
// CHECK: store float %[[reg10]], ptr %[[reg11]] |
| 18 |
fir.store %4 to %5 : !fir.ref<f32> |
| 19 |
} |
| 20 |
%6 = fir.embox %a : (!fir.ref<!fir.array<10xf32>>) -> !fir.box<!fir.array<10xf32>> |
| 21 |
fir.call @y(%6) : (!fir.box<!fir.array<10xf32>>) -> () |
| 22 |
return |
| 23 |
} |
| 24 |
|
| 25 |
func.func private @y(!fir.box<!fir.array<10xf32>>) -> () |