Files
TheRock/compiler/amd-llvm/llvm/test/CodeGen/AArch64/sdivpow2.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

194 lines
4.8 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple=aarch64-linux-gnu -fast-isel=0 -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,ISEL
; RUN: llc -mtriple=aarch64-linux-gnu -fast-isel=1 -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,FAST
define i32 @test1(i32 %x) {
; ISEL-LABEL: test1:
; ISEL: // %bb.0:
; ISEL-NEXT: add w8, w0, #7
; ISEL-NEXT: cmp w0, #0
; ISEL-NEXT: csel w8, w8, w0, mi
; ISEL-NEXT: asr w0, w8, #3
; ISEL-NEXT: ret
;
; FAST-LABEL: test1:
; FAST: // %bb.0:
; FAST-NEXT: add w8, w0, #7
; FAST-NEXT: cmp w0, #0
; FAST-NEXT: csel w8, w8, w0, lt
; FAST-NEXT: asr w0, w8, #3
; FAST-NEXT: ret
%div = sdiv i32 %x, 8
ret i32 %div
}
define i32 @test2(i32 %x) {
; ISEL-LABEL: test2:
; ISEL: // %bb.0:
; ISEL-NEXT: add w8, w0, #7
; ISEL-NEXT: cmp w0, #0
; ISEL-NEXT: csel w8, w8, w0, mi
; ISEL-NEXT: neg w0, w8, asr #3
; ISEL-NEXT: ret
;
; FAST-LABEL: test2:
; FAST: // %bb.0:
; FAST-NEXT: add w8, w0, #7
; FAST-NEXT: cmp w0, #0
; FAST-NEXT: csel w8, w8, w0, lt
; FAST-NEXT: neg w0, w8, asr #3
; FAST-NEXT: ret
%div = sdiv i32 %x, -8
ret i32 %div
}
define i32 @test3(i32 %x) {
; ISEL-LABEL: test3:
; ISEL: // %bb.0:
; ISEL-NEXT: add w8, w0, #31
; ISEL-NEXT: cmp w0, #0
; ISEL-NEXT: csel w8, w8, w0, mi
; ISEL-NEXT: asr w0, w8, #5
; ISEL-NEXT: ret
;
; FAST-LABEL: test3:
; FAST: // %bb.0:
; FAST-NEXT: add w8, w0, #31
; FAST-NEXT: cmp w0, #0
; FAST-NEXT: csel w8, w8, w0, lt
; FAST-NEXT: asr w0, w8, #5
; FAST-NEXT: ret
%div = sdiv i32 %x, 32
ret i32 %div
}
define i64 @test4(i64 %x) {
; ISEL-LABEL: test4:
; ISEL: // %bb.0:
; ISEL-NEXT: add x8, x0, #7
; ISEL-NEXT: cmp x0, #0
; ISEL-NEXT: csel x8, x8, x0, mi
; ISEL-NEXT: asr x0, x8, #3
; ISEL-NEXT: ret
;
; FAST-LABEL: test4:
; FAST: // %bb.0:
; FAST-NEXT: add x8, x0, #7
; FAST-NEXT: cmp x0, #0
; FAST-NEXT: csel x8, x8, x0, lt
; FAST-NEXT: asr x0, x8, #3
; FAST-NEXT: ret
%div = sdiv i64 %x, 8
ret i64 %div
}
define i64 @test5(i64 %x) {
; ISEL-LABEL: test5:
; ISEL: // %bb.0:
; ISEL-NEXT: add x8, x0, #7
; ISEL-NEXT: cmp x0, #0
; ISEL-NEXT: csel x8, x8, x0, mi
; ISEL-NEXT: neg x0, x8, asr #3
; ISEL-NEXT: ret
;
; FAST-LABEL: test5:
; FAST: // %bb.0:
; FAST-NEXT: add x8, x0, #7
; FAST-NEXT: cmp x0, #0
; FAST-NEXT: csel x8, x8, x0, lt
; FAST-NEXT: neg x0, x8, asr #3
; FAST-NEXT: ret
%div = sdiv i64 %x, -8
ret i64 %div
}
define i64 @test6(i64 %x) {
; ISEL-LABEL: test6:
; ISEL: // %bb.0:
; ISEL-NEXT: add x8, x0, #63
; ISEL-NEXT: cmp x0, #0
; ISEL-NEXT: csel x8, x8, x0, mi
; ISEL-NEXT: asr x0, x8, #6
; ISEL-NEXT: ret
;
; FAST-LABEL: test6:
; FAST: // %bb.0:
; FAST-NEXT: add x8, x0, #63
; FAST-NEXT: cmp x0, #0
; FAST-NEXT: csel x8, x8, x0, lt
; FAST-NEXT: asr x0, x8, #6
; FAST-NEXT: ret
%div = sdiv i64 %x, 64
ret i64 %div
}
define i64 @test7(i64 %x) {
; ISEL-LABEL: test7:
; ISEL: // %bb.0:
; ISEL-NEXT: mov x8, #281474976710655 // =0xffffffffffff
; ISEL-NEXT: cmp x0, #0
; ISEL-NEXT: add x8, x0, x8
; ISEL-NEXT: csel x8, x8, x0, mi
; ISEL-NEXT: asr x0, x8, #48
; ISEL-NEXT: ret
;
; FAST-LABEL: test7:
; FAST: // %bb.0:
; FAST-NEXT: mov x8, #281474976710655 // =0xffffffffffff
; FAST-NEXT: cmp x0, #0
; FAST-NEXT: add x8, x0, x8
; FAST-NEXT: csel x8, x8, x0, lt
; FAST-NEXT: asr x0, x8, #48
; FAST-NEXT: ret
%div = sdiv i64 %x, 281474976710656
ret i64 %div
}
define i64 @test8(i64 %x) {
; ISEL-LABEL: test8:
; ISEL: // %bb.0:
; ISEL-NEXT: add x8, x0, x0, lsr #63
; ISEL-NEXT: asr x0, x8, #1
; ISEL-NEXT: ret
;
; FAST-LABEL: test8:
; FAST: // %bb.0:
; FAST-NEXT: add x8, x0, #1
; FAST-NEXT: cmp x0, #0
; FAST-NEXT: csel x8, x8, x0, lt
; FAST-NEXT: asr x0, x8, #1
; FAST-NEXT: ret
%div = sdiv i64 %x, 2
ret i64 %div
}
define i32 @sdiv_int(i32 %begin, i32 %first) #0 {
; ISEL-LABEL: sdiv_int:
; ISEL: // %bb.0:
; ISEL-NEXT: sub w8, w0, w1
; ISEL-NEXT: add w8, w8, #1
; ISEL-NEXT: add w8, w8, w8, lsr #31
; ISEL-NEXT: sub w0, w0, w8, asr #1
; ISEL-NEXT: ret
;
; FAST-LABEL: sdiv_int:
; FAST: // %bb.0:
; FAST-NEXT: add w8, w0, #1
; FAST-NEXT: sub w8, w8, w1
; FAST-NEXT: add w9, w8, #1
; FAST-NEXT: cmp w8, #0
; FAST-NEXT: csel w8, w9, w8, lt
; FAST-NEXT: neg w8, w8, asr #1
; FAST-NEXT: add w0, w8, w0
; FAST-NEXT: ret
%sub = add i32 %begin, 1
%add = sub i32 %sub, %first
%div.neg = sdiv i32 %add, -2
%sub1 = add i32 %div.neg, %begin
ret i32 %sub1
}
attributes #0 = { "target-features"="+sve" vscale_range(2,2) }
;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
; CHECK: {{.*}}