OSDN Git Service

[AMDGPU] SDWA Peephole: improve search for immediates in SDWA patterns
authorSam Kolton <Sam.Kolton@amd.com>
Fri, 31 Mar 2017 11:42:43 +0000 (11:42 +0000)
committerSam Kolton <Sam.Kolton@amd.com>
Fri, 31 Mar 2017 11:42:43 +0000 (11:42 +0000)
commitff45a1818902e252d030482f44e5f9650fb7281f
tree522bd33eaab1ecf60a4e3e8a5461ccf9abc87edd
parent07898901dfc65b74a18c87596557a212be6013ef
[AMDGPU] SDWA Peephole: improve search for immediates in SDWA patterns

Previously compiler often extracted common immediates into specific register, e.g.:
```
%vreg0 = S_MOV_B32 0xff;
%vreg2 = V_AND_B32_e32 %vreg0, %vreg1
%vreg4 = V_AND_B32_e32 %vreg0, %vreg3
```
Because of this SDWA peephole failed to find SDWA convertible pattern. E.g. in previous example this could be converted into 2 SDWA src operands:
```
SDWA src: %vreg2 src_sel:BYTE_0
SDWA src: %vreg4 src_sel:BYTE_0
```
With this change peephole check if operand is either immediate or register that is copy of immediate.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299202 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/AMDGPU/SIFoldOperands.cpp
lib/Target/AMDGPU/SIInstrInfo.cpp
lib/Target/AMDGPU/SIInstrInfo.h
lib/Target/AMDGPU/SIPeepholeSDWA.cpp
test/CodeGen/AMDGPU/sdwa-peephole.ll