[WebAssembly] Don't perform the returned-argument optimization on constants.
[oota-llvm.git] / test / CodeGen / NVPTX / fp16.ll
1 ; RUN: llc -march=nvptx -verify-machineinstrs < %s | FileCheck %s
2
3 declare float @llvm.convert.from.fp16.f32(i16) nounwind readnone
4 declare double @llvm.convert.from.fp16.f64(i16) nounwind readnone
5 declare i16 @llvm.convert.to.fp16.f32(float) nounwind readnone
6 declare i16 @llvm.convert.to.fp16.f64(double) nounwind readnone
7
8 ; CHECK-LABEL: @test_convert_fp16_to_fp32
9 ; CHECK: cvt.f32.f16
10 define void @test_convert_fp16_to_fp32(float addrspace(1)* noalias %out, i16 addrspace(1)* noalias %in) nounwind {
11   %val = load i16, i16 addrspace(1)* %in, align 2
12   %cvt = call float @llvm.convert.from.fp16.f32(i16 %val) nounwind readnone
13   store float %cvt, float addrspace(1)* %out, align 4
14   ret void
15 }
16
17
18 ; CHECK-LABEL: @test_convert_fp16_to_fp64
19 ; CHECK: cvt.f64.f16
20 define void @test_convert_fp16_to_fp64(double addrspace(1)* noalias %out, i16 addrspace(1)* noalias %in) nounwind {
21   %val = load i16, i16 addrspace(1)* %in, align 2
22   %cvt = call double @llvm.convert.from.fp16.f64(i16 %val) nounwind readnone
23   store double %cvt, double addrspace(1)* %out, align 4
24   ret void
25 }
26
27
28 ; CHECK-LABEL: @test_convert_fp32_to_fp16
29 ; CHECK: cvt.rn.f16.f32
30 define void @test_convert_fp32_to_fp16(i16 addrspace(1)* noalias %out, float addrspace(1)* noalias %in) nounwind {
31   %val = load float, float addrspace(1)* %in, align 2
32   %cvt = call i16 @llvm.convert.to.fp16.f32(float %val) nounwind readnone
33   store i16 %cvt, i16 addrspace(1)* %out, align 4
34   ret void
35 }
36
37
38 ; CHECK-LABEL: @test_convert_fp64_to_fp16
39 ; CHECK: cvt.rn.f16.f64
40 define void @test_convert_fp64_to_fp16(i16 addrspace(1)* noalias %out, double addrspace(1)* noalias %in) nounwind {
41   %val = load double, double addrspace(1)* %in, align 2
42   %cvt = call i16 @llvm.convert.to.fp16.f64(double %val) nounwind readnone
43   store i16 %cvt, i16 addrspace(1)* %out, align 4
44   ret void
45 }