CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
48 lines
2.2 KiB
Plaintext
48 lines
2.2 KiB
Plaintext
// Test hlfir.shape_of operation parse, verify (no errors), and unparse
|
|
// RUN: fir-opt %s | fir-opt | FileCheck --check-prefix CHECK --check-prefix CHECK-ALL %s
|
|
|
|
// Test canonicalization
|
|
// RUN: fir-opt %s --canonicalize | FileCheck --check-prefix CHECK-CANON --check-prefix CHECK-ALL %s
|
|
|
|
func.func @shapeof(%arg0: !hlfir.expr<2x2xi32>) -> !fir.shape<2> {
|
|
%shape = hlfir.shape_of %arg0 : (!hlfir.expr<2x2xi32>) -> !fir.shape<2>
|
|
return %shape : !fir.shape<2>
|
|
}
|
|
// CHECK-ALL-LABEL: func.func @shapeof
|
|
// CHECK-ALL: %[[EXPR:.*]]: !hlfir.expr<2x2xi32>
|
|
|
|
// CHECK-NEXT: %[[SHAPE:.*]] = hlfir.shape_of %[[EXPR]] : (!hlfir.expr<2x2xi32>) -> !fir.shape<2>
|
|
|
|
// CHECK-CANON-NEXT: %[[C2:.*]] = arith.constant 2 : index
|
|
// CHECK-CANON-NEXT: %[[SHAPE:.*]] = fir.shape %[[C2]], %[[C2]] : (index, index) -> !fir.shape<2>
|
|
|
|
// CHECK-ALL-NEXT: return %[[SHAPE]]
|
|
|
|
// no canonicalization of expressions with unknown extents
|
|
func.func @shapeof2(%arg0: !hlfir.expr<?x2xi32>) -> !fir.shape<2> {
|
|
%shape = hlfir.shape_of %arg0 : (!hlfir.expr<?x2xi32>) -> !fir.shape<2>
|
|
return %shape : !fir.shape<2>
|
|
}
|
|
// CHECK-ALL-LABEL: func.func @shapeof2
|
|
// CHECK-ALL: %[[EXPR:.*]]: !hlfir.expr<?x2xi32>
|
|
// CHECK-ALL-NEXT: %[[SHAPE:.*]] = hlfir.shape_of %[[EXPR]] : (!hlfir.expr<?x2xi32>) -> !fir.shape<2>
|
|
// CHECK-ALL-NEXT: return %[[SHAPE]]
|
|
|
|
// Checks hlfir.elemental -> hlfir.shape_of folding
|
|
func.func @shapeof_fold1(%extent: index) -> !fir.shape<1> {
|
|
%shape1 = fir.shape %extent : (index) -> !fir.shape<1>
|
|
%elem = hlfir.elemental %shape1 : (!fir.shape<1>) -> !hlfir.expr<?xindex> {
|
|
hlfir.yield_element %extent : index
|
|
}
|
|
%shape2 = hlfir.shape_of %elem : (!hlfir.expr<?xindex>) -> !fir.shape<1>
|
|
return %shape2 : !fir.shape<1>
|
|
}
|
|
// CHECK-ALL-LABEL: func.func @shapeof_fold1(
|
|
// CHECK-ALL-SAME: %[[VAL_0:.*]]: index) -> !fir.shape<1> {
|
|
// CHECK-CANON-NEXT: %[[VAL_1:.*]] = fir.shape %[[VAL_0]] : (index) -> !fir.shape<1>
|
|
// CHECK-CANON-NEXT: %[[VAL_2:.*]] = hlfir.elemental %[[VAL_1]] : (!fir.shape<1>) -> !hlfir.expr<?xindex> {
|
|
// CHECK-CANON-NEXT: hlfir.yield_element %[[VAL_0]] : index
|
|
// CHECK-CANON-NEXT: }
|
|
// CHECK-CANON-NEXT: return %[[VAL_1]] : !fir.shape<1>
|
|
// CHECK-CANON-NEXT: }
|