Files
TheRock/compiler/amd-llvm/llvm/test/Transforms/InstCombine/simplify-intrinsics.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

70 lines
2.6 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -passes=instcombine -S | FileCheck %s --check-prefixes=ANY,NO-FLOAT-SHRINK
; RUN: opt < %s -passes=instcombine -enable-double-float-shrink -S | FileCheck %s --check-prefixes=ANY,DO-FLOAT-SHRINK
declare double @llvm.cos.f64(double)
declare float @llvm.cos.f32(float)
declare double @llvm.sin.f64(double)
declare float @llvm.sin.f32(float)
; cos -> cosf
define float @cos_no_fastmath(float %f) {
; NO-FLOAT-SHRINK-LABEL: @cos_no_fastmath(
; NO-FLOAT-SHRINK-NEXT: [[D:%.*]] = fpext float [[F:%.*]] to double
; NO-FLOAT-SHRINK-NEXT: [[RESULT:%.*]] = call double @llvm.cos.f64(double [[D]])
; NO-FLOAT-SHRINK-NEXT: [[TRUNCATED_RESULT:%.*]] = fptrunc double [[RESULT]] to float
; NO-FLOAT-SHRINK-NEXT: ret float [[TRUNCATED_RESULT]]
;
; DO-FLOAT-SHRINK-LABEL: @cos_no_fastmath(
; DO-FLOAT-SHRINK-NEXT: [[TMP1:%.*]] = call float @llvm.cos.f32(float [[F:%.*]])
; DO-FLOAT-SHRINK-NEXT: ret float [[TMP1]]
;
%d = fpext float %f to double
%result = call double @llvm.cos.f64(double %d)
%truncated_result = fptrunc double %result to float
ret float %truncated_result
}
define float @cos_fastmath(float %f) {
; ANY-LABEL: @cos_fastmath(
; ANY-NEXT: [[TMP1:%.*]] = call fast float @llvm.cos.f32(float [[F:%.*]])
; ANY-NEXT: ret float [[TMP1]]
;
%d = fpext float %f to double
%result = call fast double @llvm.cos.f64(double %d)
%truncated_result = fptrunc double %result to float
ret float %truncated_result
}
; sin -> sinf
define float @sin_no_fastmath(float %f) {
; NO-FLOAT-SHRINK-LABEL: @sin_no_fastmath(
; NO-FLOAT-SHRINK-NEXT: [[D:%.*]] = fpext float [[F:%.*]] to double
; NO-FLOAT-SHRINK-NEXT: [[RESULT:%.*]] = call double @llvm.sin.f64(double [[D]])
; NO-FLOAT-SHRINK-NEXT: [[TRUNCATED_RESULT:%.*]] = fptrunc double [[RESULT]] to float
; NO-FLOAT-SHRINK-NEXT: ret float [[TRUNCATED_RESULT]]
;
; DO-FLOAT-SHRINK-LABEL: @sin_no_fastmath(
; DO-FLOAT-SHRINK-NEXT: [[TMP1:%.*]] = call float @llvm.sin.f32(float [[F:%.*]])
; DO-FLOAT-SHRINK-NEXT: ret float [[TMP1]]
;
%d = fpext float %f to double
%result = call double @llvm.sin.f64(double %d)
%truncated_result = fptrunc double %result to float
ret float %truncated_result
}
define float @sin_fastmath(float %f) {
; ANY-LABEL: @sin_fastmath(
; ANY-NEXT: [[TMP1:%.*]] = call fast float @llvm.sin.f32(float [[F:%.*]])
; ANY-NEXT: ret float [[TMP1]]
;
%d = fpext float %f to double
%result = call fast double @llvm.sin.f64(double %d)
%truncated_result = fptrunc double %result to float
ret float %truncated_result
}