]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/CodeGen/AMDGPU/fp32_to_fp16.ll
Vendor import of llvm release_40 branch r292009:
[FreeBSD/FreeBSD.git] / test / CodeGen / AMDGPU / fp32_to_fp16.ll
1 ; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=FUNC %s
2 ; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=FUNC %s
3 ; RUN: llc -march=r600 -mcpu=cypress -verify-machineinstrs < %s | FileCheck -check-prefix=EG -check-prefix=FUNC %s
4
5 declare i16 @llvm.convert.to.fp16.f32(float) nounwind readnone
6
7 ; FUNC-LABEL: {{^}}test_convert_fp32_to_fp16:
8 ; GCN: buffer_load_dword [[VAL:v[0-9]+]]
9 ; GCN: v_cvt_f16_f32_e32 [[RESULT:v[0-9]+]], [[VAL]]
10 ; GCN: buffer_store_short [[RESULT]]
11
12 ; EG: MEM_RAT MSKOR
13 ; EG: VTX_READ_32
14 ; EG: FLT32_TO_FLT16
15 define void @test_convert_fp32_to_fp16(i16 addrspace(1)* noalias %out, float addrspace(1)* noalias %in) nounwind {
16   %val = load float, float addrspace(1)* %in, align 4
17   %cvt = call i16 @llvm.convert.to.fp16.f32(float %val) nounwind readnone
18   store i16 %cvt, i16 addrspace(1)* %out, align 2
19   ret void
20 }