Files
TheRock/compiler/amd-llvm/llvm/test/CodeGen/Hexagon/undo-dag-shift.ll
T
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

60 lines
1.6 KiB
LLVM

; RUN: llc -mtriple=hexagon < %s | FileCheck %s
; DAG combiner folds sequences of shifts, which can sometimes obscure
; optimization opportunities. For example
;
; unsigned int c(unsigned int b, unsigned int *a) {
; unsigned int bitidx = b >> 5;
; return a[bitidx];
; }
;
; produces
; (add x (shl (srl y 5) 2))
; which is then folded into
; (add x (and (srl y 3) 1FFFFFFC))
;
; That results in a constant-extended and:
; r0 = and(##536870908,lsr(r0,#3))
; r0 = memw(r1+r0<<#0)
; whereas
; r0 = lsr(r0,#5)
; r0 = memw(r1+r0<<#2)
; is more desirable.
target triple = "hexagon"
; CHECK-LABEL: load_0
; CHECK: memw(r{{[0-9]+}}+r{{[0-9]}}<<#2)
define i32 @load_0(i32 %b, ptr nocapture readonly %a) #0 {
entry:
%shr = lshr i32 %b, 5
%arrayidx = getelementptr inbounds i32, ptr %a, i32 %shr
%0 = load i32, ptr %arrayidx, align 4
ret i32 %0
}
; This would require r0<<#3, which is not legal.
; CHECK-LABEL: load_1
; CHECK: memw(r{{[0-9]+}}+r{{[0-9]}}<<#0)
define i32 @load_1(i32 %b, ptr nocapture readonly %a) #0 {
entry:
%shr = lshr i32 %b, 5
%arrayidx = getelementptr inbounds [3 x i32], ptr %a, i32 %shr, i32 0
%0 = load i32, ptr %arrayidx, align 4
ret i32 %0
}
; CHECK-LABEL: store_0
; CHECK: memw(r{{[0-9]+}}+r{{[0-9]}}<<#2)
define void @store_0(i32 %b, ptr nocapture %a, i32 %v) #1 {
entry:
%shr = lshr i32 %b, 5
%arrayidx = getelementptr inbounds i32, ptr %a, i32 %shr
store i32 %v, ptr %arrayidx, align 4
ret void
}
attributes #0 = { norecurse nounwind readonly "target-cpu"="hexagonv60" "target-features"="-hvx,-long-calls" }
attributes #1 = { norecurse nounwind "target-cpu"="hexagonv60" "target-features"="-hvx,-long-calls" }