Files
TheRock/compiler/amd-llvm/llvm/test/CodeGen/ARM/sdiv-pow2-arm-size.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

100 lines
2.5 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 6
; RUN: llc -mtriple=armv7a -mattr=+hwdiv-arm %s -o - | FileCheck %s --check-prefixes=CHECK,DIV
; RUN: llc -mtriple=armv7a -mattr=-hwdiv-arm %s -o - | FileCheck %s --check-prefixes=CHECK,NODIV
; Check SREM
define dso_local i32 @test_rem(i32 %F) local_unnamed_addr #0 {
; CHECK-LABEL: test_rem:
; CHECK: @ %bb.0: @ %entry
; CHECK-NEXT: asr r1, r0, #31
; CHECK-NEXT: add r1, r0, r1, lsr #30
; CHECK-NEXT: bic r1, r1, #3
; CHECK-NEXT: sub r0, r0, r1
; CHECK-NEXT: bx lr
entry:
%div = srem i32 %F, 4
ret i32 %div
}
; Try an i16 sdiv, with a small immediate.
define dso_local signext i16 @f0(i16 signext %F) local_unnamed_addr #0 {
; DIV-LABEL: f0:
; DIV: @ %bb.0: @ %entry
; DIV-NEXT: mov r1, #2
; DIV-NEXT: sdiv r0, r0, r1
; DIV-NEXT: sxth r0, r0
; DIV-NEXT: bx lr
;
; NODIV-LABEL: f0:
; NODIV: @ %bb.0: @ %entry
; NODIV-NEXT: uxth r1, r0
; NODIV-NEXT: add r0, r0, r1, lsr #15
; NODIV-NEXT: sxth r0, r0
; NODIV-NEXT: asr r0, r0, #1
; NODIV-NEXT: bx lr
entry:
%0 = sdiv i16 %F, 2
ret i16 %0
}
; Try an i32 sdiv, with a small immediate.
define dso_local i32 @f1(i32 %F) local_unnamed_addr #0 {
; DIV-LABEL: f1:
; DIV: @ %bb.0: @ %entry
; DIV-NEXT: mov r1, #4
; DIV-NEXT: sdiv r0, r0, r1
; DIV-NEXT: bx lr
;
; NODIV-LABEL: f1:
; NODIV: @ %bb.0: @ %entry
; NODIV-NEXT: asr r1, r0, #31
; NODIV-NEXT: add r0, r0, r1, lsr #30
; NODIV-NEXT: asr r0, r0, #2
; NODIV-NEXT: bx lr
entry:
%div = sdiv i32 %F, 4
ret i32 %div
}
; Try a large power of 2 immediate, which should also be materialised with 1
; move immediate instruction.
define dso_local i32 @f2(i32 %F) local_unnamed_addr #0 {
; DIV-LABEL: f2:
; DIV: @ %bb.0: @ %entry
; DIV-NEXT: mov r1, #131072
; DIV-NEXT: sdiv r0, r0, r1
; DIV-NEXT: bx lr
;
; NODIV-LABEL: f2:
; NODIV: @ %bb.0: @ %entry
; NODIV-NEXT: asr r1, r0, #31
; NODIV-NEXT: add r0, r0, r1, lsr #15
; NODIV-NEXT: asr r0, r0, #17
; NODIV-NEXT: bx lr
entry:
%div = sdiv i32 %F, 131072
ret i32 %div
}
; MinSize not set, so should expand to the faster but longer sequence.
define dso_local i32 @f3(i32 %F) {
; CHECK-LABEL: f3:
; CHECK: @ %bb.0: @ %entry
; CHECK-NEXT: asr r1, r0, #31
; CHECK-NEXT: add r0, r0, r1, lsr #30
; CHECK-NEXT: asr r0, r0, #2
; CHECK-NEXT: bx lr
entry:
%div = sdiv i32 %F, 4
ret i32 %div
}
attributes #0 = { minsize norecurse nounwind optsize readnone }