Files
TheRock/compiler/amd-llvm/llvm/test/CodeGen/LoongArch/lsx/ir-instruction/fptrunc.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

86 lines
2.7 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 6
; RUN: llc --mtriple=loongarch32 --mattr=+32s,+lsx < %s | FileCheck %s --check-prefixes=CHECK,LA32
; RUN: llc --mtriple=loongarch64 --mattr=+lsx < %s | FileCheck %s --check-prefixes=CHECK,LA64
;; fptrunc
define void @fptrunc_v1f64_to_v1f32(ptr %res, ptr %a0) nounwind {
; CHECK-LABEL: fptrunc_v1f64_to_v1f32:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: fld.d $fa0, $a1, 0
; CHECK-NEXT: fcvt.s.d $fa0, $fa0
; CHECK-NEXT: fst.s $fa0, $a0, 0
; CHECK-NEXT: ret
entry:
%v0 = load <1 x double>, ptr %a0
%trunc = fptrunc <1 x double> %v0 to <1 x float>
store <1 x float> %trunc, ptr %res
ret void
}
define void @fptrunc_v2f64_to_v2f32(ptr %res, ptr %a0) nounwind {
; LA32-LABEL: fptrunc_v2f64_to_v2f32:
; LA32: # %bb.0: # %entry
; LA32-NEXT: vld $vr0, $a1, 0
; LA32-NEXT: vfcvt.s.d $vr0, $vr0, $vr0
; LA32-NEXT: vstelm.w $vr0, $a0, 4, 1
; LA32-NEXT: vstelm.w $vr0, $a0, 0, 0
; LA32-NEXT: ret
;
; LA64-LABEL: fptrunc_v2f64_to_v2f32:
; LA64: # %bb.0: # %entry
; LA64-NEXT: vld $vr0, $a1, 0
; LA64-NEXT: vfcvt.s.d $vr0, $vr0, $vr0
; LA64-NEXT: vstelm.d $vr0, $a0, 0, 0
; LA64-NEXT: ret
entry:
%v0 = load <2 x double>, ptr %a0
%trunc = fptrunc <2 x double> %v0 to <2 x float>
store <2 x float> %trunc, ptr %res
ret void
}
define void @fptrunc_v4f64_to_v4f32(ptr %res, ptr %a0) nounwind {
; CHECK-LABEL: fptrunc_v4f64_to_v4f32:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: vld $vr0, $a1, 0
; CHECK-NEXT: vld $vr1, $a1, 16
; CHECK-NEXT: vfcvt.s.d $vr0, $vr1, $vr0
; CHECK-NEXT: vst $vr0, $a0, 0
; CHECK-NEXT: ret
entry:
%v0 = load <4 x double>, ptr %a0
%trunc = fptrunc <4 x double> %v0 to <4 x float>
store <4 x float> %trunc, ptr %res
ret void
}
define void @fptrunc_concat_bitcast(ptr %res, ptr %a0) nounwind {
; CHECK-LABEL: fptrunc_concat_bitcast:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: vld $vr0, $a1, 0
; CHECK-NEXT: vld $vr1, $a1, 16
; CHECK-NEXT: vfcvt.s.d $vr0, $vr1, $vr0
; CHECK-NEXT: vst $vr0, $a0, 0
; CHECK-NEXT: ret
entry:
%x = load <4 x double>, ptr %a0
; split to 2 x <2 x double>
%lo = shufflevector <4 x double> %x, <4 x double> poison,
<2 x i32> <i32 0, i32 1>
%hi = shufflevector <4 x double> %x, <4 x double> poison,
<2 x i32> <i32 2, i32 3>
%r0 = fptrunc <2 x double> %lo to <2 x float>
%r1 = fptrunc <2 x double> %hi to <2 x float>
%i0 = bitcast <2 x float> %r0 to i64
%i1 = bitcast <2 x float> %r1 to i64
; concat as integer vector
%cat0 = insertelement <2 x i64> poison, i64 %i0, i32 0
%cat1 = insertelement <2 x i64> %cat0, i64 %i1, i32 1
store <2 x i64> %cat1, ptr %res
ret void
}