Files
TheRock/compiler/amd-llvm/llvm/test/Transforms/SCCP/range-and-or-bit-masked.ll
T
derek.holloway 7502bf64a4
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
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

89 lines
2.9 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S -passes=ipsccp %s | FileCheck %s
declare void @use(i1)
define i1 @test1(i64 %x) {
; CHECK-LABEL: @test1(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[COND:%.*]] = icmp ugt i64 [[X:%.*]], 65535
; CHECK-NEXT: call void @llvm.assume(i1 [[COND]])
; CHECK-NEXT: [[MASK:%.*]] = and i64 [[X]], -65521
; CHECK-NEXT: ret i1 false
;
entry:
%cond = icmp ugt i64 %x, 65535
call void @llvm.assume(i1 %cond)
%mask = and i64 %x, -65521
%cmp = icmp eq i64 %mask, 0
ret i1 %cmp
}
define void @test.and(i64 %x, i64 %y) {
; CHECK-LABEL: @test.and(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[C0:%.*]] = icmp uge i64 [[X:%.*]], 138
; CHECK-NEXT: [[C1:%.*]] = icmp ule i64 [[X]], 161
; CHECK-NEXT: call void @llvm.assume(i1 [[C0]])
; CHECK-NEXT: call void @llvm.assume(i1 [[C1]])
; CHECK-NEXT: [[C2:%.*]] = icmp uge i64 [[Y:%.*]], 186
; CHECK-NEXT: [[C3:%.*]] = icmp ule i64 [[Y]], 188
; CHECK-NEXT: call void @llvm.assume(i1 [[C2]])
; CHECK-NEXT: call void @llvm.assume(i1 [[C3]])
; CHECK-NEXT: [[AND:%.*]] = and i64 [[X]], [[Y]]
; CHECK-NEXT: call void @use(i1 false)
; CHECK-NEXT: [[R1:%.*]] = icmp ult i64 [[AND]], 137
; CHECK-NEXT: call void @use(i1 [[R1]])
; CHECK-NEXT: ret void
;
entry:
%c0 = icmp uge i64 %x, 138 ; 0b10001010
%c1 = icmp ule i64 %x, 161 ; 0b10100000
call void @llvm.assume(i1 %c0)
call void @llvm.assume(i1 %c1)
%c2 = icmp uge i64 %y, 186 ; 0b10111010
%c3 = icmp ule i64 %y, 188 ; 0b10111110
call void @llvm.assume(i1 %c2)
call void @llvm.assume(i1 %c3)
%and = and i64 %x, %y
%r0 = icmp ult i64 %and, 136 ; 0b10001000
call void @use(i1 %r0) ; false
%r1 = icmp ult i64 %and, 137
call void @use(i1 %r1) ; unknown
ret void
}
define void @test.or(i64 %x, i64 %y) {
; CHECK-LABEL: @test.or(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[C0:%.*]] = icmp ule i64 [[X:%.*]], 117
; CHECK-NEXT: [[C1:%.*]] = icmp uge i64 [[X]], 95
; CHECK-NEXT: call void @llvm.assume(i1 [[C0]])
; CHECK-NEXT: call void @llvm.assume(i1 [[C1]])
; CHECK-NEXT: [[C2:%.*]] = icmp ule i64 [[Y:%.*]], 69
; CHECK-NEXT: [[C3:%.*]] = icmp uge i64 [[Y]], 67
; CHECK-NEXT: call void @llvm.assume(i1 [[C2]])
; CHECK-NEXT: call void @llvm.assume(i1 [[C3]])
; CHECK-NEXT: [[OR:%.*]] = or i64 [[X]], [[Y]]
; CHECK-NEXT: call void @use(i1 false)
; CHECK-NEXT: [[R1:%.*]] = icmp ugt i64 [[OR]], 118
; CHECK-NEXT: call void @use(i1 [[R1]])
; CHECK-NEXT: ret void
;
entry:
%c0 = icmp ule i64 %x, 117 ; 0b01110101
%c1 = icmp uge i64 %x, 95 ; 0b01011111
call void @llvm.assume(i1 %c0)
call void @llvm.assume(i1 %c1)
%c2 = icmp ule i64 %y, 69 ; 0b01000101
%c3 = icmp uge i64 %y, 67 ; 0b01000011
call void @llvm.assume(i1 %c2)
call void @llvm.assume(i1 %c3)
%or = or i64 %x, %y
%r0 = icmp ugt i64 %or, 119 ; 0b01110111
call void @use(i1 %r0) ; false
%r1 = icmp ugt i64 %or, 118
call void @use(i1 %r1) ; unknown
ret void
}