mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 20:32:21 +00:00
R600/SI: Handle INSERT_SUBREG in SIFixSGPRCopies
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205732 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
5c9bb7119a
commit
1d8c7eb225
@ -256,6 +256,16 @@ bool SIFixSGPRCopies::runOnMachineFunction(MachineFunction &MF) {
|
||||
TII->moveToVALU(MI);
|
||||
break;
|
||||
}
|
||||
case AMDGPU::INSERT_SUBREG: {
|
||||
const TargetRegisterClass *DstRC, *SrcRC;
|
||||
DstRC = MRI.getRegClass(MI.getOperand(0).getReg());
|
||||
SrcRC = MRI.getRegClass(MI.getOperand(1).getReg());
|
||||
if (!TRI->isSGPRClass(DstRC) || !TRI->hasVGPRs(SrcRC))
|
||||
break;
|
||||
DEBUG(dbgs() << " Fixing INSERT_SUBREG:\n");
|
||||
DEBUG(MI.print(dbgs()));
|
||||
TII->moveToVALU(MI);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -516,6 +516,7 @@ unsigned SIInstrInfo::getVALUOp(const MachineInstr &MI) {
|
||||
case AMDGPU::REG_SEQUENCE: return AMDGPU::REG_SEQUENCE;
|
||||
case AMDGPU::COPY: return AMDGPU::COPY;
|
||||
case AMDGPU::PHI: return AMDGPU::PHI;
|
||||
case AMDGPU::INSERT_SUBREG: return AMDGPU::INSERT_SUBREG;
|
||||
case AMDGPU::S_MOV_B32:
|
||||
return MI.getOperand(1).isReg() ?
|
||||
AMDGPU::COPY : AMDGPU::V_MOV_B32_e32;
|
||||
@ -996,6 +997,7 @@ void SIInstrInfo::moveToVALU(MachineInstr &TopInst) const {
|
||||
case AMDGPU::COPY:
|
||||
case AMDGPU::PHI:
|
||||
case AMDGPU::REG_SEQUENCE:
|
||||
case AMDGPU::INSERT_SUBREG:
|
||||
if (RI.hasVGPRs(NewDstRC))
|
||||
continue;
|
||||
NewDstRC = RI.getEquivalentVGPRClass(NewDstRC);
|
||||
|
@ -173,3 +173,29 @@ define void @dynamic_insertelement_v16i8(<16 x i8> addrspace(1)* %out, <16 x i8>
|
||||
store <16 x i8> %vecins, <16 x i8> addrspace(1)* %out, align 16
|
||||
ret void
|
||||
}
|
||||
|
||||
; This test requires handling INSERT_SUBREG in SIFixSGPRCopies. Check that
|
||||
; the compiler doesn't crash.
|
||||
; SI-LABEL: @insert_split_bb
|
||||
define void @insert_split_bb(<2 x i32> addrspace(1)* %out, i32 addrspace(1)* %in, i32 %a, i32 %b) {
|
||||
entry:
|
||||
%0 = insertelement <2 x i32> undef, i32 %a, i32 0
|
||||
%1 = icmp eq i32 %a, 0
|
||||
br i1 %1, label %if, label %else
|
||||
|
||||
if:
|
||||
%2 = load i32 addrspace(1)* %in
|
||||
%3 = insertelement <2 x i32> %0, i32 %2, i32 1
|
||||
br label %endif
|
||||
|
||||
else:
|
||||
%4 = getelementptr i32 addrspace(1)* %in, i32 1
|
||||
%5 = load i32 addrspace(1)* %4
|
||||
%6 = insertelement <2 x i32> %0, i32 %5, i32 1
|
||||
br label %endif
|
||||
|
||||
endif:
|
||||
%7 = phi <2 x i32> [%3, %if], [%6, %else]
|
||||
store <2 x i32> %7, <2 x i32> addrspace(1)* %out
|
||||
ret void
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user