• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefix=CHECK %s
2
3;CHECK-LABEL: {{^}}ret:
4;CHECK: v_cmp_eq_u32_e32 [[CMP:[^,]+]], v0, v1
5;CHECK: s_wqm_b64 [[WQM:[^,]+]], [[CMP]]
6;CHECK: v_cndmask_b32_e64 v0, 0, 1.0, [[WQM]]
7define amdgpu_ps float @ret(i32 %v0, i32 %v1) #1 {
8main_body:
9  %c = icmp eq i32 %v0, %v1
10  %w = call i1 @llvm.amdgcn.wqm.vote(i1 %c)
11  %r = select i1 %w, float 1.0, float 0.0
12  ret float %r
13}
14
15;CHECK-LABEL: {{^}}true:
16;CHECK: s_wqm_b64
17define amdgpu_ps float @true() #1 {
18main_body:
19  %w = call i1 @llvm.amdgcn.wqm.vote(i1 true)
20  %r = select i1 %w, float 1.0, float 0.0
21  ret float %r
22}
23
24;CHECK-LABEL: {{^}}false:
25;CHECK: s_wqm_b64
26define amdgpu_ps float @false() #1 {
27main_body:
28  %w = call i1 @llvm.amdgcn.wqm.vote(i1 false)
29  %r = select i1 %w, float 1.0, float 0.0
30  ret float %r
31}
32
33;CHECK-LABEL: {{^}}kill:
34;CHECK: v_cmp_eq_u32_e32 [[CMP:[^,]+]], v0, v1
35;CHECK: s_wqm_b64 [[WQM:[^,]+]], [[CMP]]
36;FIXME: This could just be: s_and_b64 exec, exec, [[WQM]]
37;CHECK: v_cndmask_b32_e64 [[KILL:[^,]+]], -1.0, 1.0, [[WQM]]
38;CHECK: v_cmpx_le_f32_e32 {{[^,]+}}, 0, [[KILL]]
39;CHECK: s_endpgm
40define amdgpu_ps void @kill(i32 %v0, i32 %v1) #1 {
41main_body:
42  %c = icmp eq i32 %v0, %v1
43  %w = call i1 @llvm.amdgcn.wqm.vote(i1 %c)
44  %r = select i1 %w, float 1.0, float -1.0
45  call void @llvm.AMDGPU.kill(float %r)
46  ret void
47}
48
49declare void @llvm.AMDGPU.kill(float) #1
50declare i1 @llvm.amdgcn.wqm.vote(i1)
51
52attributes #1 = { nounwind }
53