-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update P7 32-bit partial vector load cost #108261
Changes from 4 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -802,12 +802,18 @@ InstructionCost PPCTTIImpl::getMemoryOpCost(unsigned Opcode, Type *Src, | |
// explicitly check this case. There are also corresponding store | ||
// instructions. | ||
unsigned MemBytes = Src->getPrimitiveSizeInBits(); | ||
if (ST->hasVSX() && IsAltivecType && | ||
(MemBytes == 64 || (ST->hasP8Vector() && MemBytes == 32))) | ||
return 1; | ||
unsigned SrcBytes = LT.second.getStoreSize(); | ||
if (ST->hasVSX() && IsAltivecType) { | ||
if (MemBytes == 64 || (ST->hasP8Vector() && MemBytes == 32)) | ||
return 1; | ||
|
||
// Use lfiwax/xxspltw | ||
Align AlignBytes = Alignment ? *Alignment : Align(1); | ||
if (Opcode == Instruction::Load && MemBytes == 32 && AlignBytes < SrcBytes) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am curious that why need the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If a partial vector (< 128 bits) is being loaded with a full vector aligned address (>= 128 bits), the load will be done as a full vector load since we know from alignment that it is safe. Therefore the cost of a partial vector load does not apply. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks for explaining. |
||
return 2; | ||
} | ||
|
||
// Aligned loads and stores are easy. | ||
unsigned SrcBytes = LT.second.getStoreSize(); | ||
if (!SrcBytes || !Alignment || *Alignment >= SrcBytes) | ||
return Cost; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: this maybe not related to the patch,
I think the variable
MemBytes
should beMemBits
, otherwise it maybe cause mis_understand (it looks like compare with 64bytes and 32bytes)if (MemBytes == 64 || (ST->hasP8Vector() && MemBytes == 32))
I think we can modify the variable name in the patch by the way?