Files
TheRock/compiler/amd-llvm/llvm/test/Transforms/AggressiveInstCombine/trunc_assume.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

71 lines
2.1 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -passes=aggressive-instcombine -S | FileCheck %s
define i16 @trunc_shl(i16 %x, i16 %y) {
; CHECK-LABEL: @trunc_shl(
; CHECK-NEXT: [[CMP0:%.*]] = icmp ult i16 [[Y:%.*]], 16
; CHECK-NEXT: call void @llvm.assume(i1 [[CMP0]])
; CHECK-NEXT: [[I0:%.*]] = shl i16 [[X:%.*]], [[Y]]
; CHECK-NEXT: ret i16 [[I0]]
;
%cmp0 = icmp ult i16 %y, 16
call void @llvm.assume(i1 %cmp0)
%zextx = zext i16 %x to i32
%zexty = zext i16 %y to i32
%i0 = shl i32 %zextx, %zexty
%r = trunc i32 %i0 to i16
ret i16 %r
}
define i16 @trunc_lshr(i16 %x, i16 %y) {
; CHECK-LABEL: @trunc_lshr(
; CHECK-NEXT: [[CMP0:%.*]] = icmp ult i16 [[X:%.*]], 0
; CHECK-NEXT: [[CMP1:%.*]] = icmp ult i16 [[Y:%.*]], 16
; CHECK-NEXT: call void @llvm.assume(i1 [[CMP0]])
; CHECK-NEXT: call void @llvm.assume(i1 [[CMP1]])
; CHECK-NEXT: [[I0:%.*]] = lshr i16 [[X]], [[Y]]
; CHECK-NEXT: ret i16 [[I0]]
;
%cmp0 = icmp ult i16 %x, 65536
%cmp1 = icmp ult i16 %y, 16
call void @llvm.assume(i1 %cmp0)
call void @llvm.assume(i1 %cmp1)
%zextx = zext i16 %x to i32
%zexty = zext i16 %y to i32
%i0 = lshr i32 %zextx, %zexty
%r = trunc i32 %i0 to i16
ret i16 %r
}
define i16 @trunc_ashr(i16 %x, i16 %y) {
; CHECK-LABEL: @trunc_ashr(
; CHECK-NEXT: [[CMP0:%.*]] = icmp slt i16 [[X:%.*]], 32767
; CHECK-NEXT: [[CMP1:%.*]] = icmp sge i16 [[X]], -32768
; CHECK-NEXT: [[CMP2:%.*]] = icmp ult i16 [[Y:%.*]], 16
; CHECK-NEXT: call void @llvm.assume(i1 [[CMP0]])
; CHECK-NEXT: call void @llvm.assume(i1 [[CMP1]])
; CHECK-NEXT: call void @llvm.assume(i1 [[CMP2]])
; CHECK-NEXT: [[I0:%.*]] = ashr i16 [[X]], [[Y]]
; CHECK-NEXT: ret i16 [[I0]]
;
%cmp0 = icmp slt i16 %x, 32767
%cmp1 = icmp sge i16 %x, -32768
%cmp2 = icmp ult i16 %y, 16
call void @llvm.assume(i1 %cmp0)
call void @llvm.assume(i1 %cmp1)
call void @llvm.assume(i1 %cmp2)
%zextx = sext i16 %x to i32
%zexty = sext i16 %y to i32
%i0 = ashr i32 %zextx, %zexty
%r = trunc i32 %i0 to i16
ret i16 %r
}
declare void @llvm.assume(i1)