mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 20:32:21 +00:00
R600/SI: Fix broken encoding of DS_WRITE_B32
The logic in SIInsertWaits::getHwCounts() only really made sense for SMRD instructions, and trying to shoehorn it into handling DS_WRITE_B32 caused it to corrupt the encoding of that by clobbering the first operand with the second one. Undo that damage and only apply the SMRD logic to that. Fixes some derivates related piglit regressions with radeonsi. Reviewed-by: Tom Stellard <thomas.stellard@amd.com> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188558 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ea549a847d
commit
ebd4eec538
@ -13,7 +13,8 @@
|
|||||||
|
|
||||||
namespace SIInstrFlags {
|
namespace SIInstrFlags {
|
||||||
enum {
|
enum {
|
||||||
MIMG = 1 << 3
|
MIMG = 1 << 3,
|
||||||
|
SMRD = 1 << 4
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,14 +134,19 @@ Counters SIInsertWaits::getHwCounts(MachineInstr &MI) {
|
|||||||
// LGKM may uses larger values
|
// LGKM may uses larger values
|
||||||
if (TSFlags & SIInstrFlags::LGKM_CNT) {
|
if (TSFlags & SIInstrFlags::LGKM_CNT) {
|
||||||
|
|
||||||
MachineOperand &Op = MI.getOperand(0);
|
if (TII->isSMRD(MI.getOpcode())) {
|
||||||
if (!Op.isReg())
|
|
||||||
Op = MI.getOperand(1);
|
|
||||||
assert(Op.isReg() && "First LGKM operand must be a register!");
|
|
||||||
|
|
||||||
unsigned Reg = Op.getReg();
|
MachineOperand &Op = MI.getOperand(0);
|
||||||
unsigned Size = TRI->getMinimalPhysRegClass(Reg)->getSize();
|
assert(Op.isReg() && "First LGKM operand must be a register!");
|
||||||
Result.Named.LGKM = Size > 4 ? 2 : 1;
|
|
||||||
|
unsigned Reg = Op.getReg();
|
||||||
|
unsigned Size = TRI->getMinimalPhysRegClass(Reg)->getSize();
|
||||||
|
Result.Named.LGKM = Size > 4 ? 2 : 1;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// DS
|
||||||
|
Result.Named.LGKM = 1;
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Result.Named.LGKM = 0;
|
Result.Named.LGKM = 0;
|
||||||
|
@ -18,11 +18,13 @@ class InstSI <dag outs, dag ins, string asm, list<dag> pattern> :
|
|||||||
field bits<1> EXP_CNT = 0;
|
field bits<1> EXP_CNT = 0;
|
||||||
field bits<1> LGKM_CNT = 0;
|
field bits<1> LGKM_CNT = 0;
|
||||||
field bits<1> MIMG = 0;
|
field bits<1> MIMG = 0;
|
||||||
|
field bits<1> SMRD = 0;
|
||||||
|
|
||||||
let TSFlags{0} = VM_CNT;
|
let TSFlags{0} = VM_CNT;
|
||||||
let TSFlags{1} = EXP_CNT;
|
let TSFlags{1} = EXP_CNT;
|
||||||
let TSFlags{2} = LGKM_CNT;
|
let TSFlags{2} = LGKM_CNT;
|
||||||
let TSFlags{3} = MIMG;
|
let TSFlags{3} = MIMG;
|
||||||
|
let TSFlags{4} = SMRD;
|
||||||
}
|
}
|
||||||
|
|
||||||
class Enc32 <dag outs, dag ins, string asm, list<dag> pattern> :
|
class Enc32 <dag outs, dag ins, string asm, list<dag> pattern> :
|
||||||
@ -142,6 +144,7 @@ class SMRD <bits<5> op, bits<1> imm, dag outs, dag ins, string asm,
|
|||||||
let Inst{31-27} = 0x18; //encoding
|
let Inst{31-27} = 0x18; //encoding
|
||||||
|
|
||||||
let LGKM_CNT = 1;
|
let LGKM_CNT = 1;
|
||||||
|
let SMRD = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
@ -229,6 +229,10 @@ int SIInstrInfo::isMIMG(uint16_t Opcode) const {
|
|||||||
return get(Opcode).TSFlags & SIInstrFlags::MIMG;
|
return get(Opcode).TSFlags & SIInstrFlags::MIMG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int SIInstrInfo::isSMRD(uint16_t Opcode) const {
|
||||||
|
return get(Opcode).TSFlags & SIInstrFlags::SMRD;
|
||||||
|
}
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// Indirect addressing callbacks
|
// Indirect addressing callbacks
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
@ -48,6 +48,7 @@ public:
|
|||||||
|
|
||||||
virtual bool isSafeToMoveRegClassDefs(const TargetRegisterClass *RC) const;
|
virtual bool isSafeToMoveRegClassDefs(const TargetRegisterClass *RC) const;
|
||||||
int isMIMG(uint16_t Opcode) const;
|
int isMIMG(uint16_t Opcode) const;
|
||||||
|
int isSMRD(uint16_t Opcode) const;
|
||||||
|
|
||||||
virtual int getIndirectIndexBegin(const MachineFunction &MF) const;
|
virtual int getIndirectIndexBegin(const MachineFunction &MF) const;
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
; SI-CHECK-NEXT: .long 32768
|
; SI-CHECK-NEXT: .long 32768
|
||||||
|
|
||||||
; EG-CHECK: LDS_WRITE
|
; EG-CHECK: LDS_WRITE
|
||||||
; SI-CHECK: DS_WRITE_B32
|
; SI-CHECK: DS_WRITE_B32 0
|
||||||
|
|
||||||
; GROUP_BARRIER must be the last instruction in a clause
|
; GROUP_BARRIER must be the last instruction in a clause
|
||||||
; EG-CHECK: GROUP_BARRIER
|
; EG-CHECK: GROUP_BARRIER
|
||||||
@ -21,7 +21,7 @@
|
|||||||
; SI-CHECK: S_BARRIER
|
; SI-CHECK: S_BARRIER
|
||||||
|
|
||||||
; EG-CHECK: LDS_READ_RET
|
; EG-CHECK: LDS_READ_RET
|
||||||
; SI-CHECK: DS_READ_B32
|
; SI-CHECK: DS_READ_B32 {{VGPR[0-9]+}}, 0
|
||||||
|
|
||||||
define void @local_memory(i32 addrspace(1)* %out) {
|
define void @local_memory(i32 addrspace(1)* %out) {
|
||||||
entry:
|
entry:
|
||||||
|
Loading…
Reference in New Issue
Block a user