1 ; RUN: llc < %s -march=amdgcn -mcpu=SI | FileCheck %s
2 ; RUN: llc < %s -march=amdgcn -mcpu=tonga | FileCheck %s
4 define void @test_load_store(half addrspace(1)* %in, half addrspace(1)* %out) {
5 ; CHECK-LABEL: {{^}}test_load_store:
6 ; CHECK: buffer_load_ushort [[TMP:v[0-9]+]]
7 ; CHECK: buffer_store_short [[TMP]]
8 %val = load half addrspace(1)* %in
9 store half %val, half addrspace(1) * %out
13 define void @test_bitcast_from_half(half addrspace(1)* %in, i16 addrspace(1)* %out) {
14 ; CHECK-LABEL: {{^}}test_bitcast_from_half:
15 ; CHECK: buffer_load_ushort [[TMP:v[0-9]+]]
16 ; CHECK: buffer_store_short [[TMP]]
17 %val = load half addrspace(1) * %in
18 %val_int = bitcast half %val to i16
19 store i16 %val_int, i16 addrspace(1)* %out
23 define void @test_bitcast_to_half(half addrspace(1)* %out, i16 addrspace(1)* %in) {
24 ; CHECK-LABEL: {{^}}test_bitcast_to_half:
25 ; CHECK: buffer_load_ushort [[TMP:v[0-9]+]]
26 ; CHECK: buffer_store_short [[TMP]]
27 %val = load i16 addrspace(1)* %in
28 %val_fp = bitcast i16 %val to half
29 store half %val_fp, half addrspace(1)* %out
33 define void @test_extend32(half addrspace(1)* %in, float addrspace(1)* %out) {
34 ; CHECK-LABEL: {{^}}test_extend32:
35 ; CHECK: v_cvt_f32_f16_e32
37 %val16 = load half addrspace(1)* %in
38 %val32 = fpext half %val16 to float
39 store float %val32, float addrspace(1)* %out
43 define void @test_extend64(half addrspace(1)* %in, double addrspace(1)* %out) {
44 ; CHECK-LABEL: {{^}}test_extend64:
45 ; CHECK: v_cvt_f32_f16_e32
46 ; CHECK: v_cvt_f64_f32_e32
48 %val16 = load half addrspace(1)* %in
49 %val64 = fpext half %val16 to double
50 store double %val64, double addrspace(1)* %out
54 define void @test_trunc32(float addrspace(1)* %in, half addrspace(1)* %out) {
55 ; CHECK-LABEL: {{^}}test_trunc32:
56 ; CHECK: v_cvt_f16_f32_e32
58 %val32 = load float addrspace(1)* %in
59 %val16 = fptrunc float %val32 to half
60 store half %val16, half addrspace(1)* %out