Skip to content

Commit

Permalink
AMDGPU/GlobalISel: Select llvm.amdgcn.wqm.vote
Browse files Browse the repository at this point in the history
  • Loading branch information
arsenm committed Jan 7, 2020
1 parent e130eef commit 9150d6b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
4 changes: 2 additions & 2 deletions llvm/lib/Target/AMDGPU/SOPInstructions.td
Expand Up @@ -170,14 +170,14 @@ let Defs = [SCC] in {
let WaveSizePredicate = isWave32 in {
def : GCNPat <
(int_amdgcn_wqm_vote i1:$src0),
(S_WQM_B32 $src0)
(S_WQM_B32 SSrc_b32:$src0)
>;
}

let WaveSizePredicate = isWave64 in {
def : GCNPat <
(int_amdgcn_wqm_vote i1:$src0),
(S_WQM_B64 $src0)
(S_WQM_B64 SSrc_b64:$src0)
>;
}

Expand Down
3 changes: 3 additions & 0 deletions llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.wqm.vote.ll
@@ -0,0 +1,3 @@
; Runs original SDAG test with -global-isel
; RUN: llc -global-isel -march=amdgcn -mcpu=tonga -verify-machineinstrs < %S/../llvm.amdgcn.wqm.vote.ll | FileCheck -enable-var-scope -check-prefixes=CHECK,WAVE64 %S/../llvm.amdgcn.wqm.vote.ll
; RUN: llc -global-isel -march=amdgcn -mcpu=gfx1010 -verify-machineinstrs < %S/../llvm.amdgcn.wqm.vote.ll | FileCheck -enable-var-scope -check-prefixes=CHECK,WAVE32 %S/../llvm.amdgcn.wqm.vote.ll
21 changes: 15 additions & 6 deletions llvm/test/CodeGen/AMDGPU/llvm.amdgcn.wqm.vote.ll
@@ -1,8 +1,10 @@
; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefix=CHECK %s
; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefixes=CHECK,WAVE64 %s
; RUN: llc -march=amdgcn -mcpu=gfx1010 -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefixes=CHECK,WAVE32 %s

;CHECK-LABEL: {{^}}ret:
;CHECK: v_cmp_eq_u32_e32 [[CMP:[^,]+]], v0, v1
;CHECK: s_wqm_b64 [[WQM:[^,]+]], [[CMP]]
;WAVE64: s_wqm_b64 [[WQM:[^,]+]], [[CMP]]
;WAVE32: s_wqm_b32 [[WQM:[^,]+]], [[CMP]]
;CHECK: v_cndmask_b32_e64 v0, 0, 1.0, [[WQM]]
define amdgpu_ps float @ret(i32 %v0, i32 %v1) #1 {
main_body:
Expand All @@ -13,7 +15,8 @@ main_body:
}

;CHECK-LABEL: {{^}}true:
;CHECK: s_wqm_b64
;WAVE64: s_wqm_b64
;WAVE32: s_wqm_b32
define amdgpu_ps float @true() #1 {
main_body:
%w = call i1 @llvm.amdgcn.wqm.vote(i1 true)
Expand All @@ -22,7 +25,8 @@ main_body:
}

;CHECK-LABEL: {{^}}false:
;CHECK: s_wqm_b64
;WAVE64: s_wqm_b64
;WAVE32: s_wqm_b32
define amdgpu_ps float @false() #1 {
main_body:
%w = call i1 @llvm.amdgcn.wqm.vote(i1 false)
Expand All @@ -32,8 +36,13 @@ main_body:

;CHECK-LABEL: {{^}}kill:
;CHECK: v_cmp_eq_u32_e32 [[CMP:[^,]+]], v0, v1
;CHECK: s_wqm_b64 [[WQM:[^,]+]], [[CMP]]
;CHECK: s_and_b64 exec, exec, [[WQM]]

;WAVE64: s_wqm_b64 [[WQM:[^,]+]], [[CMP]]
;WAVE64: s_and_b64 exec, exec, [[WQM]]

;WAVE32: s_wqm_b32 [[WQM:[^,]+]], [[CMP]]
;WAVE32: s_and_b32 exec_lo, exec_lo, [[WQM]]

;CHECK: s_endpgm
define amdgpu_ps void @kill(i32 %v0, i32 %v1) #1 {
main_body:
Expand Down

0 comments on commit 9150d6b

Please sign in to comment.