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

99 lines
2.5 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc --mtriple=loongarch32 -mattr=+32s,+d < %s | FileCheck %s
define i32 @lshr10_and255(i32 %a) {
; CHECK-LABEL: lshr10_and255:
; CHECK: # %bb.0:
; CHECK-NEXT: bstrpick.w $a0, $a0, 17, 10
; CHECK-NEXT: ret
%shr = lshr i32 %a, 10
%and = and i32 %shr, 255
ret i32 %and
}
define i32 @ashr20_and511(i32 %a) {
; CHECK-LABEL: ashr20_and511:
; CHECK: # %bb.0:
; CHECK-NEXT: bstrpick.w $a0, $a0, 28, 20
; CHECK-NEXT: ret
%shr = ashr i32 %a, 20
%and = and i32 %shr, 511
ret i32 %and
}
define i32 @zext_i16_to_i32(i16 %a) {
; CHECK-LABEL: zext_i16_to_i32:
; CHECK: # %bb.0:
; CHECK-NEXT: bstrpick.w $a0, $a0, 15, 0
; CHECK-NEXT: ret
%res = zext i16 %a to i32
ret i32 %res
}
define i32 @and8191(i32 %a) {
; CHECK-LABEL: and8191:
; CHECK: # %bb.0:
; CHECK-NEXT: bstrpick.w $a0, $a0, 12, 0
; CHECK-NEXT: ret
%and = and i32 %a, 8191
ret i32 %and
}
;; Check that andi but not bstrpick.d is generated.
define i32 @and4095(i32 %a) {
; CHECK-LABEL: and4095:
; CHECK: # %bb.0:
; CHECK-NEXT: andi $a0, $a0, 4095
; CHECK-NEXT: ret
%and = and i32 %a, 4095
ret i32 %and
}
;; (srl (and a, 0xff0), 4) => (BSTRPICK a, 11, 4)
define i32 @and0xff0_lshr4(i32 %a) {
; CHECK-LABEL: and0xff0_lshr4:
; CHECK: # %bb.0:
; CHECK-NEXT: bstrpick.w $a0, $a0, 11, 4
; CHECK-NEXT: ret
%and = and i32 %a, 4080
%shr = lshr i32 %and, 4
ret i32 %shr
}
;; (sra (and a, 0xff0), 5) can also be combined to (BSTRPICK a, 11, 5).
;; This is because (sra (and a, 0xff0)) would be combined to (srl (and a, 0xff0), 5)
;; firstly by DAGCombiner::SimplifyDemandedBits.
define i32 @and4080_ashr5(i32 %a) {
; CHECK-LABEL: and4080_ashr5:
; CHECK: # %bb.0:
; CHECK-NEXT: bstrpick.w $a0, $a0, 11, 5
; CHECK-NEXT: ret
%and = and i32 %a, 4080
%shr = ashr i32 %and, 5
ret i32 %shr
}
;; Negative test: the second operand of AND is not a shifted mask
define i32 @and0xf30_lshr4(i32 %a) {
; CHECK-LABEL: and0xf30_lshr4:
; CHECK: # %bb.0:
; CHECK-NEXT: andi $a0, $a0, 3888
; CHECK-NEXT: srli.w $a0, $a0, 4
; CHECK-NEXT: ret
%and = and i32 %a, 3888
%shr = lshr i32 %and, 4
ret i32 %shr
}
;; Negative test: Shamt < MaskIdx
define i32 @and0xff0_lshr3(i32 %a) {
; CHECK-LABEL: and0xff0_lshr3:
; CHECK: # %bb.0:
; CHECK-NEXT: andi $a0, $a0, 4080
; CHECK-NEXT: srli.w $a0, $a0, 3
; CHECK-NEXT: ret
%and = and i32 %a, 4080
%shr = lshr i32 %and, 3
ret i32 %shr
}