[PATCH] D83079: [clang][aarch64] Generate preprocessor macros for -march=armv8.6a+sve.

Sander de Smalen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 13 07:51:52 PDT 2020


sdesmalen added inline comments.


================
Comment at: clang/lib/Driver/ToolChains/Arch/AArch64.cpp:370
+  if (V8_6Pos != std::end(Features)) {
+    V8_6Pos = Features.insert(std::next(V8_6Pos), "+i8mm");
+    V8_6Pos = Features.insert(V8_6Pos, "+bf16");
----------------
sdesmalen wrote:
> Both `+i8mm` and `+bf16` should be added at iterator `V8_6Pos`, because I believe that `std::next(V8_6Pos)` inserts it after the item that follows `v8.6a`, rather than after `v8.6a` directly.
Never mind the above comment, you pointed out offline that `std::next` is correct because `insert` inserts the value before V8_6Pos, my bad!

Looking at the documentation for `std::vector::insert`, it seems you can write:
```if (V8_6Pos != std::end(Features))
  Features.insert(std::next(V8_6Pos), {"+bf16", "+i8mm"});```
which avoids having to update V8_6Pos.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83079/new/

https://reviews.llvm.org/D83079





More information about the cfe-commits mailing list