Files
TheRock/compiler/amd-llvm/llvm/test/Analysis/ScalarEvolution/trunc-simplify.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

66 lines
2.4 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 5
; RUN: opt < %s -disable-output "-passes=print<scalar-evolution>" 2>&1 | FileCheck %s
; Check that we convert
; trunc(C * a) -> trunc(C) * trunc(a)
; if C is a constant.
define i8 @trunc_of_mul(i32 %a) {
; CHECK-LABEL: 'trunc_of_mul'
; CHECK-NEXT: Classifying expressions for: @trunc_of_mul
; CHECK-NEXT: %b = mul i32 %a, 100
; CHECK-NEXT: --> (100 * %a) U: [0,-3) S: [-2147483648,2147483645)
; CHECK-NEXT: %c = trunc i32 %b to i8
; CHECK-NEXT: --> (100 * (trunc i32 %a to i8)) U: [0,-3) S: [-128,125)
; CHECK-NEXT: Determining loop execution counts for: @trunc_of_mul
;
%b = mul i32 %a, 100
%c = trunc i32 %b to i8
ret i8 %c
}
; Check that we convert
; trunc(C + a) -> trunc(C) + trunc(a)
; if C is a constant.
define i8 @trunc_of_add(i32 %a) {
; CHECK-LABEL: 'trunc_of_add'
; CHECK-NEXT: Classifying expressions for: @trunc_of_add
; CHECK-NEXT: %b = add i32 %a, 100
; CHECK-NEXT: --> (100 + %a) U: full-set S: full-set
; CHECK-NEXT: %c = trunc i32 %b to i8
; CHECK-NEXT: --> (100 + (trunc i32 %a to i8)) U: full-set S: full-set
; CHECK-NEXT: Determining loop execution counts for: @trunc_of_add
;
%b = add i32 %a, 100
%c = trunc i32 %b to i8
ret i8 %c
}
; Check that we truncate to zero values assumed to have at least as many
; trailing zeros as the target type.
define i8 @trunc_to_assumed_zeros(ptr %p) {
; CHECK-LABEL: 'trunc_to_assumed_zeros'
; CHECK-NEXT: Classifying expressions for: @trunc_to_assumed_zeros
; CHECK-NEXT: %a = load i32, ptr %p, align 4
; CHECK-NEXT: --> %a U: [0,-255) S: [-2147483648,2147483393)
; CHECK-NEXT: %and = and i32 %a, 255
; CHECK-NEXT: --> 0 U: [0,1) S: [0,1)
; CHECK-NEXT: %c = trunc i32 %a to i8
; CHECK-NEXT: --> 0 U: [0,1) S: [0,1)
; CHECK-NEXT: %d = trunc i32 %a to i1
; CHECK-NEXT: --> false U: [0,-1) S: [0,-1)
; CHECK-NEXT: %e = trunc i32 %a to i16
; CHECK-NEXT: --> (trunc i32 %a to i16) U: [0,-255) S: [-32768,32513)
; CHECK-NEXT: Determining loop execution counts for: @trunc_to_assumed_zeros
;
%a = load i32, ptr %p
%and = and i32 %a, 255
%cmp = icmp eq i32 %and, 0
tail call void @llvm.assume(i1 %cmp)
%c = trunc i32 %a to i8
%d = trunc i32 %a to i1
%e = trunc i32 %a to i16
ret i8 %c
}
declare void @llvm.assume(i1 noundef) nofree nosync nounwind willreturn