Skip to content

Commit 723a53c

Browse files
committed
[AMDGPU] Avoid constant bus limitation on V_BFE GISel pattern
For D141247 - if that pattern was used by GISel it could cause constant bus limitation failures. Just use inline immediates instead of S_MOV to avoid the issue. Reviewed By: arsenm Differential Revision: https://reviews.llvm.org/D146131
1 parent 93b89be commit 723a53c

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

llvm/lib/Target/AMDGPU/VOP3Instructions.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ let SchedRW = [Write64Bit] in {
263263

264264
def : GCNPat<
265265
(i32 (DivergentUnaryFrag<sext> i16:$src)),
266-
(i32 (V_BFE_I32_e64 $src, (S_MOV_B32 (i32 0)), (S_MOV_B32 (i32 0x10))))
266+
(i32 (V_BFE_I32_e64 i16:$src, (i32 0), (i32 0x10)))
267267
>;
268268

269269
let isReMaterializable = 1 in {
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2+
; RUN: llc -mtriple=amdgcn-amd-amdhsa --global-isel -verify-machineinstrs < %s | FileCheck --check-prefix=PREGFX9 %s
3+
; RUN: llc -mtriple=amdgcn-amd-amdhsa --global-isel -mcpu=hawaii -verify-machineinstrs < %s | FileCheck --check-prefix=PREGFX9 %s
4+
; RUN: llc -mtriple=amdgcn-amd-amdhsa --global-isel -mcpu=fiji -verify-machineinstrs < %s | FileCheck --check-prefix=PREGFX9 %s
5+
; RUN: llc -mtriple=amdgcn-amd-amdhsa --global-isel -mcpu=gfx90a -verify-machineinstrs < %s | FileCheck --check-prefix=PREGFX9 %s
6+
; RUN: llc -mtriple=amdgcn-amd-amdhsa --global-isel -mcpu=gfx1030 -verify-machineinstrs < %s | FileCheck --check-prefix=GFX10PLUS %s
7+
; RUN: llc -mtriple=amdgcn-amd-amdhsa --global-isel -mcpu=gfx1100 -verify-machineinstrs < %s | FileCheck --check-prefix=GFX10PLUS %s
8+
9+
define i32 @check_v_bfe(i16 %a) {
10+
; PREGFX9-LABEL: check_v_bfe:
11+
; PREGFX9: ; %bb.0: ; %entry
12+
; PREGFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13+
; PREGFX9-NEXT: v_bfe_i32 v0, v0, 0, 16
14+
; PREGFX9-NEXT: s_setpc_b64 s[30:31]
15+
;
16+
; GFX10PLUS-LABEL: check_v_bfe:
17+
; GFX10PLUS: ; %bb.0: ; %entry
18+
; GFX10PLUS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
19+
; GFX10PLUS-NEXT: s_waitcnt_vscnt null, 0x0
20+
; GFX10PLUS-NEXT: v_bfe_i32 v0, v0, 0, 16
21+
; GFX10PLUS-NEXT: s_setpc_b64 s[30:31]
22+
entry:
23+
%res = sext i16 %a to i32
24+
ret i32 %res
25+
}

0 commit comments

Comments
 (0)