Skip to content

Commit 02279b4

Browse files
committed
fixup! [AMDGPU] Add mir test that demonstrates wrong SDWA selection
1 parent 3236473 commit 02279b4

File tree

1 file changed

+30
-5
lines changed

1 file changed

+30
-5
lines changed

llvm/test/CodeGen/AMDGPU/sdwa-peephole-instr-combine-sel.mir

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,37 @@
1-
# RUN: llc -mtriple=amdgcn -mcpu=gfx1030 -run-pass=si-peephole-sdwa -o - %s | FileCheck -check-prefix=NOHAZARD %s
1+
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 5
2+
# RUN: llc -mtriple=amdgcn -mcpu=gfx1030 -run-pass=si-peephole-sdwa -o - %s | FileCheck -check-prefix=CHECK %s
3+
4+
# Currently the conversions in si-peephole-sdwa are disabled on preexisting sdwa instructions.
5+
# If they are reenabled, the code matches this pattern instead of the corresponding pattern
6+
# for V_LSHLREV_B32_sdwa further below:
7+
# [[V_LSHLREV_B32_sdwa:%[0-9]+]]:vgpr_32 = V_LSHLREV_B32_sdwa 0, %{{[0-9]+}}, 0, undef [[GLOBAL_LOAD_DWORD_SADDR]], 0, 6, 0, 6, 5, implicit $exec
8+
9+
# TODO Implement a fix for the incorrect sdwa selection
210

311
---
412
name: sdwa_opsel_hazard
513
body: |
6-
; NOHAZARD-LABEL: name: sdwa_opsel_hazard
7-
8-
; NOHAZARD: [[GLOBAL_LOAD_DWORD_SADDR:%[0-9]+]]:vgpr_32 = GLOBAL_LOAD_DWORD_SADDR killed %{{[0-9]+}}, %{{[0-9]+}}, 0, 0, implicit $exec
9-
; NOHAZARD: [[V_LSHLREV_B32_sdwa:%[0-9]+]]:vgpr_32 = V_LSHLREV_B32_sdwa 0, %{{[0-9]+}}, 0, undef [[GLOBAL_LOAD_DWORD_SADDR]], 0, 6, 0, 6, 5, implicit $exec
14+
; CHECK-LABEL: name: sdwa_opsel_hazard
15+
; CHECK: bb.0:
16+
; CHECK-NEXT: successors: %bb.2(0x80000000)
17+
; CHECK-NEXT: {{ $}}
18+
; CHECK-NEXT: [[DEF:%[0-9]+]]:sreg_32 = IMPLICIT_DEF
19+
; CHECK-NEXT: [[DEF1:%[0-9]+]]:sreg_64_xexec_xnull = IMPLICIT_DEF
20+
; CHECK-NEXT: [[DEF2:%[0-9]+]]:vgpr_32 = IMPLICIT_DEF
21+
; CHECK-NEXT: [[GLOBAL_LOAD_DWORD_SADDR:%[0-9]+]]:vgpr_32 = GLOBAL_LOAD_DWORD_SADDR killed [[DEF1]], [[DEF2]], 0, 0, implicit $exec
22+
; CHECK-NEXT: S_BRANCH %bb.2
23+
; CHECK-NEXT: {{ $}}
24+
; CHECK-NEXT: bb.1:
25+
; CHECK-NEXT: [[V_AND_B32_e64_:%[0-9]+]]:vgpr_32 = V_AND_B32_e64 undef %5, 255, implicit $exec
26+
; CHECK-NEXT: [[V_MOV_B32_e32_:%[0-9]+]]:vgpr_32 = V_MOV_B32_e32 2, implicit $exec
27+
; CHECK-NEXT: [[V_LSHLREV_B32_sdwa:%[0-9]+]]:vgpr_32 = V_LSHLREV_B32_sdwa 0, [[V_MOV_B32_e32_]], 0, undef %5, 0, 6, 0, 6, 0, implicit $exec
28+
; CHECK-NEXT: S_ENDPGM 0
29+
; CHECK-NEXT: {{ $}}
30+
; CHECK-NEXT: bb.2:
31+
; CHECK-NEXT: successors: %bb.1(0x80000000)
32+
; CHECK-NEXT: {{ $}}
33+
; CHECK-NEXT: [[V_LSHRREV_B32_e64_:%[0-9]+]]:vgpr_32 = V_LSHRREV_B32_e64 16, undef [[GLOBAL_LOAD_DWORD_SADDR]], implicit $exec
34+
; CHECK-NEXT: S_BRANCH %bb.1
1035
bb.0:
1136
successors: %bb.2(0x40000000)
1237
%0:sreg_32 = IMPLICIT_DEF

0 commit comments

Comments
 (0)