radeonsi: Implement ddx/ddy on VI using ds_bpermute
The ds_bpermute instruction allows threads to transfer data directly
to or from the vgprs of other threads. These instructions use the LDS
hardware to transfer data, but do not read or write LDS memory.
DDX BEFORE: | DDX AFTER:
|
v_mbcnt_lo_u32_b32_e64 v2, -1, 0 | v_mbcnt_lo_u32_b32_e64 v2, -1, 0
v_mbcnt_hi_u32_b32_e64 v2, -1, v2 | v_mbcnt_hi_u32_b32_e64 v2, -1, v2
v_lshlrev_b32_e32 v4, 2, v2 | v_and_b32_e32 v2, 60, v2
v_and_b32_e32 v2, 60, v2 | v_lshlrev_b32_e32 v2, 2, v2
v_lshlrev_b32_e32 v3, 2, v2 | ds_bpermute_b32 v3, v2, v0
s_mov_b32 m0, -1 | ds_bpermute_b32 v0, v2, v0 offset:4
ds_write_b32 v4, v0 | s_waitcnt lgkmcnt(0)
s_waitcnt lgkmcnt(0) |
v_or_b32_e32 v0, 1, v2 |
v_lshlrev_b32_e32 v0, 2, v0 |
ds_read_b32 v1, v3 |
ds_read_b32 v0, v0 |
s_waitcnt lgkmcnt(0) |
|
LDS: 1 blocks | LDS: 0 blocks
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Acked-by: Marek Olšák <marek.olsak@amd.com>