This is an archive of the discontinued LLVM Phabricator instance.

[X86][2/2] Support PREFETCHI instructions
AbandonedPublic

Authored by pengfei on Oct 18 2022, 4:04 AM.

Details

Summary

Optimize prefetchit0/1 to prefetcht0/1 for non-rip address

For more details about these instructions, please refer to the latest ISE document: https://www.intel.com/content/www/us/en/develop/download/intel-architecture-instruction-set-extensions-programming-reference.html

Diff Detail

Unit TestsFailed

Event Timeline

pengfei created this revision.Oct 18 2022, 4:04 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 18 2022, 4:04 AM
pengfei requested review of this revision.Oct 18 2022, 4:04 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 18 2022, 4:04 AM
LuoYuanke added inline comments.Oct 18 2022, 5:09 AM
llvm/lib/Target/X86/X86ISelLowering.cpp
36838

It seems morph code prefetch to data prefetch. Does it help performance? I'm sure about the cache hierarchy. Which cache level is shared between code cache and data cache?

pengfei added inline comments.Oct 18 2022, 5:23 AM
llvm/lib/Target/X86/X86ISelLowering.cpp
36838

I assume data prefetch is better than nop. We also use data prefetch to replace when PREFETCHI is not available.

craig.topper added inline comments.Oct 19 2022, 2:26 PM
llvm/lib/Target/X86/X86ISelLowering.cpp
36839

Can we call setDesc instead of copying the operands?

Matt added a subscriber: Matt.Oct 19 2022, 5:12 PM
pengfei updated this revision to Diff 469101.Oct 19 2022, 7:04 PM

Rebase and address comments.

llvm/lib/Target/X86/X86ISelLowering.cpp
36839

Yeah, setDesc is perfect, thanks!

RKSimon accepted this revision.Oct 20 2022, 7:26 AM

LGTM - cheers

llvm/lib/Target/X86/X86ISelLowering.cpp
36986

A comment might be nice :)

This revision is now accepted and ready to land.Oct 20 2022, 7:26 AM
pengfei updated this revision to Diff 469235.Oct 20 2022, 7:59 AM
pengfei marked an inline comment as done.

Add comment.

goldstein.w.n added inline comments.
llvm/lib/Target/X86/X86ISelLowering.cpp
36987

Is this actually an optimization? IIRC there are some micro-arch where data can't both be in icache and dcache so this might have a flushing affect.

pengfei abandoned this revision.May 21 2023, 5:57 PM

Abandon this. The problem has been solved by D142797.