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
67 lines
2.3 KiB
MLIR
67 lines
2.3 KiB
MLIR
// RUN: mlir-opt -int-range-optimizations -canonicalize %s | FileCheck %s
|
|
|
|
// Most operations are covered by the `arith` tests, which use the same code
|
|
// Here, we add a few tests to ensure the "index can be 32- or 64-bit" handling
|
|
// code is operating as expected.
|
|
|
|
// CHECK-LABEL: func @add_same_for_both
|
|
// CHECK: %[[true:.*]] = index.bool.constant true
|
|
// CHECK: return %[[true]]
|
|
func.func @add_same_for_both(%arg0 : index) -> i1 {
|
|
%c1 = index.constant 1
|
|
%calmostBig = index.constant 0xfffffffe
|
|
%0 = index.minu %arg0, %calmostBig
|
|
%1 = index.add %0, %c1
|
|
%2 = index.cmp uge(%1, %c1)
|
|
func.return %2 : i1
|
|
}
|
|
|
|
// CHECK-LABEL: func @add_unsigned_ov
|
|
// CHECK: %[[uge:.*]] = index.cmp uge
|
|
// CHECK: return %[[uge]]
|
|
func.func @add_unsigned_ov(%arg0 : index) -> i1 {
|
|
%c1 = index.constant 1
|
|
%cu32_max = index.constant 0xffffffff
|
|
%0 = index.minu %arg0, %cu32_max
|
|
%1 = index.add %0, %c1
|
|
// On 32-bit, the add could wrap, so the result doesn't have to be >= 1
|
|
%2 = index.cmp uge(%1, %c1)
|
|
func.return %2 : i1
|
|
}
|
|
|
|
// CHECK-LABEL: func @add_signed_ov
|
|
// CHECK: %[[sge:.*]] = index.cmp sge
|
|
// CHECK: return %[[sge]]
|
|
func.func @add_signed_ov(%arg0 : index) -> i1 {
|
|
%c0 = index.constant 0
|
|
%c1 = index.constant 1
|
|
%ci32_max = index.constant 0x7fffffff
|
|
%0 = index.minu %arg0, %ci32_max
|
|
%1 = index.add %0, %c1
|
|
// On 32-bit, the add could wrap, so the result doesn't have to be positive
|
|
%2 = index.cmp sge(%1, %c0)
|
|
func.return %2 : i1
|
|
}
|
|
|
|
// CHECK-LABEL: func @add_big
|
|
// CHECK: %[[true:.*]] = index.bool.constant true
|
|
// CHECK: return %[[true]]
|
|
func.func @add_big(%arg0 : index) -> i1 {
|
|
%c1 = index.constant 1
|
|
%cmin = index.constant 0x300000000
|
|
%cmax = index.constant 0x30000ffff
|
|
// Note: the order of the clamps matters.
|
|
// If you go max, then min, you infer the ranges [0x300...0, 0xff..ff]
|
|
// and then [0x30...0000, 0x30...ffff]
|
|
// If you switch the order of the below operations, you instead first infer
|
|
// the range [0,0x3...ffff]. Then, the min inference can't constraint
|
|
// this intermediate, since in the 32-bit case we could have, for example
|
|
// trunc(%arg0 = 0x2ffffffff) = 0xffffffff > trunc(0x30000ffff) = 0x0000ffff
|
|
// which means we can't do any inference.
|
|
%0 = index.maxu %arg0, %cmin
|
|
%1 = index.minu %0, %cmax
|
|
%2 = index.add %1, %c1
|
|
%3 = index.cmp uge(%1, %cmin)
|
|
func.return %3 : i1
|
|
}
|