Files
TheRock/compiler/amd-llvm/llvm/test/CodeGen/RISCV/jump-is-expensive.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

92 lines
2.7 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 6
; RUN: llc < %s -mtriple=riscv64 | FileCheck %s --check-prefix=CHEAP
; RUN: llc < %s -mtriple=riscv64 -jump-is-expensive=0 | FileCheck %s --check-prefix=CHEAP
; RUN: llc < %s -mtriple=riscv64 -jump-is-expensive=1 | FileCheck %s --check-prefix=EXPENSIVE
define void @foo(i32 %X, i32 %Y, i32 %Z) nounwind {
; CHEAP-LABEL: foo:
; CHEAP: # %bb.0: # %entry
; CHEAP-NEXT: sext.w a1, a1
; CHEAP-NEXT: li a2, 5
; CHEAP-NEXT: blt a1, a2, .LBB0_3
; CHEAP-NEXT: # %bb.1: # %entry
; CHEAP-NEXT: sext.w a0, a0
; CHEAP-NEXT: beqz a0, .LBB0_3
; CHEAP-NEXT: # %bb.2: # %UnifiedReturnBlock
; CHEAP-NEXT: ret
; CHEAP-NEXT: .LBB0_3: # %cond_true
; CHEAP-NEXT: tail bar
;
; EXPENSIVE-LABEL: foo:
; EXPENSIVE: # %bb.0: # %entry
; EXPENSIVE-NEXT: sext.w a1, a1
; EXPENSIVE-NEXT: sext.w a0, a0
; EXPENSIVE-NEXT: seqz a0, a0
; EXPENSIVE-NEXT: slti a1, a1, 5
; EXPENSIVE-NEXT: or a0, a0, a1
; EXPENSIVE-NEXT: beqz a0, .LBB0_2
; EXPENSIVE-NEXT: # %bb.1: # %cond_true
; EXPENSIVE-NEXT: tail bar
; EXPENSIVE-NEXT: .LBB0_2: # %UnifiedReturnBlock
; EXPENSIVE-NEXT: ret
entry:
%tmp1 = icmp eq i32 %X, 0
%tmp3 = icmp slt i32 %Y, 5
%tmp4 = or i1 %tmp3, %tmp1
br i1 %tmp4, label %cond_true, label %UnifiedReturnBlock
cond_true:
%tmp5 = tail call i32 (...) @bar( )
ret void
UnifiedReturnBlock:
ret void
}
; If the branch is unpredictable, don't add another branch
; regardless of whether they are expensive or not.
define void @unpredictable(i32 %X, i32 %Y, i32 %Z) nounwind {
; CHEAP-LABEL: unpredictable:
; CHEAP: # %bb.0: # %entry
; CHEAP-NEXT: sext.w a1, a1
; CHEAP-NEXT: sext.w a0, a0
; CHEAP-NEXT: seqz a0, a0
; CHEAP-NEXT: slti a1, a1, 5
; CHEAP-NEXT: or a0, a0, a1
; CHEAP-NEXT: beqz a0, .LBB1_2
; CHEAP-NEXT: # %bb.1: # %cond_true
; CHEAP-NEXT: tail bar
; CHEAP-NEXT: .LBB1_2: # %UnifiedReturnBlock
; CHEAP-NEXT: ret
;
; EXPENSIVE-LABEL: unpredictable:
; EXPENSIVE: # %bb.0: # %entry
; EXPENSIVE-NEXT: sext.w a1, a1
; EXPENSIVE-NEXT: sext.w a0, a0
; EXPENSIVE-NEXT: seqz a0, a0
; EXPENSIVE-NEXT: slti a1, a1, 5
; EXPENSIVE-NEXT: or a0, a0, a1
; EXPENSIVE-NEXT: beqz a0, .LBB1_2
; EXPENSIVE-NEXT: # %bb.1: # %cond_true
; EXPENSIVE-NEXT: tail bar
; EXPENSIVE-NEXT: .LBB1_2: # %UnifiedReturnBlock
; EXPENSIVE-NEXT: ret
entry:
%tmp1 = icmp eq i32 %X, 0
%tmp3 = icmp slt i32 %Y, 5
%tmp4 = or i1 %tmp3, %tmp1
br i1 %tmp4, label %cond_true, label %UnifiedReturnBlock, !unpredictable !0
cond_true:
%tmp5 = tail call i32 (...) @bar( )
ret void
UnifiedReturnBlock:
ret void
}
declare i32 @bar(...)
!0 = !{}