AMDGPU: Legalize/regbankselect frame_index

llvm-svn: 349468
This commit is contained in:
Matt Arsenault 2018-12-18 09:46:13 +00:00
parent c0ea221068
commit c94e26c71d
3 changed files with 26 additions and 0 deletions

View File

@ -90,6 +90,8 @@ AMDGPULegalizerInfo::AMDGPULegalizerInfo(const GCNSubtarget &ST,
// between these two scenarios. // between these two scenarios.
setAction({G_CONSTANT, S1}, Legal); setAction({G_CONSTANT, S1}, Legal);
setAction({G_FRAME_INDEX, PrivatePtr}, Legal);
getActionDefinitionsBuilder( getActionDefinitionsBuilder(
{ G_FADD, G_FMUL, G_FNEG, G_FABS, G_FMA}) { G_FADD, G_FMUL, G_FNEG, G_FABS, G_FMA})
.legalFor({S32, S64}); .legalFor({S32, S64});

View File

@ -366,6 +366,7 @@ AMDGPURegisterBankInfo::getInstrMapping(const MachineInstr &MI) const {
} }
case AMDGPU::G_FCONSTANT: case AMDGPU::G_FCONSTANT:
case AMDGPU::G_CONSTANT: case AMDGPU::G_CONSTANT:
case AMDGPU::G_FRAME_INDEX:
case AMDGPU::G_BLOCK_ADDR: { case AMDGPU::G_BLOCK_ADDR: {
unsigned Size = MRI.getType(MI.getOperand(0).getReg()).getSizeInBits(); unsigned Size = MRI.getType(MI.getOperand(0).getReg()).getSizeInBits();
OpdsMapping[0] = AMDGPU::getValueMapping(AMDGPU::SGPRRegBankID, Size); OpdsMapping[0] = AMDGPU::getValueMapping(AMDGPU::SGPRRegBankID, Size);

View File

@ -0,0 +1,23 @@
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -march=amdgcn -mcpu=fiji -run-pass=regbankselect %s -verify-machineinstrs -o - -regbankselect-fast | FileCheck %s
# RUN: llc -march=amdgcn -mcpu=fiji -run-pass=regbankselect %s -verify-machineinstrs -o - -regbankselect-greedy | FileCheck %s
--- |
target datalayout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5"
define void @test_frame_index_p5() {
%ptr0 = alloca i32, addrspace(5)
ret void
}
...
---
name: test_frame_index_p5
legalized: true
stack:
- { id: 0, name: ptr0, offset: 0, size: 4, alignment: 4 }
body: |
bb.0:
; CHECK-LABEL: name: test_frame_index_p5
; CHECK: [[FRAME_INDEX:%[0-9]+]]:sgpr(p5) = G_FRAME_INDEX %stack.0.ptr0
%0:_(p5) = G_FRAME_INDEX %stack.0.ptr0
...