[PATCH] D12221: [RFC] Introduce `__attribute__((nontemporal))`.

Michael Zolotukhin via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 20 18:39:56 PDT 2015


mzolotukhin created this revision.
mzolotukhin added reviewers: hfinkel, doug.gregor, t.p.northover, ab, mcrosier.
mzolotukhin added a subscriber: cfe-commits.
Herald added a subscriber: aemerson.

Currently there is no way to generate nontemporal memory accesses for some
architectures, e.g. for AArch64. In contrast to x86, it doesn't have special
intrinsics for this, and the suggested solution is using such attribute (see ARM
ACLE 2.0, section 13.1.6). The attribute would result in generating
'!nontemporal' attribute in IR, which then will (hopefully) live through
optimizations till backend, where it will be lowered to a non-temporal
instruction (for AArch64 - to STNP). I have committed a couple of patches for
vectorizers to preserve this attribute, and it seems that no other
transformation removes it.

So, is introducing a new type attribute a right approach for this problem?

Also, since I don't have much experience in front-end, I'd appreciate any help
with the patch itself to get it ready to be committed. Specifically, I currently
have following questions:
1) What tests should I add (examples would be appreciated)?
2) How does one implements constraints on how the attribute can be used, what
should be the constraints in this case, and how to properly implement them?
3) How can I check if I covered all places where this attribute might be used in
codegen? I.e. I seem to cover array-subscript and pointer-dereference
expressions, which is probaly the only cases I care about, but I easily could
miss something.

Any other feedback is also welcome!

Thanks,
Michael

http://reviews.llvm.org/D12221

Files:
  include/clang/AST/Type.h
  include/clang/Basic/Attr.td
  lib/AST/Type.cpp
  lib/AST/TypePrinter.cpp
  lib/CodeGen/CGExpr.cpp
  lib/CodeGen/CGValue.h
  lib/CodeGen/CodeGenFunction.cpp
  lib/CodeGen/CodeGenFunction.h
  lib/Sema/SemaType.cpp
  test/CodeGen/nontemporal.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12221.32782.patch
Type: text/x-patch
Size: 17064 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150821/2d714117/attachment.bin>


More information about the cfe-commits mailing list