| 1 |
// Test hlfir.get_extent operaiton parse, verify (no errors), and unparse |
| 2 |
// RUN: fir-opt %s | fir-opt | FileCheck %s |
| 3 |
|
| 4 |
func.func @getextent(%arg0: !fir.shape<3>) { |
| 5 |
%0 = hlfir.get_extent %arg0 {dim = 0 : index} : (!fir.shape<3>) -> index |
| 6 |
%1 = hlfir.get_extent %arg0 {dim = 1 : index} : (!fir.shape<3>) -> index |
| 7 |
%2 = hlfir.get_extent %arg0 {dim = 2 : index} : (!fir.shape<3>) -> index |
| 8 |
return |
| 9 |
} |
| 10 |
// CHECK-LABEL: func.func @getextent |
| 11 |
// CHECK: %[[SHAPE:.*]]: !fir.shape<3> |
| 12 |
// CHECK-NEXT: %[[EXT0:.*]] = hlfir.get_extent %[[SHAPE]] {dim = 0 : index} : (!fir.shape<3>) -> index |
| 13 |
// CHECK-NEXT: %[[EXT1:.*]] = hlfir.get_extent %[[SHAPE]] {dim = 1 : index} : (!fir.shape<3>) -> index |
| 14 |
// CHECK-NEXT: %[[EXT2:.*]] = hlfir.get_extent %[[SHAPE]] {dim = 2 : index} : (!fir.shape<3>) -> index |
| 15 |
// CHECK-NEXT: return |
| 16 |
// CHECK-NEXT: } |