Files
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

120 lines
3.5 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -passes=instcombine -S | FileCheck %s
define i8 @shl_add_nuw(i8 %amt_in, i8 %cnt_in) {
; CHECK-LABEL: @shl_add_nuw(
; CHECK-NEXT: [[AMT:%.*]] = and i8 [[AMT_IN:%.*]], 63
; CHECK-NEXT: [[CNT:%.*]] = and i8 [[CNT_IN:%.*]], 2
; CHECK-NEXT: [[R:%.*]] = shl nuw i8 [[AMT]], [[CNT]]
; CHECK-NEXT: ret i8 [[R]]
;
%amt = and i8 %amt_in, 63
%cnt = and i8 %cnt_in, 2
%r = shl i8 %amt, %cnt
ret i8 %r
}
define i8 @shl_add_nuw_fail(i8 %amt_in, i8 %cnt_in) {
; CHECK-LABEL: @shl_add_nuw_fail(
; CHECK-NEXT: [[AMT:%.*]] = and i8 [[AMT_IN:%.*]], 63
; CHECK-NEXT: [[CNT:%.*]] = and i8 [[CNT_IN:%.*]], 3
; CHECK-NEXT: [[R:%.*]] = shl i8 [[AMT]], [[CNT]]
; CHECK-NEXT: ret i8 [[R]]
;
%amt = and i8 %amt_in, 63
%cnt = and i8 %cnt_in, 3
%r = shl i8 %amt, %cnt
ret i8 %r
}
define i8 @shl_add_nuw_and_nsw(i8 %amt_in, i8 %cnt_in) {
; CHECK-LABEL: @shl_add_nuw_and_nsw(
; CHECK-NEXT: [[AMT:%.*]] = and i8 [[AMT_IN:%.*]], 31
; CHECK-NEXT: [[CNT:%.*]] = and i8 [[CNT_IN:%.*]], 2
; CHECK-NEXT: [[R:%.*]] = shl nuw nsw i8 [[AMT]], [[CNT]]
; CHECK-NEXT: ret i8 [[R]]
;
%amt = and i8 %amt_in, 31
%cnt = and i8 %cnt_in, 2
%r = shl i8 %amt, %cnt
ret i8 %r
}
define i8 @shl_add_nsw(i8 %amt_in, i8 %cnt_in) {
; CHECK-LABEL: @shl_add_nsw(
; CHECK-NEXT: [[AMT:%.*]] = or i8 [[AMT_IN:%.*]], -32
; CHECK-NEXT: [[CNT:%.*]] = and i8 [[CNT_IN:%.*]], 2
; CHECK-NEXT: [[R:%.*]] = shl nsw i8 [[AMT]], [[CNT]]
; CHECK-NEXT: ret i8 [[R]]
;
%amt = or i8 %amt_in, 224
%cnt = and i8 %cnt_in, 2
%r = shl i8 %amt, %cnt
ret i8 %r
}
define i8 @shl_add_nsw_fail(i8 %amt_in, i8 %cnt_in) {
; CHECK-LABEL: @shl_add_nsw_fail(
; CHECK-NEXT: [[AMT:%.*]] = or i8 [[AMT_IN:%.*]], -64
; CHECK-NEXT: [[CNT:%.*]] = and i8 [[CNT_IN:%.*]], 2
; CHECK-NEXT: [[R:%.*]] = shl i8 [[AMT]], [[CNT]]
; CHECK-NEXT: ret i8 [[R]]
;
%amt = or i8 %amt_in, 192
%cnt = and i8 %cnt_in, 2
%r = shl i8 %amt, %cnt
ret i8 %r
}
define i8 @lshr_add_exact(i8 %amt_in, i8 %cnt_in) {
; CHECK-LABEL: @lshr_add_exact(
; CHECK-NEXT: [[AMT:%.*]] = and i8 [[AMT_IN:%.*]], -4
; CHECK-NEXT: [[CNT:%.*]] = and i8 [[CNT_IN:%.*]], 2
; CHECK-NEXT: [[R:%.*]] = lshr exact i8 [[AMT]], [[CNT]]
; CHECK-NEXT: ret i8 [[R]]
;
%amt = and i8 %amt_in, -4
%cnt = and i8 %cnt_in, 2
%r = lshr i8 %amt, %cnt
ret i8 %r
}
define i8 @lshr_add_exact_fail(i8 %amt_in, i8 %cnt_in) {
; CHECK-LABEL: @lshr_add_exact_fail(
; CHECK-NEXT: [[AMT:%.*]] = and i8 [[AMT_IN:%.*]], -7
; CHECK-NEXT: [[CNT:%.*]] = and i8 [[CNT_IN:%.*]], 2
; CHECK-NEXT: [[R:%.*]] = lshr i8 [[AMT]], [[CNT]]
; CHECK-NEXT: ret i8 [[R]]
;
%amt = and i8 %amt_in, -7
%cnt = and i8 %cnt_in, 2
%r = lshr i8 %amt, %cnt
ret i8 %r
}
define i8 @ashr_add_exact(i8 %amt_in, i8 %cnt_in) {
; CHECK-LABEL: @ashr_add_exact(
; CHECK-NEXT: [[AMT:%.*]] = and i8 [[AMT_IN:%.*]], -14
; CHECK-NEXT: [[CNT:%.*]] = and i8 [[CNT_IN:%.*]], 1
; CHECK-NEXT: [[R:%.*]] = ashr exact i8 [[AMT]], [[CNT]]
; CHECK-NEXT: ret i8 [[R]]
;
%amt = and i8 %amt_in, -14
%cnt = and i8 %cnt_in, 1
%r = ashr i8 %amt, %cnt
ret i8 %r
}
define i8 @ashr_add_exact_fail(i8 %amt_in, i8 %cnt_in) {
; CHECK-LABEL: @ashr_add_exact_fail(
; CHECK-NEXT: [[AMT:%.*]] = and i8 [[AMT_IN:%.*]], -14
; CHECK-NEXT: [[CNT:%.*]] = and i8 [[CNT_IN:%.*]], 2
; CHECK-NEXT: [[R:%.*]] = ashr i8 [[AMT]], [[CNT]]
; CHECK-NEXT: ret i8 [[R]]
;
%amt = and i8 %amt_in, -14
%cnt = and i8 %cnt_in, 2
%r = ashr i8 %amt, %cnt
ret i8 %r
}