Files
TheRock/compiler/amd-llvm/llvm/test/CodeGen/X86/isel-fptrunc-fpext.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

260 lines
9.8 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc < %s -mtriple=i686-unknown-unknown -fast-isel=0 -global-isel=0 | FileCheck %s --check-prefixes X86,FASTSDAG-X86,SDAG-X86
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+sse2 -fast-isel=0 -global-isel=0 | FileCheck %s --check-prefixes SSE,FASTSDAG-SSE,SDAG-SSE
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx -fast-isel=0 -global-isel=0 | FileCheck %s --check-prefixes AVX,FASTSDAG-AVX,SDAG-AVX
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512f -fast-isel=0 -global-isel=0 | FileCheck %s --check-prefixes AVX,FASTSDAG-AVX,SDAG-AVX
; COMM: FastISel has troubles with fp80 type
; RUN: llc < %s -mtriple=i686-unknown-unknown -fast-isel=1 -global-isel=0 -fast-isel-abort=0 | FileCheck %s --check-prefixes X86,FASTSDAG-X86,FAST-X86
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+sse2 -fast-isel=1 -global-isel=0 -fast-isel-abort=0 | FileCheck %s --check-prefixes SSE,FASTSDAG-SSE,FAST-SSE
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx -fast-isel=1 -global-isel=0 -fast-isel-abort=0 | FileCheck %s --check-prefixes AVX,FASTSDAG-AVX,FAST-AVX
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512f -fast-isel=1 -global-isel=0 -fast-isel-abort=0 | FileCheck %s --check-prefixes AVX,FASTSDAG-AVX,FAST-AVX
; COMM: GlobalISel can't legalize double stores on 32bit platform due to lack of double/integer distinguish during legalization
; RUN: llc < %s -mtriple=i686-unknown-unknown -fast-isel=0 -global-isel=1 -global-isel-abort=2 | FileCheck %s --check-prefixes X86,GLOBAL-X86
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+sse2 -fast-isel=0 -global-isel=1 -global-isel-abort=1 | FileCheck %s --check-prefixes SSE,GLOBAL-SSE
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx -fast-isel=0 -global-isel=1 -global-isel-abort=1 | FileCheck %s --check-prefixes AVX,GLOBAL-AVX
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512f -fast-isel=0 -global-isel=1 -global-isel-abort=1 | FileCheck %s --check-prefixes AVX,GLOBAL-AVX
define double @fpext_float_to_double(float %f) nounwind {
; FASTSDAG-X86-LABEL: fpext_float_to_double:
; FASTSDAG-X86: # %bb.0:
; FASTSDAG-X86-NEXT: flds {{[0-9]+}}(%esp)
; FASTSDAG-X86-NEXT: retl
;
; SSE-LABEL: fpext_float_to_double:
; SSE: # %bb.0:
; SSE-NEXT: cvtss2sd %xmm0, %xmm0
; SSE-NEXT: retq
;
; AVX-LABEL: fpext_float_to_double:
; AVX: # %bb.0:
; AVX-NEXT: vcvtss2sd %xmm0, %xmm0, %xmm0
; AVX-NEXT: retq
;
; GLOBAL-X86-LABEL: fpext_float_to_double:
; GLOBAL-X86: # %bb.0:
; GLOBAL-X86-NEXT: pushl %eax
; GLOBAL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
; GLOBAL-X86-NEXT: movl %eax, (%esp)
; GLOBAL-X86-NEXT: flds (%esp)
; GLOBAL-X86-NEXT: popl %eax
; GLOBAL-X86-NEXT: retl
%1 = fpext float %f to double
ret double %1
}
define x86_fp80 @fpext_float_to_x86_fp80(float %f) nounwind {
; FASTSDAG-X86-LABEL: fpext_float_to_x86_fp80:
; FASTSDAG-X86: # %bb.0:
; FASTSDAG-X86-NEXT: flds {{[0-9]+}}(%esp)
; FASTSDAG-X86-NEXT: retl
;
; FASTSDAG-SSE-LABEL: fpext_float_to_x86_fp80:
; FASTSDAG-SSE: # %bb.0:
; FASTSDAG-SSE-NEXT: movss %xmm0, -{{[0-9]+}}(%rsp)
; FASTSDAG-SSE-NEXT: flds -{{[0-9]+}}(%rsp)
; FASTSDAG-SSE-NEXT: retq
;
; FASTSDAG-AVX-LABEL: fpext_float_to_x86_fp80:
; FASTSDAG-AVX: # %bb.0:
; FASTSDAG-AVX-NEXT: vmovss %xmm0, -{{[0-9]+}}(%rsp)
; FASTSDAG-AVX-NEXT: flds -{{[0-9]+}}(%rsp)
; FASTSDAG-AVX-NEXT: retq
;
; GLOBAL-X86-LABEL: fpext_float_to_x86_fp80:
; GLOBAL-X86: # %bb.0:
; GLOBAL-X86-NEXT: pushl %eax
; GLOBAL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
; GLOBAL-X86-NEXT: movl %eax, (%esp)
; GLOBAL-X86-NEXT: flds (%esp)
; GLOBAL-X86-NEXT: popl %eax
; GLOBAL-X86-NEXT: retl
;
; GLOBAL-SSE-LABEL: fpext_float_to_x86_fp80:
; GLOBAL-SSE: # %bb.0:
; GLOBAL-SSE-NEXT: movd %xmm0, %eax
; GLOBAL-SSE-NEXT: movl %eax, -{{[0-9]+}}(%rsp)
; GLOBAL-SSE-NEXT: flds -{{[0-9]+}}(%rsp)
; GLOBAL-SSE-NEXT: retq
;
; GLOBAL-AVX-LABEL: fpext_float_to_x86_fp80:
; GLOBAL-AVX: # %bb.0:
; GLOBAL-AVX-NEXT: vmovd %xmm0, %eax
; GLOBAL-AVX-NEXT: movl %eax, -{{[0-9]+}}(%rsp)
; GLOBAL-AVX-NEXT: flds -{{[0-9]+}}(%rsp)
; GLOBAL-AVX-NEXT: retq
%1 = fpext float %f to x86_fp80
ret x86_fp80 %1
}
define x86_fp80 @fpext_double_to_x86_fp80(double %d) nounwind {
; FASTSDAG-X86-LABEL: fpext_double_to_x86_fp80:
; FASTSDAG-X86: # %bb.0:
; FASTSDAG-X86-NEXT: fldl {{[0-9]+}}(%esp)
; FASTSDAG-X86-NEXT: retl
;
; FASTSDAG-SSE-LABEL: fpext_double_to_x86_fp80:
; FASTSDAG-SSE: # %bb.0:
; FASTSDAG-SSE-NEXT: movsd %xmm0, -{{[0-9]+}}(%rsp)
; FASTSDAG-SSE-NEXT: fldl -{{[0-9]+}}(%rsp)
; FASTSDAG-SSE-NEXT: retq
;
; FASTSDAG-AVX-LABEL: fpext_double_to_x86_fp80:
; FASTSDAG-AVX: # %bb.0:
; FASTSDAG-AVX-NEXT: vmovsd %xmm0, -{{[0-9]+}}(%rsp)
; FASTSDAG-AVX-NEXT: fldl -{{[0-9]+}}(%rsp)
; FASTSDAG-AVX-NEXT: retq
;
; GLOBAL-X86-LABEL: fpext_double_to_x86_fp80:
; GLOBAL-X86: # %bb.0:
; GLOBAL-X86-NEXT: pushl %ebp
; GLOBAL-X86-NEXT: movl %esp, %ebp
; GLOBAL-X86-NEXT: andl $-8, %esp
; GLOBAL-X86-NEXT: subl $8, %esp
; GLOBAL-X86-NEXT: leal 8(%ebp), %eax
; GLOBAL-X86-NEXT: movl 8(%ebp), %ecx
; GLOBAL-X86-NEXT: movl 4(%eax), %eax
; GLOBAL-X86-NEXT: movl %esp, %edx
; GLOBAL-X86-NEXT: movl %ecx, (%esp)
; GLOBAL-X86-NEXT: movl %eax, 4(%edx)
; GLOBAL-X86-NEXT: fldl (%esp)
; GLOBAL-X86-NEXT: movl %ebp, %esp
; GLOBAL-X86-NEXT: popl %ebp
; GLOBAL-X86-NEXT: retl
;
; GLOBAL-SSE-LABEL: fpext_double_to_x86_fp80:
; GLOBAL-SSE: # %bb.0:
; GLOBAL-SSE-NEXT: movq %xmm0, %rax
; GLOBAL-SSE-NEXT: movq %rax, -{{[0-9]+}}(%rsp)
; GLOBAL-SSE-NEXT: fldl -{{[0-9]+}}(%rsp)
; GLOBAL-SSE-NEXT: retq
;
; GLOBAL-AVX-LABEL: fpext_double_to_x86_fp80:
; GLOBAL-AVX: # %bb.0:
; GLOBAL-AVX-NEXT: vmovq %xmm0, %rax
; GLOBAL-AVX-NEXT: movq %rax, -{{[0-9]+}}(%rsp)
; GLOBAL-AVX-NEXT: fldl -{{[0-9]+}}(%rsp)
; GLOBAL-AVX-NEXT: retq
%1 = fpext double %d to x86_fp80
ret x86_fp80 %1
}
define float @fptrunc_double_to_float(double %d) nounwind {
; X86-LABEL: fptrunc_double_to_float:
; X86: # %bb.0:
; X86-NEXT: pushl %eax
; X86-NEXT: fldl {{[0-9]+}}(%esp)
; X86-NEXT: fstps (%esp)
; X86-NEXT: flds (%esp)
; X86-NEXT: popl %eax
; X86-NEXT: retl
;
; SSE-LABEL: fptrunc_double_to_float:
; SSE: # %bb.0:
; SSE-NEXT: cvtsd2ss %xmm0, %xmm0
; SSE-NEXT: retq
;
; AVX-LABEL: fptrunc_double_to_float:
; AVX: # %bb.0:
; AVX-NEXT: vcvtsd2ss %xmm0, %xmm0, %xmm0
; AVX-NEXT: retq
%1 = fptrunc double %d to float
ret float %1
}
define float @fptrunc_x86_fp80_to_float(x86_fp80 %x) nounwind {
; X86-LABEL: fptrunc_x86_fp80_to_float:
; X86: # %bb.0:
; X86-NEXT: pushl %eax
; X86-NEXT: fldt {{[0-9]+}}(%esp)
; X86-NEXT: fstps (%esp)
; X86-NEXT: flds (%esp)
; X86-NEXT: popl %eax
; X86-NEXT: retl
;
; FASTSDAG-SSE-LABEL: fptrunc_x86_fp80_to_float:
; FASTSDAG-SSE: # %bb.0:
; FASTSDAG-SSE-NEXT: fldt {{[0-9]+}}(%rsp)
; FASTSDAG-SSE-NEXT: fstps -{{[0-9]+}}(%rsp)
; FASTSDAG-SSE-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
; FASTSDAG-SSE-NEXT: retq
;
; FASTSDAG-AVX-LABEL: fptrunc_x86_fp80_to_float:
; FASTSDAG-AVX: # %bb.0:
; FASTSDAG-AVX-NEXT: fldt {{[0-9]+}}(%rsp)
; FASTSDAG-AVX-NEXT: fstps -{{[0-9]+}}(%rsp)
; FASTSDAG-AVX-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
; FASTSDAG-AVX-NEXT: retq
;
; GLOBAL-SSE-LABEL: fptrunc_x86_fp80_to_float:
; GLOBAL-SSE: # %bb.0:
; GLOBAL-SSE-NEXT: fldt {{[0-9]+}}(%rsp)
; GLOBAL-SSE-NEXT: fstps -{{[0-9]+}}(%rsp)
; GLOBAL-SSE-NEXT: movl -{{[0-9]+}}(%rsp), %eax
; GLOBAL-SSE-NEXT: movd %eax, %xmm0
; GLOBAL-SSE-NEXT: retq
;
; GLOBAL-AVX-LABEL: fptrunc_x86_fp80_to_float:
; GLOBAL-AVX: # %bb.0:
; GLOBAL-AVX-NEXT: fldt {{[0-9]+}}(%rsp)
; GLOBAL-AVX-NEXT: fstps -{{[0-9]+}}(%rsp)
; GLOBAL-AVX-NEXT: movl -{{[0-9]+}}(%rsp), %eax
; GLOBAL-AVX-NEXT: vmovd %eax, %xmm0
; GLOBAL-AVX-NEXT: retq
%1 = fptrunc x86_fp80 %x to float
ret float %1
}
define double @fptrunc_x86_fp80_to_double(x86_fp80 %x) nounwind {
; X86-LABEL: fptrunc_x86_fp80_to_double:
; X86: # %bb.0:
; X86-NEXT: pushl %ebp
; X86-NEXT: movl %esp, %ebp
; X86-NEXT: andl $-8, %esp
; X86-NEXT: subl $8, %esp
; X86-NEXT: fldt 8(%ebp)
; X86-NEXT: fstpl (%esp)
; X86-NEXT: fldl (%esp)
; X86-NEXT: movl %ebp, %esp
; X86-NEXT: popl %ebp
; X86-NEXT: retl
;
; FASTSDAG-SSE-LABEL: fptrunc_x86_fp80_to_double:
; FASTSDAG-SSE: # %bb.0:
; FASTSDAG-SSE-NEXT: fldt {{[0-9]+}}(%rsp)
; FASTSDAG-SSE-NEXT: fstpl -{{[0-9]+}}(%rsp)
; FASTSDAG-SSE-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero
; FASTSDAG-SSE-NEXT: retq
;
; FASTSDAG-AVX-LABEL: fptrunc_x86_fp80_to_double:
; FASTSDAG-AVX: # %bb.0:
; FASTSDAG-AVX-NEXT: fldt {{[0-9]+}}(%rsp)
; FASTSDAG-AVX-NEXT: fstpl -{{[0-9]+}}(%rsp)
; FASTSDAG-AVX-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
; FASTSDAG-AVX-NEXT: retq
;
; GLOBAL-SSE-LABEL: fptrunc_x86_fp80_to_double:
; GLOBAL-SSE: # %bb.0:
; GLOBAL-SSE-NEXT: fldt {{[0-9]+}}(%rsp)
; GLOBAL-SSE-NEXT: fstpl -{{[0-9]+}}(%rsp)
; GLOBAL-SSE-NEXT: movq -{{[0-9]+}}(%rsp), %rax
; GLOBAL-SSE-NEXT: movq %rax, %xmm0
; GLOBAL-SSE-NEXT: retq
;
; GLOBAL-AVX-LABEL: fptrunc_x86_fp80_to_double:
; GLOBAL-AVX: # %bb.0:
; GLOBAL-AVX-NEXT: fldt {{[0-9]+}}(%rsp)
; GLOBAL-AVX-NEXT: fstpl -{{[0-9]+}}(%rsp)
; GLOBAL-AVX-NEXT: movq -{{[0-9]+}}(%rsp), %rax
; GLOBAL-AVX-NEXT: vmovq %rax, %xmm0
; GLOBAL-AVX-NEXT: retq
%1 = fptrunc x86_fp80 %x to double
ret double %1
}
;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
; FAST-AVX: {{.*}}
; FAST-SSE: {{.*}}
; FAST-X86: {{.*}}
; SDAG-AVX: {{.*}}
; SDAG-SSE: {{.*}}
; SDAG-X86: {{.*}}