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

81 lines
3.1 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 3
; RUN: opt < %s -passes=instcombine -S | FileCheck %s
define i8 @flip_add_of_shift_neg(i8 %v, i8 %sh, i8 %x) {
; CHECK-LABEL: define i8 @flip_add_of_shift_neg
; CHECK-SAME: (i8 [[V:%.*]], i8 [[SH:%.*]], i8 [[X:%.*]]) {
; CHECK-NEXT: [[TMP1:%.*]] = shl i8 [[V]], [[SH]]
; CHECK-NEXT: [[R:%.*]] = sub i8 [[X]], [[TMP1]]
; CHECK-NEXT: ret i8 [[R]]
;
%nv = sub i8 0, %v
%sv = shl nuw nsw i8 %nv, %sh
%r = add i8 %sv, %x
ret i8 %r
}
define <2 x i8> @flip_add_of_shift_neg_vec(<2 x i8> %v, <2 x i8> %sh, <2 x i8> %xx) {
; CHECK-LABEL: define <2 x i8> @flip_add_of_shift_neg_vec
; CHECK-SAME: (<2 x i8> [[V:%.*]], <2 x i8> [[SH:%.*]], <2 x i8> [[XX:%.*]]) {
; CHECK-NEXT: [[X:%.*]] = mul <2 x i8> [[XX]], [[XX]]
; CHECK-NEXT: [[TMP1:%.*]] = shl <2 x i8> [[V]], [[SH]]
; CHECK-NEXT: [[R:%.*]] = sub <2 x i8> [[X]], [[TMP1]]
; CHECK-NEXT: ret <2 x i8> [[R]]
;
%x = mul <2 x i8> %xx, %xx
%nv = sub <2 x i8> zeroinitializer, %v
%sv = shl <2 x i8> %nv, %sh
%r = add <2 x i8> %x, %sv
ret <2 x i8> %r
}
define i8 @flip_add_of_shift_neg_fail_shr(i8 %v, i8 %sh, i8 %x) {
; CHECK-LABEL: define i8 @flip_add_of_shift_neg_fail_shr
; CHECK-SAME: (i8 [[V:%.*]], i8 [[SH:%.*]], i8 [[X:%.*]]) {
; CHECK-NEXT: [[NV:%.*]] = sub i8 0, [[V]]
; CHECK-NEXT: [[SV:%.*]] = lshr i8 [[NV]], [[SH]]
; CHECK-NEXT: [[R:%.*]] = add i8 [[SV]], [[X]]
; CHECK-NEXT: ret i8 [[R]]
;
%nv = sub i8 0, %v
%sv = lshr i8 %nv, %sh
%r = add i8 %sv, %x
ret i8 %r
}
declare void @use.v2i8(<2 x i8>)
define <2 x i8> @flip_add_of_shift_neg_vec_fail_multiuse_neg(<2 x i8> %v, <2 x i8> %sh, <2 x i8> %xx) {
; CHECK-LABEL: define <2 x i8> @flip_add_of_shift_neg_vec_fail_multiuse_neg
; CHECK-SAME: (<2 x i8> [[V:%.*]], <2 x i8> [[SH:%.*]], <2 x i8> [[XX:%.*]]) {
; CHECK-NEXT: [[X:%.*]] = mul <2 x i8> [[XX]], [[XX]]
; CHECK-NEXT: [[NV:%.*]] = sub <2 x i8> zeroinitializer, [[V]]
; CHECK-NEXT: [[SV:%.*]] = shl <2 x i8> [[NV]], [[SH]]
; CHECK-NEXT: call void @use.v2i8(<2 x i8> [[NV]])
; CHECK-NEXT: [[R:%.*]] = add <2 x i8> [[X]], [[SV]]
; CHECK-NEXT: ret <2 x i8> [[R]]
;
%x = mul <2 x i8> %xx, %xx
%nv = sub <2 x i8> zeroinitializer, %v
%sv = shl <2 x i8> %nv, %sh
call void @use.v2i8(<2 x i8> %nv)
%r = add <2 x i8> %x, %sv
ret <2 x i8> %r
}
define <2 x i8> @flip_add_of_shift_neg_vec_fail_multiuse_shift(<2 x i8> %v, <2 x i8> %sh, <2 x i8> %xx) {
; CHECK-LABEL: define <2 x i8> @flip_add_of_shift_neg_vec_fail_multiuse_shift
; CHECK-SAME: (<2 x i8> [[V:%.*]], <2 x i8> [[SH:%.*]], <2 x i8> [[XX:%.*]]) {
; CHECK-NEXT: [[X:%.*]] = mul <2 x i8> [[XX]], [[XX]]
; CHECK-NEXT: [[NV:%.*]] = sub <2 x i8> zeroinitializer, [[V]]
; CHECK-NEXT: [[SV:%.*]] = shl <2 x i8> [[NV]], [[SH]]
; CHECK-NEXT: call void @use.v2i8(<2 x i8> [[SV]])
; CHECK-NEXT: [[R:%.*]] = add <2 x i8> [[X]], [[SV]]
; CHECK-NEXT: ret <2 x i8> [[R]]
;
%x = mul <2 x i8> %xx, %xx
%nv = sub <2 x i8> zeroinitializer, %v
%sv = shl <2 x i8> %nv, %sh
call void @use.v2i8(<2 x i8> %sv)
%r = add <2 x i8> %x, %sv
ret <2 x i8> %r
}