1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
2 ; RUN: llc -mtriple=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX6 %s
3 ; RUN: llc -mtriple=amdgcn -mcpu=tonga -mattr=-flat-for-global -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX8 %s
4 ; RUN: llc -mtriple=amdgcn -mcpu=gfx1100 -mattr=+real-true16 -mattr=-flat-for-global -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX11-TRUE16 %s
5 ; RUN: llc -mtriple=amdgcn -mcpu=gfx1100 -mattr=-real-true16 -mattr=-flat-for-global -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX11-FAKE16 %s
8 declare double @llvm.convert.from.fp16.f64(i16) nounwind readnone
10 define amdgpu_kernel void @test_convert_fp16_to_fp64(ptr addrspace(1) noalias %out, ptr addrspace(1) noalias %in) nounwind {
11 ; GFX6-LABEL: test_convert_fp16_to_fp64:
13 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x9
14 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
15 ; GFX6-NEXT: s_mov_b32 s6, -1
16 ; GFX6-NEXT: s_mov_b32 s10, s6
17 ; GFX6-NEXT: s_mov_b32 s11, s7
18 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
19 ; GFX6-NEXT: s_mov_b32 s8, s2
20 ; GFX6-NEXT: s_mov_b32 s9, s3
21 ; GFX6-NEXT: buffer_load_ushort v0, off, s[8:11], 0
22 ; GFX6-NEXT: s_mov_b32 s4, s0
23 ; GFX6-NEXT: s_mov_b32 s5, s1
24 ; GFX6-NEXT: s_waitcnt vmcnt(0)
25 ; GFX6-NEXT: v_cvt_f32_f16_e32 v0, v0
26 ; GFX6-NEXT: v_cvt_f64_f32_e32 v[0:1], v0
27 ; GFX6-NEXT: buffer_store_dwordx2 v[0:1], off, s[4:7], 0
30 ; GFX8-LABEL: test_convert_fp16_to_fp64:
32 ; GFX8-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x24
33 ; GFX8-NEXT: s_mov_b32 s7, 0xf000
34 ; GFX8-NEXT: s_mov_b32 s6, -1
35 ; GFX8-NEXT: s_mov_b32 s10, s6
36 ; GFX8-NEXT: s_mov_b32 s11, s7
37 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
38 ; GFX8-NEXT: s_mov_b32 s8, s2
39 ; GFX8-NEXT: s_mov_b32 s9, s3
40 ; GFX8-NEXT: buffer_load_ushort v0, off, s[8:11], 0
41 ; GFX8-NEXT: s_mov_b32 s4, s0
42 ; GFX8-NEXT: s_mov_b32 s5, s1
43 ; GFX8-NEXT: s_waitcnt vmcnt(0)
44 ; GFX8-NEXT: v_cvt_f32_f16_e32 v0, v0
45 ; GFX8-NEXT: v_cvt_f64_f32_e32 v[0:1], v0
46 ; GFX8-NEXT: buffer_store_dwordx2 v[0:1], off, s[4:7], 0
49 ; GFX11-TRUE16-LABEL: test_convert_fp16_to_fp64:
50 ; GFX11-TRUE16: ; %bb.0:
51 ; GFX11-TRUE16-NEXT: s_load_b128 s[0:3], s[4:5], 0x24
52 ; GFX11-TRUE16-NEXT: s_mov_b32 s6, -1
53 ; GFX11-TRUE16-NEXT: s_mov_b32 s7, 0x31016000
54 ; GFX11-TRUE16-NEXT: s_mov_b32 s10, s6
55 ; GFX11-TRUE16-NEXT: s_mov_b32 s11, s7
56 ; GFX11-TRUE16-NEXT: s_waitcnt lgkmcnt(0)
57 ; GFX11-TRUE16-NEXT: s_mov_b32 s8, s2
58 ; GFX11-TRUE16-NEXT: s_mov_b32 s9, s3
59 ; GFX11-TRUE16-NEXT: s_mov_b32 s4, s0
60 ; GFX11-TRUE16-NEXT: buffer_load_u16 v0, off, s[8:11], 0
61 ; GFX11-TRUE16-NEXT: s_mov_b32 s5, s1
62 ; GFX11-TRUE16-NEXT: s_waitcnt vmcnt(0)
63 ; GFX11-TRUE16-NEXT: v_cvt_f32_f16_e32 v0, v0.l
64 ; GFX11-TRUE16-NEXT: s_delay_alu instid0(VALU_DEP_1)
65 ; GFX11-TRUE16-NEXT: v_cvt_f64_f32_e32 v[0:1], v0
66 ; GFX11-TRUE16-NEXT: buffer_store_b64 v[0:1], off, s[4:7], 0
67 ; GFX11-TRUE16-NEXT: s_endpgm
69 ; GFX11-FAKE16-LABEL: test_convert_fp16_to_fp64:
70 ; GFX11-FAKE16: ; %bb.0:
71 ; GFX11-FAKE16-NEXT: s_load_b128 s[0:3], s[4:5], 0x24
72 ; GFX11-FAKE16-NEXT: s_mov_b32 s6, -1
73 ; GFX11-FAKE16-NEXT: s_mov_b32 s7, 0x31016000
74 ; GFX11-FAKE16-NEXT: s_mov_b32 s10, s6
75 ; GFX11-FAKE16-NEXT: s_mov_b32 s11, s7
76 ; GFX11-FAKE16-NEXT: s_waitcnt lgkmcnt(0)
77 ; GFX11-FAKE16-NEXT: s_mov_b32 s8, s2
78 ; GFX11-FAKE16-NEXT: s_mov_b32 s9, s3
79 ; GFX11-FAKE16-NEXT: s_mov_b32 s4, s0
80 ; GFX11-FAKE16-NEXT: buffer_load_u16 v0, off, s[8:11], 0
81 ; GFX11-FAKE16-NEXT: s_mov_b32 s5, s1
82 ; GFX11-FAKE16-NEXT: s_waitcnt vmcnt(0)
83 ; GFX11-FAKE16-NEXT: v_cvt_f32_f16_e32 v0, v0
84 ; GFX11-FAKE16-NEXT: s_delay_alu instid0(VALU_DEP_1)
85 ; GFX11-FAKE16-NEXT: v_cvt_f64_f32_e32 v[0:1], v0
86 ; GFX11-FAKE16-NEXT: buffer_store_b64 v[0:1], off, s[4:7], 0
87 ; GFX11-FAKE16-NEXT: s_endpgm
88 %val = load i16, ptr addrspace(1) %in, align 2
89 %cvt = call double @llvm.convert.from.fp16.f64(i16 %val) nounwind readnone
90 store double %cvt, ptr addrspace(1) %out, align 4