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
302 lines
9.2 KiB
LLVM
302 lines
9.2 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
|
; RUN: llc -mtriple=riscv64 -mattr=+zfhmin -verify-machineinstrs \
|
|
; RUN: -target-abi lp64f < %s | FileCheck %s -check-prefix=RV64IZFHMIN
|
|
; RUN: llc -mtriple=riscv64 -mattr=+zhinxmin -verify-machineinstrs \
|
|
; RUN: -target-abi lp64 < %s | FileCheck %s -check-prefix=RV64IZHINXMIN
|
|
|
|
; This file exhaustively checks half<->i32 conversions.
|
|
|
|
define i32 @aext_fptosi(half %a) nounwind {
|
|
; RV64IZFHMIN-LABEL: aext_fptosi:
|
|
; RV64IZFHMIN: # %bb.0:
|
|
; RV64IZFHMIN-NEXT: fcvt.s.h fa5, fa0
|
|
; RV64IZFHMIN-NEXT: fcvt.w.s a0, fa5, rtz
|
|
; RV64IZFHMIN-NEXT: ret
|
|
;
|
|
; RV64IZHINXMIN-LABEL: aext_fptosi:
|
|
; RV64IZHINXMIN: # %bb.0:
|
|
; RV64IZHINXMIN-NEXT: fcvt.s.h a0, a0
|
|
; RV64IZHINXMIN-NEXT: fcvt.w.s a0, a0, rtz
|
|
; RV64IZHINXMIN-NEXT: ret
|
|
%1 = fptosi half %a to i32
|
|
ret i32 %1
|
|
}
|
|
|
|
define signext i32 @sext_fptosi(half %a) nounwind {
|
|
; RV64IZFHMIN-LABEL: sext_fptosi:
|
|
; RV64IZFHMIN: # %bb.0:
|
|
; RV64IZFHMIN-NEXT: fcvt.s.h fa5, fa0
|
|
; RV64IZFHMIN-NEXT: fcvt.w.s a0, fa5, rtz
|
|
; RV64IZFHMIN-NEXT: ret
|
|
;
|
|
; RV64IZHINXMIN-LABEL: sext_fptosi:
|
|
; RV64IZHINXMIN: # %bb.0:
|
|
; RV64IZHINXMIN-NEXT: fcvt.s.h a0, a0
|
|
; RV64IZHINXMIN-NEXT: fcvt.w.s a0, a0, rtz
|
|
; RV64IZHINXMIN-NEXT: ret
|
|
%1 = fptosi half %a to i32
|
|
ret i32 %1
|
|
}
|
|
|
|
define zeroext i32 @zext_fptosi(half %a) nounwind {
|
|
; RV64IZFHMIN-LABEL: zext_fptosi:
|
|
; RV64IZFHMIN: # %bb.0:
|
|
; RV64IZFHMIN-NEXT: fcvt.s.h fa5, fa0
|
|
; RV64IZFHMIN-NEXT: fcvt.w.s a0, fa5, rtz
|
|
; RV64IZFHMIN-NEXT: slli a0, a0, 32
|
|
; RV64IZFHMIN-NEXT: srli a0, a0, 32
|
|
; RV64IZFHMIN-NEXT: ret
|
|
;
|
|
; RV64IZHINXMIN-LABEL: zext_fptosi:
|
|
; RV64IZHINXMIN: # %bb.0:
|
|
; RV64IZHINXMIN-NEXT: fcvt.s.h a0, a0
|
|
; RV64IZHINXMIN-NEXT: fcvt.w.s a0, a0, rtz
|
|
; RV64IZHINXMIN-NEXT: slli a0, a0, 32
|
|
; RV64IZHINXMIN-NEXT: srli a0, a0, 32
|
|
; RV64IZHINXMIN-NEXT: ret
|
|
%1 = fptosi half %a to i32
|
|
ret i32 %1
|
|
}
|
|
|
|
define i32 @aext_fptoui(half %a) nounwind {
|
|
; RV64IZFHMIN-LABEL: aext_fptoui:
|
|
; RV64IZFHMIN: # %bb.0:
|
|
; RV64IZFHMIN-NEXT: fcvt.s.h fa5, fa0
|
|
; RV64IZFHMIN-NEXT: fcvt.wu.s a0, fa5, rtz
|
|
; RV64IZFHMIN-NEXT: ret
|
|
;
|
|
; RV64IZHINXMIN-LABEL: aext_fptoui:
|
|
; RV64IZHINXMIN: # %bb.0:
|
|
; RV64IZHINXMIN-NEXT: fcvt.s.h a0, a0
|
|
; RV64IZHINXMIN-NEXT: fcvt.wu.s a0, a0, rtz
|
|
; RV64IZHINXMIN-NEXT: ret
|
|
%1 = fptoui half %a to i32
|
|
ret i32 %1
|
|
}
|
|
|
|
define signext i32 @sext_fptoui(half %a) nounwind {
|
|
; RV64IZFHMIN-LABEL: sext_fptoui:
|
|
; RV64IZFHMIN: # %bb.0:
|
|
; RV64IZFHMIN-NEXT: fcvt.s.h fa5, fa0
|
|
; RV64IZFHMIN-NEXT: fcvt.wu.s a0, fa5, rtz
|
|
; RV64IZFHMIN-NEXT: ret
|
|
;
|
|
; RV64IZHINXMIN-LABEL: sext_fptoui:
|
|
; RV64IZHINXMIN: # %bb.0:
|
|
; RV64IZHINXMIN-NEXT: fcvt.s.h a0, a0
|
|
; RV64IZHINXMIN-NEXT: fcvt.wu.s a0, a0, rtz
|
|
; RV64IZHINXMIN-NEXT: ret
|
|
%1 = fptoui half %a to i32
|
|
ret i32 %1
|
|
}
|
|
|
|
define zeroext i32 @zext_fptoui(half %a) nounwind {
|
|
; RV64IZFHMIN-LABEL: zext_fptoui:
|
|
; RV64IZFHMIN: # %bb.0:
|
|
; RV64IZFHMIN-NEXT: fcvt.s.h fa5, fa0
|
|
; RV64IZFHMIN-NEXT: fcvt.lu.s a0, fa5, rtz
|
|
; RV64IZFHMIN-NEXT: ret
|
|
;
|
|
; RV64IZHINXMIN-LABEL: zext_fptoui:
|
|
; RV64IZHINXMIN: # %bb.0:
|
|
; RV64IZHINXMIN-NEXT: fcvt.s.h a0, a0
|
|
; RV64IZHINXMIN-NEXT: fcvt.lu.s a0, a0, rtz
|
|
; RV64IZHINXMIN-NEXT: ret
|
|
%1 = fptoui half %a to i32
|
|
ret i32 %1
|
|
}
|
|
|
|
define i16 @bcvt_f16_to_aext_i16(half %a, half %b) nounwind {
|
|
; RV64IZFHMIN-LABEL: bcvt_f16_to_aext_i16:
|
|
; RV64IZFHMIN: # %bb.0:
|
|
; RV64IZFHMIN-NEXT: fcvt.s.h fa5, fa1
|
|
; RV64IZFHMIN-NEXT: fcvt.s.h fa4, fa0
|
|
; RV64IZFHMIN-NEXT: fadd.s fa5, fa4, fa5
|
|
; RV64IZFHMIN-NEXT: fcvt.h.s fa5, fa5
|
|
; RV64IZFHMIN-NEXT: fmv.x.h a0, fa5
|
|
; RV64IZFHMIN-NEXT: ret
|
|
;
|
|
; RV64IZHINXMIN-LABEL: bcvt_f16_to_aext_i16:
|
|
; RV64IZHINXMIN: # %bb.0:
|
|
; RV64IZHINXMIN-NEXT: fcvt.s.h a1, a1
|
|
; RV64IZHINXMIN-NEXT: fcvt.s.h a0, a0
|
|
; RV64IZHINXMIN-NEXT: fadd.s a0, a0, a1
|
|
; RV64IZHINXMIN-NEXT: fcvt.h.s a0, a0
|
|
; RV64IZHINXMIN-NEXT: ret
|
|
%1 = fadd half %a, %b
|
|
%2 = bitcast half %1 to i16
|
|
ret i16 %2
|
|
}
|
|
|
|
define signext i16 @bcvt_f16_to_sext_i16(half %a, half %b) nounwind {
|
|
; RV64IZFHMIN-LABEL: bcvt_f16_to_sext_i16:
|
|
; RV64IZFHMIN: # %bb.0:
|
|
; RV64IZFHMIN-NEXT: fcvt.s.h fa5, fa1
|
|
; RV64IZFHMIN-NEXT: fcvt.s.h fa4, fa0
|
|
; RV64IZFHMIN-NEXT: fadd.s fa5, fa4, fa5
|
|
; RV64IZFHMIN-NEXT: fcvt.h.s fa5, fa5
|
|
; RV64IZFHMIN-NEXT: fmv.x.h a0, fa5
|
|
; RV64IZFHMIN-NEXT: ret
|
|
;
|
|
; RV64IZHINXMIN-LABEL: bcvt_f16_to_sext_i16:
|
|
; RV64IZHINXMIN: # %bb.0:
|
|
; RV64IZHINXMIN-NEXT: fcvt.s.h a1, a1
|
|
; RV64IZHINXMIN-NEXT: fcvt.s.h a0, a0
|
|
; RV64IZHINXMIN-NEXT: fadd.s a0, a0, a1
|
|
; RV64IZHINXMIN-NEXT: fcvt.h.s a0, a0
|
|
; RV64IZHINXMIN-NEXT: slli a0, a0, 48
|
|
; RV64IZHINXMIN-NEXT: srai a0, a0, 48
|
|
; RV64IZHINXMIN-NEXT: ret
|
|
%1 = fadd half %a, %b
|
|
%2 = bitcast half %1 to i16
|
|
ret i16 %2
|
|
}
|
|
|
|
define zeroext i16 @bcvt_f16_to_zext_i16(half %a, half %b) nounwind {
|
|
; RV64IZFHMIN-LABEL: bcvt_f16_to_zext_i16:
|
|
; RV64IZFHMIN: # %bb.0:
|
|
; RV64IZFHMIN-NEXT: fcvt.s.h fa5, fa1
|
|
; RV64IZFHMIN-NEXT: fcvt.s.h fa4, fa0
|
|
; RV64IZFHMIN-NEXT: fadd.s fa5, fa4, fa5
|
|
; RV64IZFHMIN-NEXT: fcvt.h.s fa5, fa5
|
|
; RV64IZFHMIN-NEXT: fmv.x.h a0, fa5
|
|
; RV64IZFHMIN-NEXT: slli a0, a0, 48
|
|
; RV64IZFHMIN-NEXT: srli a0, a0, 48
|
|
; RV64IZFHMIN-NEXT: ret
|
|
;
|
|
; RV64IZHINXMIN-LABEL: bcvt_f16_to_zext_i16:
|
|
; RV64IZHINXMIN: # %bb.0:
|
|
; RV64IZHINXMIN-NEXT: fcvt.s.h a1, a1
|
|
; RV64IZHINXMIN-NEXT: fcvt.s.h a0, a0
|
|
; RV64IZHINXMIN-NEXT: fadd.s a0, a0, a1
|
|
; RV64IZHINXMIN-NEXT: fcvt.h.s a0, a0
|
|
; RV64IZHINXMIN-NEXT: slli a0, a0, 48
|
|
; RV64IZHINXMIN-NEXT: srli a0, a0, 48
|
|
; RV64IZHINXMIN-NEXT: ret
|
|
%1 = fadd half %a, %b
|
|
%2 = bitcast half %1 to i16
|
|
ret i16 %2
|
|
}
|
|
|
|
define half @bcvt_i64_to_f16_via_i16(i64 %a, i64 %b) nounwind {
|
|
; RV64IZFHMIN-LABEL: bcvt_i64_to_f16_via_i16:
|
|
; RV64IZFHMIN: # %bb.0:
|
|
; RV64IZFHMIN-NEXT: fmv.h.x fa5, a0
|
|
; RV64IZFHMIN-NEXT: fmv.h.x fa4, a1
|
|
; RV64IZFHMIN-NEXT: fcvt.s.h fa4, fa4
|
|
; RV64IZFHMIN-NEXT: fcvt.s.h fa5, fa5
|
|
; RV64IZFHMIN-NEXT: fadd.s fa5, fa5, fa4
|
|
; RV64IZFHMIN-NEXT: fcvt.h.s fa0, fa5
|
|
; RV64IZFHMIN-NEXT: ret
|
|
;
|
|
; RV64IZHINXMIN-LABEL: bcvt_i64_to_f16_via_i16:
|
|
; RV64IZHINXMIN: # %bb.0:
|
|
; RV64IZHINXMIN-NEXT: fcvt.s.h a1, a1
|
|
; RV64IZHINXMIN-NEXT: fcvt.s.h a0, a0
|
|
; RV64IZHINXMIN-NEXT: fadd.s a0, a0, a1
|
|
; RV64IZHINXMIN-NEXT: fcvt.h.s a0, a0
|
|
; RV64IZHINXMIN-NEXT: ret
|
|
%1 = trunc i64 %a to i16
|
|
%2 = trunc i64 %b to i16
|
|
%3 = bitcast i16 %1 to half
|
|
%4 = bitcast i16 %2 to half
|
|
%5 = fadd half %3, %4
|
|
ret half %5
|
|
}
|
|
|
|
define half @uitofp_aext_i32_to_f16(i32 %a) nounwind {
|
|
; RV64IZFHMIN-LABEL: uitofp_aext_i32_to_f16:
|
|
; RV64IZFHMIN: # %bb.0:
|
|
; RV64IZFHMIN-NEXT: fcvt.s.wu fa5, a0
|
|
; RV64IZFHMIN-NEXT: fcvt.h.s fa0, fa5
|
|
; RV64IZFHMIN-NEXT: ret
|
|
;
|
|
; RV64IZHINXMIN-LABEL: uitofp_aext_i32_to_f16:
|
|
; RV64IZHINXMIN: # %bb.0:
|
|
; RV64IZHINXMIN-NEXT: fcvt.s.wu a0, a0
|
|
; RV64IZHINXMIN-NEXT: fcvt.h.s a0, a0
|
|
; RV64IZHINXMIN-NEXT: ret
|
|
%1 = uitofp i32 %a to half
|
|
ret half %1
|
|
}
|
|
|
|
define half @uitofp_sext_i32_to_f16(i32 signext %a) nounwind {
|
|
; RV64IZFHMIN-LABEL: uitofp_sext_i32_to_f16:
|
|
; RV64IZFHMIN: # %bb.0:
|
|
; RV64IZFHMIN-NEXT: fcvt.s.wu fa5, a0
|
|
; RV64IZFHMIN-NEXT: fcvt.h.s fa0, fa5
|
|
; RV64IZFHMIN-NEXT: ret
|
|
;
|
|
; RV64IZHINXMIN-LABEL: uitofp_sext_i32_to_f16:
|
|
; RV64IZHINXMIN: # %bb.0:
|
|
; RV64IZHINXMIN-NEXT: fcvt.s.wu a0, a0
|
|
; RV64IZHINXMIN-NEXT: fcvt.h.s a0, a0
|
|
; RV64IZHINXMIN-NEXT: ret
|
|
%1 = uitofp i32 %a to half
|
|
ret half %1
|
|
}
|
|
|
|
define half @uitofp_zext_i32_to_f16(i32 zeroext %a) nounwind {
|
|
; RV64IZFHMIN-LABEL: uitofp_zext_i32_to_f16:
|
|
; RV64IZFHMIN: # %bb.0:
|
|
; RV64IZFHMIN-NEXT: fcvt.s.wu fa5, a0
|
|
; RV64IZFHMIN-NEXT: fcvt.h.s fa0, fa5
|
|
; RV64IZFHMIN-NEXT: ret
|
|
;
|
|
; RV64IZHINXMIN-LABEL: uitofp_zext_i32_to_f16:
|
|
; RV64IZHINXMIN: # %bb.0:
|
|
; RV64IZHINXMIN-NEXT: fcvt.s.wu a0, a0
|
|
; RV64IZHINXMIN-NEXT: fcvt.h.s a0, a0
|
|
; RV64IZHINXMIN-NEXT: ret
|
|
%1 = uitofp i32 %a to half
|
|
ret half %1
|
|
}
|
|
|
|
define half @sitofp_aext_i32_to_f16(i32 %a) nounwind {
|
|
; RV64IZFHMIN-LABEL: sitofp_aext_i32_to_f16:
|
|
; RV64IZFHMIN: # %bb.0:
|
|
; RV64IZFHMIN-NEXT: fcvt.s.w fa5, a0
|
|
; RV64IZFHMIN-NEXT: fcvt.h.s fa0, fa5
|
|
; RV64IZFHMIN-NEXT: ret
|
|
;
|
|
; RV64IZHINXMIN-LABEL: sitofp_aext_i32_to_f16:
|
|
; RV64IZHINXMIN: # %bb.0:
|
|
; RV64IZHINXMIN-NEXT: fcvt.s.w a0, a0
|
|
; RV64IZHINXMIN-NEXT: fcvt.h.s a0, a0
|
|
; RV64IZHINXMIN-NEXT: ret
|
|
%1 = sitofp i32 %a to half
|
|
ret half %1
|
|
}
|
|
|
|
define half @sitofp_sext_i32_to_f16(i32 signext %a) nounwind {
|
|
; RV64IZFHMIN-LABEL: sitofp_sext_i32_to_f16:
|
|
; RV64IZFHMIN: # %bb.0:
|
|
; RV64IZFHMIN-NEXT: fcvt.s.w fa5, a0
|
|
; RV64IZFHMIN-NEXT: fcvt.h.s fa0, fa5
|
|
; RV64IZFHMIN-NEXT: ret
|
|
;
|
|
; RV64IZHINXMIN-LABEL: sitofp_sext_i32_to_f16:
|
|
; RV64IZHINXMIN: # %bb.0:
|
|
; RV64IZHINXMIN-NEXT: fcvt.s.w a0, a0
|
|
; RV64IZHINXMIN-NEXT: fcvt.h.s a0, a0
|
|
; RV64IZHINXMIN-NEXT: ret
|
|
%1 = sitofp i32 %a to half
|
|
ret half %1
|
|
}
|
|
|
|
define half @sitofp_zext_i32_to_f16(i32 zeroext %a) nounwind {
|
|
; RV64IZFHMIN-LABEL: sitofp_zext_i32_to_f16:
|
|
; RV64IZFHMIN: # %bb.0:
|
|
; RV64IZFHMIN-NEXT: fcvt.s.w fa5, a0
|
|
; RV64IZFHMIN-NEXT: fcvt.h.s fa0, fa5
|
|
; RV64IZFHMIN-NEXT: ret
|
|
;
|
|
; RV64IZHINXMIN-LABEL: sitofp_zext_i32_to_f16:
|
|
; RV64IZHINXMIN: # %bb.0:
|
|
; RV64IZHINXMIN-NEXT: fcvt.s.w a0, a0
|
|
; RV64IZHINXMIN-NEXT: fcvt.h.s a0, a0
|
|
; RV64IZHINXMIN-NEXT: ret
|
|
%1 = sitofp i32 %a to half
|
|
ret half %1
|
|
}
|