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

170 lines
4.2 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; Test removal of AND operations that don't affect last 6 bits of shift amount
; operand.
;
; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z14 | FileCheck %s
; Test that AND is not removed when some lower 6 bits are not set.
define i32 @f1(i32 %a, i32 %sh) {
; CHECK-LABEL: f1:
; CHECK: # %bb.0:
; CHECK-NEXT: nill %r3, 31
; CHECK-NEXT: sll %r2, 0(%r3)
; CHECK-NEXT: br %r14
%and = and i32 %sh, 31
%shift = shl i32 %a, %and
ret i32 %shift
}
; Test removal of AND mask with only bottom 6 bits set.
define i32 @f2(i32 %a, i32 %sh) {
; CHECK-LABEL: f2:
; CHECK: # %bb.0:
; CHECK-NEXT: sll %r2, 0(%r3)
; CHECK-NEXT: br %r14
%and = and i32 %sh, 63
%shift = shl i32 %a, %and
ret i32 %shift
}
; Test removal of AND mask including but not limited to bottom 6 bits.
define i32 @f3(i32 %a, i32 %sh) {
; CHECK-LABEL: f3:
; CHECK: # %bb.0:
; CHECK-NEXT: sll %r2, 0(%r3)
; CHECK-NEXT: br %r14
%and = and i32 %sh, 255
%shift = shl i32 %a, %and
ret i32 %shift
}
; Test removal of AND mask from SRA.
define i32 @f4(i32 %a, i32 %sh) {
; CHECK-LABEL: f4:
; CHECK: # %bb.0:
; CHECK-NEXT: sra %r2, 0(%r3)
; CHECK-NEXT: br %r14
%and = and i32 %sh, 63
%shift = ashr i32 %a, %and
ret i32 %shift
}
; Test removal of AND mask from SRL.
define i32 @f5(i32 %a, i32 %sh) {
; CHECK-LABEL: f5:
; CHECK: # %bb.0:
; CHECK-NEXT: srl %r2, 0(%r3)
; CHECK-NEXT: br %r14
%and = and i32 %sh, 63
%shift = lshr i32 %a, %and
ret i32 %shift
}
; Test removal of AND mask from SLLG.
define i64 @f6(i64 %a, i64 %sh) {
; CHECK-LABEL: f6:
; CHECK: # %bb.0:
; CHECK-NEXT: sllg %r2, %r2, 0(%r3)
; CHECK-NEXT: br %r14
%and = and i64 %sh, 63
%shift = shl i64 %a, %and
ret i64 %shift
}
; Test removal of AND mask from SRAG.
define i64 @f7(i64 %a, i64 %sh) {
; CHECK-LABEL: f7:
; CHECK: # %bb.0:
; CHECK-NEXT: srag %r2, %r2, 0(%r3)
; CHECK-NEXT: br %r14
%and = and i64 %sh, 63
%shift = ashr i64 %a, %and
ret i64 %shift
}
; Test removal of AND mask from SRLG.
define i64 @f8(i64 %a, i64 %sh) {
; CHECK-LABEL: f8:
; CHECK: # %bb.0:
; CHECK-NEXT: srlg %r2, %r2, 0(%r3)
; CHECK-NEXT: br %r14
%and = and i64 %sh, 63
%shift = lshr i64 %a, %and
ret i64 %shift
}
; Test that AND with two register operands is not affected.
define i32 @f9(i32 %a, i32 %b, i32 %sh) {
; CHECK-LABEL: f9:
; CHECK: # %bb.0:
; CHECK-NEXT: nr %r3, %r4
; CHECK-NEXT: sll %r2, 0(%r3)
; CHECK-NEXT: br %r14
%and = and i32 %sh, %b
%shift = shl i32 %a, %and
ret i32 %shift
}
; Test that AND is not entirely removed if the result is reused.
define i32 @f10(i32 %a, i32 %sh) {
; CHECK-LABEL: f10:
; CHECK: # %bb.0:
; CHECK-NEXT: sll %r2, 0(%r3)
; CHECK-NEXT: nilf %r3, 63
; CHECK-NEXT: ar %r2, %r3
; CHECK-NEXT: br %r14
%and = and i32 %sh, 63
%shift = shl i32 %a, %and
%reuse = add i32 %and, %shift
ret i32 %reuse
}
define i128 @f11(i128 %a, i32 %sh) {
; CHECK-LABEL: f11:
; CHECK: # %bb.0:
; CHECK-NEXT: vlvgp %v1, %r4, %r4
; CHECK-NEXT: vl %v0, 0(%r3), 3
; CHECK-NEXT: vrepb %v1, %v1, 15
; CHECK-NEXT: vslb %v0, %v0, %v1
; CHECK-NEXT: vsl %v0, %v0, %v1
; CHECK-NEXT: vst %v0, 0(%r2), 3
; CHECK-NEXT: br %r14
%and = and i32 %sh, 127
%ext = zext i32 %and to i128
%shift = shl i128 %a, %ext
ret i128 %shift
}
define i128 @f12(i128 %a, i32 %sh) {
; CHECK-LABEL: f12:
; CHECK: # %bb.0:
; CHECK-NEXT: vlvgp %v1, %r4, %r4
; CHECK-NEXT: vl %v0, 0(%r3), 3
; CHECK-NEXT: vrepb %v1, %v1, 15
; CHECK-NEXT: vsrlb %v0, %v0, %v1
; CHECK-NEXT: vsrl %v0, %v0, %v1
; CHECK-NEXT: vst %v0, 0(%r2), 3
; CHECK-NEXT: br %r14
%and = and i32 %sh, 127
%ext = zext i32 %and to i128
%shift = lshr i128 %a, %ext
ret i128 %shift
}
define i128 @f13(i128 %a, i32 %sh) {
; CHECK-LABEL: f13:
; CHECK: # %bb.0:
; CHECK-NEXT: vlvgp %v1, %r4, %r4
; CHECK-NEXT: vl %v0, 0(%r3), 3
; CHECK-NEXT: vrepb %v1, %v1, 15
; CHECK-NEXT: vsrab %v0, %v0, %v1
; CHECK-NEXT: vsra %v0, %v0, %v1
; CHECK-NEXT: vst %v0, 0(%r2), 3
; CHECK-NEXT: br %r14
%and = and i32 %sh, 127
%ext = zext i32 %and to i128
%shift = ashr i128 %a, %ext
ret i128 %shift
}