1 ; RUN: llc -march=nvptx64 -verify-machineinstrs < %s | FileCheck %s
2 ; RUN: %if ptxas %{ llc -march=nvptx64 -verify-machineinstrs < %s | %ptxas-verify %}
4 declare float @llvm.convert.from.fp16.f32(i16) nounwind readnone
5 declare double @llvm.convert.from.fp16.f64(i16) nounwind readnone
6 declare i16 @llvm.convert.to.fp16.f32(float) nounwind readnone
7 declare i16 @llvm.convert.to.fp16.f64(double) nounwind readnone
9 ; CHECK-LABEL: @test_convert_fp16_to_fp32
11 define void @test_convert_fp16_to_fp32(ptr addrspace(1) noalias %out, ptr addrspace(1) noalias %in) nounwind {
12 %val = load i16, ptr addrspace(1) %in, align 2
13 %cvt = call float @llvm.convert.from.fp16.f32(i16 %val) nounwind readnone
14 store float %cvt, ptr addrspace(1) %out, align 4
19 ; CHECK-LABEL: @test_convert_fp16_to_fp64
21 define void @test_convert_fp16_to_fp64(ptr addrspace(1) noalias %out, ptr addrspace(1) noalias %in) nounwind {
22 %val = load i16, ptr addrspace(1) %in, align 2
23 %cvt = call double @llvm.convert.from.fp16.f64(i16 %val) nounwind readnone
24 store double %cvt, ptr addrspace(1) %out, align 4
29 ; CHECK-LABEL: @test_convert_fp32_to_fp16
30 ; CHECK: cvt.rn.f16.f32
31 define void @test_convert_fp32_to_fp16(ptr addrspace(1) noalias %out, ptr addrspace(1) noalias %in) nounwind {
32 %val = load float, ptr addrspace(1) %in, align 2
33 %cvt = call i16 @llvm.convert.to.fp16.f32(float %val) nounwind readnone
34 store i16 %cvt, ptr addrspace(1) %out, align 4
39 ; CHECK-LABEL: @test_convert_fp64_to_fp16
40 ; CHECK: cvt.rn.f16.f64
41 define void @test_convert_fp64_to_fp16(ptr addrspace(1) noalias %out, ptr addrspace(1) noalias %in) nounwind {
42 %val = load double, ptr addrspace(1) %in, align 2
43 %cvt = call i16 @llvm.convert.to.fp16.f64(double %val) nounwind readnone
44 store i16 %cvt, ptr addrspace(1) %out, align 4