Files
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

109 lines
3.1 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -passes=instsimplify -S < %s | FileCheck %s
; Verify that we don't crash with an assertion failure when constant folding
; a call to intrinsic 'convert.from.fp16' if the return type is not 'float'.
define float @fold_from_fp16_to_fp32() {
; CHECK-LABEL: @fold_from_fp16_to_fp32(
; CHECK-NEXT: ret float 0.000000e+00
;
%r = call float @llvm.convert.from.fp16.f32(i16 0)
ret float %r
}
define double @fold_from_fp16_to_fp64() {
; CHECK-LABEL: @fold_from_fp16_to_fp64(
; CHECK-NEXT: ret double 0.000000e+00
;
%r = call double @llvm.convert.from.fp16.f64(i16 0)
ret double %r
}
define x86_fp80 @fold_from_fp16_to_fp80() {
; CHECK-LABEL: @fold_from_fp16_to_fp80(
; CHECK-NEXT: ret x86_fp80 0.000000e+00
;
%r = call x86_fp80 @llvm.convert.from.fp16.f80(i16 0)
ret x86_fp80 %r
}
define fp128 @fold_from_fp16_to_fp128() {
; CHECK-LABEL: @fold_from_fp16_to_fp128(
; CHECK-NEXT: ret fp128 0.000000e+00
;
%r = call fp128 @llvm.convert.from.fp16.f128(i16 0)
ret fp128 %r
}
define ppc_fp128 @fold_from_fp16_to_ppcfp128() {
; CHECK-LABEL: @fold_from_fp16_to_ppcfp128(
; CHECK-NEXT: ret ppc_fp128 0.000000e+00
;
%r = call ppc_fp128 @llvm.convert.from.fp16.ppcf128(i16 0)
ret ppc_fp128 %r
}
define float @fold_from_fp16_to_fp32_b() {
; CHECK-LABEL: @fold_from_fp16_to_fp32_b(
; CHECK-NEXT: ret float 4.000000e+00
;
%a = call i16 @llvm.convert.to.fp16.f64(double 4.0)
%r = call float @llvm.convert.from.fp16.f32(i16 %a)
ret float %r
}
define double @fold_from_fp16_to_fp64_b() {
; CHECK-LABEL: @fold_from_fp16_to_fp64_b(
; CHECK-NEXT: ret double 4.000000e+00
;
%a = call i16 @llvm.convert.to.fp16.f64(double 4.0)
%r = call double @llvm.convert.from.fp16.f64(i16 %a)
ret double %r
}
define x86_fp80 @fold_from_fp16_to_fp80_b() {
; CHECK-LABEL: @fold_from_fp16_to_fp80_b(
; CHECK-NEXT: ret x86_fp80 4.000000e+00
;
%a = call i16 @llvm.convert.to.fp16.f64(double 4.0)
%r = call x86_fp80 @llvm.convert.from.fp16.f80(i16 %a)
ret x86_fp80 %r
}
define fp128 @fold_from_fp16_to_fp128_b() {
; CHECK-LABEL: @fold_from_fp16_to_fp128_b(
; CHECK-NEXT: ret fp128 4.000000e+00
;
%a = call i16 @llvm.convert.to.fp16.f64(double 4.0)
%r = call fp128 @llvm.convert.from.fp16.f128(i16 %a)
ret fp128 %r
}
define ppc_fp128 @fold_from_fp16_to_ppcfp128_b() {
; CHECK-LABEL: @fold_from_fp16_to_ppcfp128_b(
; CHECK-NEXT: ret ppc_fp128 4.000000e+00
;
%a = call i16 @llvm.convert.to.fp16.f64(double 4.0)
%r = call ppc_fp128 @llvm.convert.from.fp16.ppcf128(i16 %a)
ret ppc_fp128 %r
}
; This would assert because converting SNAN causes an invalidOp status.
; PR56981
define float @convert_snan() {
; CHECK-LABEL: @convert_snan(
; CHECK-NEXT: ret float +nan(0x2000)
;
%r = call float @llvm.convert.from.fp16.f32(i16 31745) ; 0x7c01
ret float %r
}
declare i16 @llvm.convert.to.fp16.f64(double)
declare float @llvm.convert.from.fp16.f32(i16)
declare double @llvm.convert.from.fp16.f64(i16)
declare x86_fp80 @llvm.convert.from.fp16.f80(i16)
declare fp128 @llvm.convert.from.fp16.f128(i16)
declare ppc_fp128 @llvm.convert.from.fp16.ppcf128(i16)