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
63 lines
2.0 KiB
LLVM
63 lines
2.0 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
|
|
; RUN: opt < %s -passes=instcombine -S | FileCheck %s
|
|
|
|
declare void @llvm.assume(i1)
|
|
declare i8 @llvm.ctpop.i8(i8)
|
|
|
|
; https://alive2.llvm.org/ce/z/LV_8xy
|
|
define i8 @and_add_shl(i8 %x) {
|
|
; CHECK-LABEL: define i8 @and_add_shl
|
|
; CHECK-SAME: (i8 [[X:%.*]]) {
|
|
; CHECK-NEXT: [[OP1_P2:%.*]] = icmp ult i8 [[X]], 6
|
|
; CHECK-NEXT: call void @llvm.assume(i1 [[OP1_P2]])
|
|
; CHECK-NEXT: [[NOTMASK:%.*]] = shl nsw i8 -1, [[X]]
|
|
; CHECK-NEXT: [[SUB:%.*]] = and i8 [[NOTMASK]], 32
|
|
; CHECK-NEXT: [[R:%.*]] = xor i8 [[SUB]], 32
|
|
; CHECK-NEXT: ret i8 [[R]]
|
|
;
|
|
%op1_p2 = icmp ule i8 %x, 5
|
|
call void @llvm.assume(i1 %op1_p2)
|
|
%shift = shl i8 1, %x
|
|
%sub = add i8 %shift, -1
|
|
%r = and i8 %sub, 32
|
|
ret i8 %r
|
|
}
|
|
|
|
; https://alive2.llvm.org/ce/z/YNYYdV
|
|
define i8 @and_not_shl(i8 %x) {
|
|
; CHECK-LABEL: define i8 @and_not_shl
|
|
; CHECK-SAME: (i8 [[X:%.*]]) {
|
|
; CHECK-NEXT: [[OP1_P2:%.*]] = icmp ult i8 [[X]], 6
|
|
; CHECK-NEXT: call void @llvm.assume(i1 [[OP1_P2]])
|
|
; CHECK-NEXT: [[SHIFT:%.*]] = shl nsw i8 -1, [[X]]
|
|
; CHECK-NEXT: [[NOT:%.*]] = and i8 [[SHIFT]], 32
|
|
; CHECK-NEXT: [[R:%.*]] = xor i8 [[NOT]], 32
|
|
; CHECK-NEXT: ret i8 [[R]]
|
|
;
|
|
%op1_p2 = icmp ule i8 %x, 5
|
|
call void @llvm.assume(i1 %op1_p2)
|
|
%shift = shl i8 -1, %x
|
|
%not = xor i8 %shift, -1
|
|
%r = and i8 %not, 32
|
|
ret i8 %r
|
|
}
|
|
|
|
; Negative test: https://alive2.llvm.org/ce/z/uWzb4t
|
|
define i8 @and_add_shl_overlap(i8 %x) {
|
|
; CHECK-LABEL: define i8 @and_add_shl_overlap
|
|
; CHECK-SAME: (i8 [[X:%.*]]) {
|
|
; CHECK-NEXT: [[OP1_P2:%.*]] = icmp ult i8 [[X]], 7
|
|
; CHECK-NEXT: call void @llvm.assume(i1 [[OP1_P2]])
|
|
; CHECK-NEXT: [[NOTMASK:%.*]] = shl nsw i8 -1, [[X]]
|
|
; CHECK-NEXT: [[SUB:%.*]] = and i8 [[NOTMASK]], 32
|
|
; CHECK-NEXT: [[R:%.*]] = xor i8 [[SUB]], 32
|
|
; CHECK-NEXT: ret i8 [[R]]
|
|
;
|
|
%op1_p2 = icmp ule i8 %x, 6
|
|
call void @llvm.assume(i1 %op1_p2)
|
|
%shift = shl i8 1, %x
|
|
%sub = add i8 %shift, -1
|
|
%r = and i8 %sub, 32
|
|
ret i8 %r
|
|
}
|