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
70 lines
2.4 KiB
Plaintext
70 lines
2.4 KiB
Plaintext
// Test normalization behavior of fir.do_loop lowering to scf.
|
|
//
|
|
// RUN: fir-opt %s --fir-to-scf --allow-unregistered-dialect | FileCheck %s
|
|
|
|
// Test that loops with unknown step are normalized.
|
|
//
|
|
// e.g.
|
|
// subroutine loop(a,lb,ub,step)
|
|
// integer :: a(8), lb, ub, step
|
|
// do i = lb, ub, step
|
|
// a(i) = i
|
|
// enddo
|
|
// end
|
|
|
|
// CHECK-LABEL: func.func @unknown_step_
|
|
// CHECK: [[LB:%[0-9]+]] = arith.index_cast %arg0
|
|
// CHECK: [[UB:%[0-9]+]] = arith.index_cast %arg1
|
|
// CHECK: [[STEP:%[0-9]+]] = arith.index_cast %arg2
|
|
// CHECK: [[SUB:%[0-9]+]] = arith.subi [[UB]], [[LB]] : index
|
|
// CHECK-NEXT: [[ADD:%[0-9]+]] = arith.addi [[SUB]], [[STEP]] : index
|
|
// CHECK-NEXT: [[DIV:%[0-9]+]] = arith.divsi [[ADD]], [[STEP]] : index
|
|
// CHECK: scf.for %arg4 = %c0{{.*}} to [[DIV]] step %c1{{.*}}
|
|
// CHECK-NEXT: [[IVMUL:%[0-9]+]] = arith.muli %arg4, [[STEP]] : index
|
|
// CHECK-NEXT: [[IVADD:%[0-9]+]] = arith.addi [[LB]], [[IVMUL]] : index
|
|
// CHECK-NEXT: memref.store [[IVADD]], %arg3[]
|
|
|
|
func.func @unknown_step_(%arg0: i64, %arg1: i64, %arg2: i64, %arg3: memref<index>) {
|
|
%0 = arith.index_cast %arg0 : i64 to index
|
|
%1 = arith.index_cast %arg1 : i64 to index
|
|
%2 = arith.index_cast %arg2 : i64 to index
|
|
fir.do_loop %arg4 = %0 to %1 step %2 {
|
|
memref.store %arg4, %arg3[] : memref<index>
|
|
}
|
|
return
|
|
}
|
|
|
|
// Test that loops with known negative step are normalized.
|
|
//
|
|
// e.g.
|
|
// subroutine loop(a)
|
|
// integer :: a(8)
|
|
// do i = 8, 1, -1
|
|
// a(i) = i
|
|
// enddo
|
|
// end
|
|
|
|
// CHECK-LABEL: func.func @negative_step_
|
|
// CHECK: [[LB:%.+]] = arith.constant 8
|
|
// CHECK: [[UB:%.+]] = arith.constant 1
|
|
// CHECK: [[STEP:%.+]] = arith.constant -1
|
|
// CHECK: [[SUB:%[0-9]+]] = arith.subi [[UB]], [[LB]] : index
|
|
// CHECK-NEXT: [[ADD:%[0-9]+]] = arith.addi [[SUB]], [[STEP]] : index
|
|
// CHECK-NEXT: [[DIV:%[0-9]+]] = arith.divsi [[ADD]], [[STEP]] : index
|
|
// CHECK: scf.for %arg1 = %c0{{.*}} to [[DIV]] step %c1{{.*}}
|
|
// CHECK-NEXT: [[IVMUL:%[0-9]+]] = arith.muli %arg1, [[STEP]] : index
|
|
// CHECK-NEXT: [[IVADD:%[0-9]+]] = arith.addi [[LB]], [[IVMUL]] : index
|
|
// CHECK-NEXT: memref.store [[IVADD]], %arg0[]
|
|
|
|
func.func @negative_step_(%arg0: memref<index>) {
|
|
%c8 = arith.constant 8 : index
|
|
%c1 = arith.constant 1 : index
|
|
%c-1 = arith.constant -1 : index
|
|
fir.do_loop %arg1 = %c8 to %c1 step %c-1 {
|
|
memref.store %arg1, %arg0[] : memref<index>
|
|
}
|
|
return
|
|
}
|
|
|
|
|