Files
TheRock/compiler/amd-llvm/llvm/test/CodeGen/LoongArch/ir-instruction/ashr.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

168 lines
3.8 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc --mtriple=loongarch32 -mattr=+d < %s | FileCheck %s --check-prefix=LA32
; RUN: llc --mtriple=loongarch64 -mattr=+d < %s | FileCheck %s --check-prefix=LA64
;; Exercise the 'ashr' LLVM IR: https://llvm.org/docs/LangRef.html#ashr-instruction
define i1 @ashr_i1(i1 %x, i1 %y) {
; LA32-LABEL: ashr_i1:
; LA32: # %bb.0:
; LA32-NEXT: ret
;
; LA64-LABEL: ashr_i1:
; LA64: # %bb.0:
; LA64-NEXT: ret
%ashr = ashr i1 %x, %y
ret i1 %ashr
}
define i8 @ashr_i8(i8 %x, i8 %y) {
; LA32-LABEL: ashr_i8:
; LA32: # %bb.0:
; LA32-NEXT: slli.w $a0, $a0, 24
; LA32-NEXT: srai.w $a0, $a0, 24
; LA32-NEXT: sra.w $a0, $a0, $a1
; LA32-NEXT: ret
;
; LA64-LABEL: ashr_i8:
; LA64: # %bb.0:
; LA64-NEXT: ext.w.b $a0, $a0
; LA64-NEXT: sra.d $a0, $a0, $a1
; LA64-NEXT: ret
%ashr = ashr i8 %x, %y
ret i8 %ashr
}
define i16 @ashr_i16(i16 %x, i16 %y) {
; LA32-LABEL: ashr_i16:
; LA32: # %bb.0:
; LA32-NEXT: slli.w $a0, $a0, 16
; LA32-NEXT: srai.w $a0, $a0, 16
; LA32-NEXT: sra.w $a0, $a0, $a1
; LA32-NEXT: ret
;
; LA64-LABEL: ashr_i16:
; LA64: # %bb.0:
; LA64-NEXT: ext.w.h $a0, $a0
; LA64-NEXT: sra.d $a0, $a0, $a1
; LA64-NEXT: ret
%ashr = ashr i16 %x, %y
ret i16 %ashr
}
define i32 @ashr_i32(i32 %x, i32 %y) {
; LA32-LABEL: ashr_i32:
; LA32: # %bb.0:
; LA32-NEXT: sra.w $a0, $a0, $a1
; LA32-NEXT: ret
;
; LA64-LABEL: ashr_i32:
; LA64: # %bb.0:
; LA64-NEXT: sra.w $a0, $a0, $a1
; LA64-NEXT: ret
%ashr = ashr i32 %x, %y
ret i32 %ashr
}
define i64 @ashr_i64(i64 %x, i64 %y) {
; LA32-LABEL: ashr_i64:
; LA32: # %bb.0:
; LA32-NEXT: addi.w $a3, $a2, -32
; LA32-NEXT: bltz $a3, .LBB4_2
; LA32-NEXT: # %bb.1:
; LA32-NEXT: sra.w $a0, $a1, $a3
; LA32-NEXT: srai.w $a1, $a1, 31
; LA32-NEXT: ret
; LA32-NEXT: .LBB4_2:
; LA32-NEXT: srl.w $a0, $a0, $a2
; LA32-NEXT: xori $a3, $a2, 31
; LA32-NEXT: slli.w $a4, $a1, 1
; LA32-NEXT: sll.w $a3, $a4, $a3
; LA32-NEXT: or $a0, $a0, $a3
; LA32-NEXT: sra.w $a1, $a1, $a2
; LA32-NEXT: ret
;
; LA64-LABEL: ashr_i64:
; LA64: # %bb.0:
; LA64-NEXT: sra.d $a0, $a0, $a1
; LA64-NEXT: ret
%ashr = ashr i64 %x, %y
ret i64 %ashr
}
define i1 @ashr_i1_3(i1 %x) {
; LA32-LABEL: ashr_i1_3:
; LA32: # %bb.0:
; LA32-NEXT: ret
;
; LA64-LABEL: ashr_i1_3:
; LA64: # %bb.0:
; LA64-NEXT: ret
%ashr = ashr i1 %x, 3
ret i1 %ashr
}
define i8 @ashr_i8_3(i8 %x) {
; LA32-LABEL: ashr_i8_3:
; LA32: # %bb.0:
; LA32-NEXT: slli.w $a0, $a0, 24
; LA32-NEXT: srai.w $a0, $a0, 27
; LA32-NEXT: ret
;
; LA64-LABEL: ashr_i8_3:
; LA64: # %bb.0:
; LA64-NEXT: ext.w.b $a0, $a0
; LA64-NEXT: srai.d $a0, $a0, 3
; LA64-NEXT: ret
%ashr = ashr i8 %x, 3
ret i8 %ashr
}
define i16 @ashr_i16_3(i16 %x) {
; LA32-LABEL: ashr_i16_3:
; LA32: # %bb.0:
; LA32-NEXT: slli.w $a0, $a0, 16
; LA32-NEXT: srai.w $a0, $a0, 19
; LA32-NEXT: ret
;
; LA64-LABEL: ashr_i16_3:
; LA64: # %bb.0:
; LA64-NEXT: ext.w.h $a0, $a0
; LA64-NEXT: srai.d $a0, $a0, 3
; LA64-NEXT: ret
%ashr = ashr i16 %x, 3
ret i16 %ashr
}
define i32 @ashr_i32_3(i32 %x) {
; LA32-LABEL: ashr_i32_3:
; LA32: # %bb.0:
; LA32-NEXT: srai.w $a0, $a0, 3
; LA32-NEXT: ret
;
; LA64-LABEL: ashr_i32_3:
; LA64: # %bb.0:
; LA64-NEXT: addi.w $a0, $a0, 0
; LA64-NEXT: srai.d $a0, $a0, 3
; LA64-NEXT: ret
%ashr = ashr i32 %x, 3
ret i32 %ashr
}
define i64 @ashr_i64_3(i64 %x) {
; LA32-LABEL: ashr_i64_3:
; LA32: # %bb.0:
; LA32-NEXT: slli.w $a2, $a1, 29
; LA32-NEXT: srli.w $a0, $a0, 3
; LA32-NEXT: or $a0, $a0, $a2
; LA32-NEXT: srai.w $a1, $a1, 3
; LA32-NEXT: ret
;
; LA64-LABEL: ashr_i64_3:
; LA64: # %bb.0:
; LA64-NEXT: srai.d $a0, $a0, 3
; LA64-NEXT: ret
%ashr = ashr i64 %x, 3
ret i64 %ashr
}