2017-08-07 22:58:04 +08:00
|
|
|
; RUN: llc -march=amdgcn -mcpu=tahiti -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=SI %s
|
2017-01-25 06:02:15 +08:00
|
|
|
; RUN: llc -march=amdgcn -mcpu=fiji -mattr=-flat-for-global -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=VI %s
|
2016-11-17 11:49:01 +08:00
|
|
|
|
2017-01-31 00:57:41 +08:00
|
|
|
; GCN-LABEL: {{^}}br_cc_f16:
|
2016-11-17 11:49:01 +08:00
|
|
|
; GCN: buffer_load_ushort v[[A_F16:[0-9]+]]
|
|
|
|
; GCN: buffer_load_ushort v[[B_F16:[0-9]+]]
|
|
|
|
|
2017-09-20 04:54:38 +08:00
|
|
|
; SI: v_cvt_f32_f16_e32 v[[A_F32:[0-9]+]], v[[A_F16]]
|
|
|
|
; SI: v_cvt_f32_f16_e32 v[[B_F32:[0-9]+]], v[[B_F16]]
|
|
|
|
; SI: v_cmp_nlt_f32_e32 vcc, v[[A_F32]], v[[B_F32]]
|
2016-11-17 11:49:01 +08:00
|
|
|
; VI: v_cmp_nlt_f16_e32 vcc, v[[A_F16]], v[[B_F16]]
|
|
|
|
; GCN: s_cbranch_vccnz
|
|
|
|
|
|
|
|
; GCN: one{{$}}
|
2017-09-20 04:54:38 +08:00
|
|
|
; SI: v_cvt_f16_f32_e32 v[[A_F16:[0-9]+]], v[[A_F32]]
|
2017-03-02 08:35:08 +08:00
|
|
|
; GCN: buffer_store_short
|
|
|
|
; GCN: s_endpgm
|
2016-11-17 11:49:01 +08:00
|
|
|
|
|
|
|
; GCN: two{{$}}
|
2017-09-20 04:54:38 +08:00
|
|
|
; SI: v_cvt_f16_f32_e32 v[[B_F16:[0-9]+]], v[[B_F32]]
|
2016-11-17 11:49:01 +08:00
|
|
|
; GCN: buffer_store_short v[[B_F16]]
|
|
|
|
; GCN: s_endpgm
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @br_cc_f16(
|
2016-11-17 11:49:01 +08:00
|
|
|
half addrspace(1)* %r,
|
|
|
|
half addrspace(1)* %a,
|
|
|
|
half addrspace(1)* %b) {
|
|
|
|
entry:
|
|
|
|
%a.val = load half, half addrspace(1)* %a
|
|
|
|
%b.val = load half, half addrspace(1)* %b
|
|
|
|
%fcmp = fcmp olt half %a.val, %b.val
|
|
|
|
br i1 %fcmp, label %one, label %two
|
|
|
|
|
|
|
|
one:
|
|
|
|
store half %a.val, half addrspace(1)* %r
|
|
|
|
ret void
|
|
|
|
|
|
|
|
two:
|
|
|
|
store half %b.val, half addrspace(1)* %r
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2017-01-31 00:57:41 +08:00
|
|
|
; GCN-LABEL: {{^}}br_cc_f16_imm_a:
|
2016-11-17 11:49:01 +08:00
|
|
|
; GCN: buffer_load_ushort v[[B_F16:[0-9]+]]
|
|
|
|
|
|
|
|
; SI: v_cvt_f32_f16_e32 v[[B_F32:[0-9]+]], v[[B_F16]]
|
2017-01-31 00:57:41 +08:00
|
|
|
; SI: v_cmp_nlt_f32_e32 vcc, 0.5, v[[B_F32]]
|
|
|
|
; SI: s_cbranch_vccnz
|
2016-12-09 04:14:46 +08:00
|
|
|
|
2016-12-10 08:39:12 +08:00
|
|
|
; VI: v_cmp_nlt_f16_e32 vcc, 0.5, v[[B_F16]]
|
2016-12-06 09:02:51 +08:00
|
|
|
; VI: s_cbranch_vccnz
|
2016-11-17 11:49:01 +08:00
|
|
|
|
2017-01-31 00:57:41 +08:00
|
|
|
; GCN: one{{$}}
|
2016-12-06 09:02:51 +08:00
|
|
|
; VI: v_mov_b32_e32 v[[A_F16:[0-9]+]], 0x380{{0|1}}{{$}}
|
2016-11-17 11:49:01 +08:00
|
|
|
|
2016-12-06 09:02:51 +08:00
|
|
|
; SI: buffer_store_short v[[A_F16]]
|
|
|
|
; SI: s_endpgm
|
|
|
|
|
2017-01-31 00:57:41 +08:00
|
|
|
|
|
|
|
; GCN: two{{$}}
|
|
|
|
; SI: v_cvt_f16_f32_e32 v[[B_F16:[0-9]+]], v[[B_F32]]
|
|
|
|
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @br_cc_f16_imm_a(
|
2016-11-17 11:49:01 +08:00
|
|
|
half addrspace(1)* %r,
|
|
|
|
half addrspace(1)* %b) {
|
|
|
|
entry:
|
|
|
|
%b.val = load half, half addrspace(1)* %b
|
|
|
|
%fcmp = fcmp olt half 0xH3800, %b.val
|
|
|
|
br i1 %fcmp, label %one, label %two
|
|
|
|
|
|
|
|
one:
|
|
|
|
store half 0xH3800, half addrspace(1)* %r
|
|
|
|
ret void
|
|
|
|
|
|
|
|
two:
|
|
|
|
store half %b.val, half addrspace(1)* %r
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2017-01-31 00:57:41 +08:00
|
|
|
; GCN-LABEL: {{^}}br_cc_f16_imm_b:
|
2016-11-17 11:49:01 +08:00
|
|
|
; GCN: buffer_load_ushort v[[A_F16:[0-9]+]]
|
|
|
|
|
|
|
|
; SI: v_cvt_f32_f16_e32 v[[A_F32:[0-9]+]], v[[A_F16]]
|
2017-01-31 00:57:41 +08:00
|
|
|
; SI: v_cmp_ngt_f32_e32 vcc, 0.5, v[[A_F32]]
|
|
|
|
|
2016-12-10 08:39:12 +08:00
|
|
|
; VI: v_cmp_ngt_f16_e32 vcc, 0.5, v[[A_F16]]
|
2016-11-17 11:49:01 +08:00
|
|
|
; GCN: s_cbranch_vccnz
|
|
|
|
|
|
|
|
; GCN: one{{$}}
|
|
|
|
; SI: v_cvt_f16_f32_e32 v[[A_F16:[0-9]+]], v[[A_F32]]
|
|
|
|
|
|
|
|
; GCN: two{{$}}
|
|
|
|
; VI: v_mov_b32_e32 v[[B_F16:[0-9]+]], 0x3800{{$}}
|
|
|
|
; GCN: buffer_store_short v[[B_F16]]
|
|
|
|
; GCN: s_endpgm
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @br_cc_f16_imm_b(
|
2016-11-17 11:49:01 +08:00
|
|
|
half addrspace(1)* %r,
|
|
|
|
half addrspace(1)* %a) {
|
|
|
|
entry:
|
|
|
|
%a.val = load half, half addrspace(1)* %a
|
|
|
|
%fcmp = fcmp olt half %a.val, 0xH3800
|
|
|
|
br i1 %fcmp, label %one, label %two
|
|
|
|
|
|
|
|
one:
|
|
|
|
store half %a.val, half addrspace(1)* %r
|
|
|
|
ret void
|
|
|
|
|
|
|
|
two:
|
|
|
|
store half 0xH3800, half addrspace(1)* %r
|
|
|
|
ret void
|
|
|
|
}
|