[PATCH] D82661: [clang-tidy][NFC} Remove unnecessary includes throughout clang-tidy header files

2020-06-28 Thread Nathan James via Phabricator via cfe-commits
njames93 updated this revision to Diff 273894.
njames93 retitled this revision from "[clang-tidy][NFC] Remove unnecessary 
includes throughout clang-tidy header files" to "[clang-tidy][NFC} Remove 
unnecessary includes throughout clang-tidy header files".
njames93 edited the summary of this revision.
njames93 added a comment.

Remove the changes to `std::map` -> `llvm::StringMap<...>`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82661

Files:
  clang-tools-extra/clang-tidy/ClangTidy.cpp
  clang-tools-extra/clang-tidy/ClangTidy.h
  clang-tools-extra/clang-tidy/ClangTidyCheck.h
  clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
  clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.h
  clang-tools-extra/clang-tidy/ClangTidyModule.cpp
  clang-tools-extra/clang-tidy/ClangTidyModule.h
  clang-tools-extra/clang-tidy/ClangTidyProfiling.h
  clang-tools-extra/clang-tidy/abseil/DurationAdditionCheck.h
  clang-tools-extra/clang-tidy/abseil/DurationComparisonCheck.h
  clang-tools-extra/clang-tidy/abseil/DurationConversionCastCheck.h
  clang-tools-extra/clang-tidy/abseil/DurationDivisionCheck.cpp
  clang-tools-extra/clang-tidy/abseil/DurationDivisionCheck.h
  clang-tools-extra/clang-tidy/abseil/DurationFactoryFloatCheck.cpp
  clang-tools-extra/clang-tidy/abseil/DurationFactoryFloatCheck.h
  clang-tools-extra/clang-tidy/abseil/DurationFactoryScaleCheck.h
  clang-tools-extra/clang-tidy/abseil/DurationSubtractionCheck.h
  clang-tools-extra/clang-tidy/abseil/DurationUnnecessaryConversionCheck.h
  clang-tools-extra/clang-tidy/abseil/FasterStrsplitDelimiterCheck.h
  clang-tools-extra/clang-tidy/abseil/NoInternalDependenciesCheck.h
  clang-tools-extra/clang-tidy/abseil/NoNamespaceCheck.h
  clang-tools-extra/clang-tidy/abseil/RedundantStrcatCallsCheck.h
  clang-tools-extra/clang-tidy/abseil/StrCatAppendCheck.h
  clang-tools-extra/clang-tidy/abseil/StringFindStartswithCheck.cpp
  clang-tools-extra/clang-tidy/abseil/StringFindStartswithCheck.h
  clang-tools-extra/clang-tidy/abseil/StringFindStrContainsCheck.h
  clang-tools-extra/clang-tidy/abseil/TimeComparisonCheck.h
  clang-tools-extra/clang-tidy/abseil/TimeSubtractionCheck.cpp
  clang-tools-extra/clang-tidy/abseil/TimeSubtractionCheck.h
  clang-tools-extra/clang-tidy/abseil/UpgradeDurationConversionsCheck.cpp
  clang-tools-extra/clang-tidy/abseil/UpgradeDurationConversionsCheck.h
  clang-tools-extra/clang-tidy/bugprone/BadSignalToKillThreadCheck.cpp
  clang-tools-extra/clang-tidy/bugprone/BranchCloneCheck.cpp
  clang-tools-extra/clang-tidy/bugprone/BranchCloneCheck.h
  
clang-tools-extra/clang-tidy/bugprone/MisplacedOperatorInStrlenInAllocCheck.cpp
  
clang-tools-extra/clang-tidy/bugprone/MisplacedPointerArithmeticInAllocCheck.cpp
  clang-tools-extra/clang-tidy/bugprone/NotNullTerminatedResultCheck.cpp
  clang-tools-extra/clang-tidy/bugprone/NotNullTerminatedResultCheck.h
  clang-tools-extra/clang-tidy/bugprone/PosixReturnCheck.cpp
  clang-tools-extra/clang-tidy/bugprone/ReservedIdentifierCheck.cpp
  clang-tools-extra/clang-tidy/bugprone/SuspiciousIncludeCheck.cpp
  clang-tools-extra/clang-tidy/cppcoreguidelines/AvoidGotoCheck.h
  clang-tools-extra/clang-tidy/cppcoreguidelines/InitVariablesCheck.cpp
  clang-tools-extra/clang-tidy/cppcoreguidelines/InterfacesGlobalInitCheck.h
  clang-tools-extra/clang-tidy/cppcoreguidelines/MacroUsageCheck.cpp
  clang-tools-extra/clang-tidy/cppcoreguidelines/MacroUsageCheck.h
  clang-tools-extra/clang-tidy/cppcoreguidelines/NarrowingConversionsCheck.h
  clang-tools-extra/clang-tidy/cppcoreguidelines/NoMallocCheck.h
  clang-tools-extra/clang-tidy/cppcoreguidelines/OwningMemoryCheck.h
  
clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.h
  
clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.h
  
clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsPointerArithmeticCheck.h
  clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeConstCastCheck.h
  clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeCstyleCastCheck.h
  clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.h
  clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeReinterpretCastCheck.h
  
clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeStaticCastDowncastCheck.h
  clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeUnionAccessCheck.h
  clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeVarargCheck.h
  clang-tools-extra/clang-tidy/cppcoreguidelines/SlicingCheck.h
  clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.h
  clang-tools-extra/clang-tidy/fuchsia/DefaultArgumentsDeclarationsCheck.cpp
  clang-tools-extra/clang-tidy/google/AvoidNSObjectNewCheck.cpp
  clang-tools-extra/clang-tidy/google/AvoidUnderscoreInGoogletestNameCheck.cpp
  clang-tools-extra/clang-tidy/google/UpgradeGoogletestCaseCheck.cpp
  clang-tools-extra/clang-tidy/hicpp/ExceptionBaseclassCheck.h
  cla

[PATCH] D81917: [clang-tidy] For `run-clang-tidy.py` escape the paths that are used for analysis.

2020-06-28 Thread Nathan James via Phabricator via cfe-commits
njames93 accepted this revision.
njames93 added a comment.
This revision is now accepted and ready to land.

Looks good


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81917



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D78759: Add Statically Linked Libraries

2020-06-28 Thread Jon Chesterfield via Phabricator via cfe-commits
JonChesterfield added a comment.

This appears to have been committed without addressing all the comments or 
waiting for an acceptance from someone outside of our organisation. That 
doesn't seem right - am I missing part of the thread here?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78759



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D81678: Introduce noundef attribute at call sites for stricter poison analysis

2020-06-28 Thread Nikita Popov via Phabricator via cfe-commits
nikic added inline comments.



Comment at: llvm/lib/Transforms/Utils/CodeExtractor.cpp:932
   case Attribute::NoCfCheck:
+  case Attribute::NoUndef:
 break;

Not familiar with this code, but based on the placement of other similar 
attributes like nonnull, this should probably be in the first list.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81678



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D82626: [CodeComplete] Tweak completion for else.

2020-06-28 Thread Nathan James via Phabricator via cfe-commits
njames93 added a comment.

I'm still unsure what is the best behaviour here.
Would suggesting both patterns, but sort them based on what the then branch 
uses be best
Example with:

  if (...) {
// Statements
  }

Suggestions:

  - else { // Statements }
  - else if (...) { // Statements }
  - else // Statement
  - else if (...) // Statement

---

With:

  if (...) 
// Statement
  }

Suggestions:

  - else // Statement
  - else if (...) // Statement
  - else { // Statements }
  - else if (...) { // Statements }

Or is it best keeping with the behaviour of this patch where only 1 suggestion 
appears based on whether braces are used or not??


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82626



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] 43e3c39 - Revert "[Docs] Fix typo and test git commit access. NFC."

2020-06-28 Thread via cfe-commits

Author: lh123
Date: 2020-06-27T18:58:03+08:00
New Revision: 43e3c39327f9c32bea73b2629b718e9f5fd678d1

URL: 
https://github.com/llvm/llvm-project/commit/43e3c39327f9c32bea73b2629b718e9f5fd678d1
DIFF: 
https://github.com/llvm/llvm-project/commit/43e3c39327f9c32bea73b2629b718e9f5fd678d1.diff

LOG: Revert "[Docs] Fix typo and test git commit access. NFC."

This reverts commit c19e82c6b38b74c56d595cb69582b7c3727762b5.

Added: 


Modified: 

clang-tools-extra/docs/clang-tidy/checks/readability-make-member-function-const.rst

Removed: 




diff  --git 
a/clang-tools-extra/docs/clang-tidy/checks/readability-make-member-function-const.rst
 
b/clang-tools-extra/docs/clang-tidy/checks/readability-make-member-function-const.rst
index 0cf665c13c9d..60a828c8741b 100644
--- 
a/clang-tools-extra/docs/clang-tidy/checks/readability-make-member-function-const.rst
+++ 
b/clang-tools-extra/docs/clang-tidy/checks/readability-make-member-function-const.rst
@@ -26,7 +26,7 @@ ways where logical constness and physical constness coincide:
 
 Specifically, this check will not suggest to add a ``const`` to a non-const
 method if the method reads a private member variable of pointer type because
-that allows to modify the pointer which might not preserve logical constness.
+that allows to modify the pointee which might not preserve logical constness.
 For the same reason, it does not allow to call private member functions
 or member functions on private member variables.
 



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] eb50838 - [clang-format] [PR462254] fix indentation of default and break correctly in whitesmiths style

2020-06-28 Thread via cfe-commits

Author: mydeveloperday
Date: 2020-06-27T11:35:22+01:00
New Revision: eb50838ba08d4149182828b96956a57ec6f5f658

URL: 
https://github.com/llvm/llvm-project/commit/eb50838ba08d4149182828b96956a57ec6f5f658
DIFF: 
https://github.com/llvm/llvm-project/commit/eb50838ba08d4149182828b96956a57ec6f5f658.diff

LOG: [clang-format] [PR462254] fix indentation of default and break correctly 
in whitesmiths style

Summary:
https://bugs.llvm.org/show_bug.cgi?id=46254

Reviewed By: curdeius, jbcoe

Differential Revision: https://reviews.llvm.org/D8201

Added: 


Modified: 
clang/lib/Format/UnwrappedLineFormatter.cpp
clang/lib/Format/UnwrappedLineParser.cpp
clang/unittests/Format/FormatTest.cpp

Removed: 




diff  --git a/clang/lib/Format/UnwrappedLineFormatter.cpp 
b/clang/lib/Format/UnwrappedLineFormatter.cpp
index 3392a055c0c6..22f27a668dcc 100644
--- a/clang/lib/Format/UnwrappedLineFormatter.cpp
+++ b/clang/lib/Format/UnwrappedLineFormatter.cpp
@@ -1230,7 +1230,8 @@ void UnwrappedLineFormatter::formatFirstToken(
 
   // If in Whitemsmiths mode, indent start and end of blocks
   if (Style.BreakBeforeBraces == FormatStyle::BS_Whitesmiths) {
-if (RootToken.isOneOf(tok::l_brace, tok::r_brace, tok::kw_case))
+if (RootToken.isOneOf(tok::l_brace, tok::r_brace, tok::kw_case,
+  tok::kw_default))
   Indent += Style.IndentWidth;
   }
 

diff  --git a/clang/lib/Format/UnwrappedLineParser.cpp 
b/clang/lib/Format/UnwrappedLineParser.cpp
index 577b60bc51e2..a37386425aae 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/lib/Format/UnwrappedLineParser.cpp
@@ -2220,8 +2220,13 @@ void UnwrappedLineParser::parseLabel(bool 
LeftAlignLabel) {
 parseBlock(/*MustBeDeclaration=*/false);
 if (FormatTok->Tok.is(tok::kw_break)) {
   if (Style.BraceWrapping.AfterControlStatement ==
-  FormatStyle::BWACS_Always)
+  FormatStyle::BWACS_Always) {
 addUnwrappedLine();
+if (!Style.IndentCaseBlocks &&
+Style.BreakBeforeBraces == FormatStyle::BS_Whitesmiths) {
+  Line->Level++;
+}
+  }
   parseStructuralElement();
 }
 addUnwrappedLine();

diff  --git a/clang/unittests/Format/FormatTest.cpp 
b/clang/unittests/Format/FormatTest.cpp
index beaa68a24617..a47c66cbf92a 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -12979,9 +12979,7 @@ TEST_F(FormatTest, WhitesmithsBraceBreaking) {
"  }\n",
WhitesmithsBraceStyle);
 
-  // FIXME: the block and the break under case 2 in this test don't get 
indented
-  // correctly
-  /*
+  WhitesmithsBraceStyle.IndentCaseBlocks = true;
   verifyFormat("void switchTest1(int a)\n"
"  {\n"
"  switch (a)\n"
@@ -12989,35 +12987,101 @@ TEST_F(FormatTest, WhitesmithsBraceBreaking) {
"case 2:\n"
"  {\n"
"  }\n"
-   "  break;\n"
+   "break;\n"
"}\n"
"  }\n",
WhitesmithsBraceStyle);
-  */
 
-  // FIXME: the block and the break under case 2 in this test don't get 
indented
-  // correctly
-  /*
   verifyFormat("void switchTest2(int a)\n"
"  {\n"
"  switch (a)\n"
"{\n"
-   "  case 0:\n"
+   "case 0:\n"
"break;\n"
-   "  case 1:\n"
+   "case 1:\n"
+   "  {\n"
+   "  break;\n"
+   "  }\n"
+   "case 2:\n"
+   "  {\n"
+   "  }\n"
+   "break;\n"
+   "default:\n"
+   "break;\n"
+   "}\n"
+   "  }\n",
+   WhitesmithsBraceStyle);
+
+  verifyFormat("void switchTest3(int a)\n"
+   "  {\n"
+   "  switch (a)\n"
"{\n"
+   "case 0:\n"
+   "  {\n"
+   "  foo(x);\n"
+   "  }\n"
+   "break;\n"
+   "default:\n"
+   "  {\n"
+   "  foo(1);\n"
+   "  }\n"
"break;\n"
"}\n"
-   "  case 2:\n"
+   "  }\n",
+   WhitesmithsBraceStyle);
+
+  WhitesmithsBraceStyle.IndentCaseBlocks = false;
+
+  verifyFormat("void switchTest4(int a)\n"
+   "  {\n"
+   "  switch (a)\n"
+   "{\n"
+   "case 2:\n"
"{\n"
"}\n"
"break;\n"
-   "  default:\n"
+   "}\n"
+   "  }\n",
+   WhitesmithsBraceStyle);
+
+  verifyFormat("void switchTest5(int a)\n"
+   "  {\n

[PATCH] D82016: [clang-format] [PR462254] fix indentation of default and break correctly in whitesmiths style

2020-06-28 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay closed this revision.
MyDeveloperDay added a comment.

closed by commit rGeb50838ba08d: [clang-format] [PR462254] fix indentation of 
default and break correctly in… 



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82016



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] a43b99a - [clang-format] NFC 1% improvement in the overall clang-formatted status

2020-06-28 Thread via cfe-commits

Author: mydeveloperday
Date: 2020-06-27T12:18:23+01:00
New Revision: a43b99a1e38e2beffb68a6db93f216f511e7fd41

URL: 
https://github.com/llvm/llvm-project/commit/a43b99a1e38e2beffb68a6db93f216f511e7fd41
DIFF: 
https://github.com/llvm/llvm-project/commit/a43b99a1e38e2beffb68a6db93f216f511e7fd41.diff

LOG: [clang-format] NFC 1% improvement in the overall clang-formatted status

Added: 


Modified: 
clang/docs/ClangFormattedStatus.rst

Removed: 




diff  --git a/clang/docs/ClangFormattedStatus.rst 
b/clang/docs/ClangFormattedStatus.rst
index 3e140c40070c..3e348eadd4ff 100644
--- a/clang/docs/ClangFormattedStatus.rst
+++ b/clang/docs/ClangFormattedStatus.rst
@@ -17,7 +17,7 @@ Clang Formatted Status
 ==
 
 :doc:`ClangFormattedStatus` describes the state of LLVM source
-tree in terms of conformance to :doc:`ClangFormat` as of: June 17, 2020 
22:15:52 (`4b776a98f1a 
`_).
+tree in terms of conformance to :doc:`ClangFormat` as of: June 27, 2020 
11:36:24 (`eb50838ba08 
`_).
 
 
 .. list-table:: LLVM Clang-Format Status
@@ -91,9 +91,9 @@ tree in terms of conformance to :doc:`ClangFormat` as of: 
June 17, 2020 22:15:52
  - :none:`0%`
* - clang/include/clang/AST
  - `113`
- - `21`
- - `92`
- - :part:`18%`
+ - `20`
+ - `93`
+ - :part:`17%`
* - clang/include/clang/ASTMatchers
  - `5`
  - `1`
@@ -260,10 +260,10 @@ tree in terms of conformance to :doc:`ClangFormat` as of: 
June 17, 2020 22:15:52
  - `0`
  - :good:`100%`
* - clang/include/clang/Tooling/Transformer
+ - `8`
  - `7`
- - `6`
  - `1`
- - :part:`85%`
+ - :part:`87%`
* - clang/include/clang-c
  - `9`
  - `3`
@@ -325,10 +325,10 @@ tree in terms of conformance to :doc:`ClangFormat` as of: 
June 17, 2020 22:15:52
  - `26`
  - :part:`23%`
* - clang/lib/Basic/Targets
- - `46`
- - `21`
+ - `48`
+ - `23`
  - `25`
- - :part:`45%`
+ - :part:`47%`
* - clang/lib/CodeGen
  - `87`
  - `8`
@@ -370,15 +370,15 @@ tree in terms of conformance to :doc:`ClangFormat` as of: 
June 17, 2020 22:15:52
  - `14`
  - :part:`12%`
* - clang/lib/Driver/ToolChains
- - `81`
- - `25`
+ - `83`
+ - `27`
  - `56`
- - :part:`30%`
+ - :part:`32%`
* - clang/lib/Driver/ToolChains/Arch
- - `16`
- - `2`
+ - `18`
+ - `4`
  - `14`
- - :part:`12%`
+ - :part:`22%`
* - clang/lib/Edit
  - `3`
  - `0`
@@ -545,10 +545,10 @@ tree in terms of conformance to :doc:`ClangFormat` as of: 
June 17, 2020 22:15:52
  - `1`
  - :part:`85%`
* - clang/lib/Tooling/Transformer
- - `6`
- - `3`
+ - `7`
+ - `4`
  - `3`
- - :part:`50%`
+ - :part:`57%`
* - clang/tools/arcmt-test
  - `1`
  - `0`
@@ -616,9 +616,9 @@ tree in terms of conformance to :doc:`ClangFormat` as of: 
June 17, 2020 22:15:52
  - :none:`0%`
* - clang/tools/clang-import-test
  - `1`
- - `0`
  - `1`
- - :none:`0%`
+ - `0`
+ - :good:`100%`
* - clang/tools/clang-offload-bundler
  - `1`
  - `0`
@@ -720,10 +720,10 @@ tree in terms of conformance to :doc:`ClangFormat` as of: 
June 17, 2020 22:15:52
  - `1`
  - :part:`94%`
* - clang/unittests/Frontend
- - `8`
- - `4`
+ - `9`
+ - `5`
  - `4`
- - :part:`50%`
+ - :part:`55%`
* - clang/unittests/Index
  - `1`
  - `1`
@@ -886,9 +886,9 @@ tree in terms of conformance to :doc:`ClangFormat` as of: 
June 17, 2020 22:15:52
  - :none:`0%`
* - clang-tools-extra/clang-tidy
  - `18`
- - `12`
- - `6`
- - :part:`66%`
+ - `10`
+ - `8`
+ - :part:`55%`
* - clang-tools-extra/clang-tidy/abseil
  - `40`
  - `28`
@@ -906,8 +906,8 @@ tree in terms of conformance to :doc:`ClangFormat` as of: 
June 17, 2020 22:15:52
  - :good:`100%`
* - clang-tools-extra/clang-tidy/bugprone
  - `105`
- - `84`
- - `21`
+ - `85`
+ - `20`
  - :part:`80%`
* - clang-tools-extra/clang-tidy/cert
  - `29`
@@ -961,9 +961,9 @@ tree in terms of conformance to :doc:`ClangFormat` as of: 
June 17, 2020 22:15:52
  - :part:`86%`
* - clang-tools-extra/clang-tidy/modernize
  - `67`
- - `45`
- - `22`
- - :part:`67%`
+ - `46`
+ - `21`
+ - :part:`68%`
* - clang-tools-extra/clang-tidy/mpi
  - `5`
  - `4`
@@ -1015,10 +1015,10 @@ tree in terms of conformance to :doc:`ClangFormat` as 
of: June 17, 2020 22:15:52
  - `0`
  - :good:`100%`
* - clang-tools-extra/clangd
- - `73`
- - `57`
- - `16`
- - :part:`78%`
+ - `75`
+ - `58`
+ - `17`
+ - :part:`77%`
* - clang-tools-extra/clangd/benchmarks
  - `1`
  - `1`
@

[clang] d698ff9 - [RISCV] Support experimental v extensions.

2020-06-28 Thread Hsiangkai Wang via cfe-commits

Author: Hsiangkai Wang
Date: 2020-06-28T00:54:07+08:00
New Revision: d698ff92a59c0632aa6a88b72890eb401bd64faa

URL: 
https://github.com/llvm/llvm-project/commit/d698ff92a59c0632aa6a88b72890eb401bd64faa
DIFF: 
https://github.com/llvm/llvm-project/commit/d698ff92a59c0632aa6a88b72890eb401bd64faa.diff

LOG: [RISCV] Support experimental v extensions.

This follows the design as discussed on the mailing lists in the
following RFC:
http://lists.llvm.org/pipermail/llvm-dev/2020-January/138364.html

Support for the vector 'v' extension v0.8.

Differential revision: https://reviews.llvm.org/D81188

Added: 


Modified: 
clang/lib/Driver/ToolChains/Arch/RISCV.cpp
clang/test/Driver/riscv-arch.c

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/Arch/RISCV.cpp 
b/clang/lib/Driver/ToolChains/Arch/RISCV.cpp
index f16827e00f1f..8659ebf17a72 100644
--- a/clang/lib/Driver/ToolChains/Arch/RISCV.cpp
+++ b/clang/lib/Driver/ToolChains/Arch/RISCV.cpp
@@ -62,6 +62,8 @@ isExperimentalExtension(StringRef Ext) {
   Ext == "zbf" || Ext == "zbm" || Ext == "zbp" || Ext == "zbr" ||
   Ext == "zbs" || Ext == "zbt" || Ext == "zbproposedc")
 return RISCVExtensionVersion{"0", "92"};
+  if (Ext == "v")
+return RISCVExtensionVersion{"0", "8"};
   return None;
 }
 
@@ -399,6 +401,9 @@ static bool getArchFeatures(const Driver &D, StringRef 
MArch,
 case 'b':
   Features.push_back("+experimental-b");
   break;
+case 'v':
+  Features.push_back("+experimental-v");
+  break;
 }
 
 // Consume full extension name and version, including any optional '_'

diff  --git a/clang/test/Driver/riscv-arch.c b/clang/test/Driver/riscv-arch.c
index ba93be9caa36..e3062feb7dee 100644
--- a/clang/test/Driver/riscv-arch.c
+++ b/clang/test/Driver/riscv-arch.c
@@ -360,3 +360,22 @@
 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-EXPERIMENTAL-ZBB-ZBP 
%s
 // RV32-EXPERIMENTAL-ZBB-ZBP: "-target-feature" "+experimental-zbb"
 // RV32-EXPERIMENTAL-ZBB-ZBP: "-target-feature" "+experimental-zbp"
+
+// RUN: %clang -target riscv32-unknown-elf -march=rv32iv -### %s -c 2>&1 | \
+// RUN:   FileCheck -check-prefix=RV32-EXPERIMENTAL-V-NOFLAG %s
+// RV32-EXPERIMENTAL-V-NOFLAG: error: invalid arch name 'rv32iv'
+// RV32-EXPERIMENTAL-V-NOFLAG: requires '-menable-experimental-extensions'
+
+// RUN: %clang -target riscv32-unknown-elf -march=rv32iv 
-menable-experimental-extensions -### %s -c 2>&1 | \
+// RUN:   FileCheck -check-prefix=RV32-EXPERIMENTAL-V-NOVERS %s
+// RV32-EXPERIMENTAL-V-NOVERS: error: invalid arch name 'rv32iv'
+// RV32-EXPERIMENTAL-V-NOVERS: experimental extension requires explicit 
version number
+
+// RUN: %clang -target riscv32-unknown-elf -march=rv32iv0p1 
-menable-experimental-extensions -### %s -c 2>&1 | \
+// RUN:   FileCheck -check-prefix=RV32-EXPERIMENTAL-V-BADVERS %s
+// RV32-EXPERIMENTAL-V-BADVERS: error: invalid arch name 'rv32iv0p1'
+// RV32-EXPERIMENTAL-V-BADVERS: unsupported version number 0.1 for 
experimental extension
+
+// RUN: %clang -target riscv32-unknown-elf -march=rv32iv0p8 
-menable-experimental-extensions -### %s -c 2>&1 | \
+// RUN:   FileCheck -check-prefix=RV32-EXPERIMENTAL-V-GOODVERS %s
+// RV32-EXPERIMENTAL-V-GOODVERS: "-target-feature" "+experimental-v"



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D81188: [RISCV] Support experimental v extensions.

2020-06-28 Thread Hsiangkai Wang via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGd698ff92a59c: [RISCV] Support experimental v extensions. 
(authored by HsiangKai).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81188

Files:
  clang/lib/Driver/ToolChains/Arch/RISCV.cpp
  clang/test/Driver/riscv-arch.c


Index: clang/test/Driver/riscv-arch.c
===
--- clang/test/Driver/riscv-arch.c
+++ clang/test/Driver/riscv-arch.c
@@ -360,3 +360,22 @@
 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-EXPERIMENTAL-ZBB-ZBP 
%s
 // RV32-EXPERIMENTAL-ZBB-ZBP: "-target-feature" "+experimental-zbb"
 // RV32-EXPERIMENTAL-ZBB-ZBP: "-target-feature" "+experimental-zbp"
+
+// RUN: %clang -target riscv32-unknown-elf -march=rv32iv -### %s -c 2>&1 | \
+// RUN:   FileCheck -check-prefix=RV32-EXPERIMENTAL-V-NOFLAG %s
+// RV32-EXPERIMENTAL-V-NOFLAG: error: invalid arch name 'rv32iv'
+// RV32-EXPERIMENTAL-V-NOFLAG: requires '-menable-experimental-extensions'
+
+// RUN: %clang -target riscv32-unknown-elf -march=rv32iv 
-menable-experimental-extensions -### %s -c 2>&1 | \
+// RUN:   FileCheck -check-prefix=RV32-EXPERIMENTAL-V-NOVERS %s
+// RV32-EXPERIMENTAL-V-NOVERS: error: invalid arch name 'rv32iv'
+// RV32-EXPERIMENTAL-V-NOVERS: experimental extension requires explicit 
version number
+
+// RUN: %clang -target riscv32-unknown-elf -march=rv32iv0p1 
-menable-experimental-extensions -### %s -c 2>&1 | \
+// RUN:   FileCheck -check-prefix=RV32-EXPERIMENTAL-V-BADVERS %s
+// RV32-EXPERIMENTAL-V-BADVERS: error: invalid arch name 'rv32iv0p1'
+// RV32-EXPERIMENTAL-V-BADVERS: unsupported version number 0.1 for 
experimental extension
+
+// RUN: %clang -target riscv32-unknown-elf -march=rv32iv0p8 
-menable-experimental-extensions -### %s -c 2>&1 | \
+// RUN:   FileCheck -check-prefix=RV32-EXPERIMENTAL-V-GOODVERS %s
+// RV32-EXPERIMENTAL-V-GOODVERS: "-target-feature" "+experimental-v"
Index: clang/lib/Driver/ToolChains/Arch/RISCV.cpp
===
--- clang/lib/Driver/ToolChains/Arch/RISCV.cpp
+++ clang/lib/Driver/ToolChains/Arch/RISCV.cpp
@@ -62,6 +62,8 @@
   Ext == "zbf" || Ext == "zbm" || Ext == "zbp" || Ext == "zbr" ||
   Ext == "zbs" || Ext == "zbt" || Ext == "zbproposedc")
 return RISCVExtensionVersion{"0", "92"};
+  if (Ext == "v")
+return RISCVExtensionVersion{"0", "8"};
   return None;
 }
 
@@ -399,6 +401,9 @@
 case 'b':
   Features.push_back("+experimental-b");
   break;
+case 'v':
+  Features.push_back("+experimental-v");
+  break;
 }
 
 // Consume full extension name and version, including any optional '_'


Index: clang/test/Driver/riscv-arch.c
===
--- clang/test/Driver/riscv-arch.c
+++ clang/test/Driver/riscv-arch.c
@@ -360,3 +360,22 @@
 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-EXPERIMENTAL-ZBB-ZBP %s
 // RV32-EXPERIMENTAL-ZBB-ZBP: "-target-feature" "+experimental-zbb"
 // RV32-EXPERIMENTAL-ZBB-ZBP: "-target-feature" "+experimental-zbp"
+
+// RUN: %clang -target riscv32-unknown-elf -march=rv32iv -### %s -c 2>&1 | \
+// RUN:   FileCheck -check-prefix=RV32-EXPERIMENTAL-V-NOFLAG %s
+// RV32-EXPERIMENTAL-V-NOFLAG: error: invalid arch name 'rv32iv'
+// RV32-EXPERIMENTAL-V-NOFLAG: requires '-menable-experimental-extensions'
+
+// RUN: %clang -target riscv32-unknown-elf -march=rv32iv -menable-experimental-extensions -### %s -c 2>&1 | \
+// RUN:   FileCheck -check-prefix=RV32-EXPERIMENTAL-V-NOVERS %s
+// RV32-EXPERIMENTAL-V-NOVERS: error: invalid arch name 'rv32iv'
+// RV32-EXPERIMENTAL-V-NOVERS: experimental extension requires explicit version number
+
+// RUN: %clang -target riscv32-unknown-elf -march=rv32iv0p1 -menable-experimental-extensions -### %s -c 2>&1 | \
+// RUN:   FileCheck -check-prefix=RV32-EXPERIMENTAL-V-BADVERS %s
+// RV32-EXPERIMENTAL-V-BADVERS: error: invalid arch name 'rv32iv0p1'
+// RV32-EXPERIMENTAL-V-BADVERS: unsupported version number 0.1 for experimental extension
+
+// RUN: %clang -target riscv32-unknown-elf -march=rv32iv0p8 -menable-experimental-extensions -### %s -c 2>&1 | \
+// RUN:   FileCheck -check-prefix=RV32-EXPERIMENTAL-V-GOODVERS %s
+// RV32-EXPERIMENTAL-V-GOODVERS: "-target-feature" "+experimental-v"
Index: clang/lib/Driver/ToolChains/Arch/RISCV.cpp
===
--- clang/lib/Driver/ToolChains/Arch/RISCV.cpp
+++ clang/lib/Driver/ToolChains/Arch/RISCV.cpp
@@ -62,6 +62,8 @@
   Ext == "zbf" || Ext == "zbm" || Ext == "zbp" || Ext == "zbr" ||
   Ext == "zbs" || Ext == "zbt" || Ext == "zbproposedc")
 return RISCVExtensionVersion{"0", "92"};
+  if (Ext == "v")
+return RISCVExtensionVersion{"0", "8"};
   return None;
 }
 
@@ -399,6 +401,9 @@
 case 'b':
   Features.push_back("+experimental-b");
 

[PATCH] D82706: [ASTMatchers] Enhanced support for matchers taking Regex arguments

2020-06-28 Thread Nathan James via Phabricator via cfe-commits
njames93 created this revision.
njames93 added reviewers: klimek, aaron.ballman.
Herald added subscribers: llvm-commits, cfe-commits, hiraditya.
Herald added projects: clang, LLVM.

Added new Macros `AST(_POLYMORPHIC)_MATCHER_REGEX(_OVERLOAD)` that define a 
matchers that take a regular expression string and optionally regular 
expression flags. This lets users match against nodes while ignoring the case 
without having to manually use `[Aa]` or `[A-Fa-f]` in their regex. The other 
point this addresses is in the current state, matchers that use regular 
expressions have to compile them for each node they try to match on, Now the 
regular expression is compiled once when you define the matcher and used for 
every node that it tries to match against. If there is an error while compiling 
the regular expression an error will be logged to stderr showing the bad regex 
string and the reason it couldn't be compiled. The old behaviour of this was 
down to the Matcher implementation and some would assert, whereas others just 
would never match. Support for this has been added to the documentation script 
as well. Support for this has been added to dynamic matchers ensuring 
functionality is the same between the 2 use cases.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D82706

Files:
  clang/docs/LibASTMatchersReference.html
  clang/docs/tools/dump_ast_matchers.py
  clang/include/clang/ASTMatchers/ASTMatchers.h
  clang/include/clang/ASTMatchers/ASTMatchersMacros.h
  clang/lib/ASTMatchers/Dynamic/Marshallers.cpp
  clang/lib/ASTMatchers/Dynamic/Marshallers.h
  clang/lib/ASTMatchers/Dynamic/Registry.cpp
  clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
  clang/unittests/ASTMatchers/Dynamic/ParserTest.cpp
  llvm/include/llvm/Support/Regex.h
  llvm/lib/Support/Regex.cpp

Index: llvm/lib/Support/Regex.cpp
===
--- llvm/lib/Support/Regex.cpp
+++ llvm/lib/Support/Regex.cpp
@@ -26,7 +26,7 @@
 
 Regex::Regex() : preg(nullptr), error(REG_BADPAT) {}
 
-Regex::Regex(StringRef regex, unsigned Flags) {
+Regex::Regex(StringRef regex, RegexFlags Flags) {
   unsigned flags = 0;
   preg = new llvm_regex();
   preg->re_endp = regex.end();
@@ -39,6 +39,9 @@
   error = llvm_regcomp(preg, regex.data(), flags|REG_PEND);
 }
 
+Regex::Regex(StringRef regex, unsigned Flags)
+: Regex(regex, static_cast(Flags)) {}
+
 Regex::Regex(Regex &®ex) {
   preg = regex.preg;
   error = regex.error;
Index: llvm/include/llvm/Support/Regex.h
===
--- llvm/include/llvm/Support/Regex.h
+++ llvm/include/llvm/Support/Regex.h
@@ -16,6 +16,7 @@
 #ifndef LLVM_SUPPORT_REGEX_H
 #define LLVM_SUPPORT_REGEX_H
 
+#include "llvm/ADT/BitmaskEnum.h"
 #include 
 
 struct llvm_regex;
@@ -26,20 +27,22 @@
 
   class Regex {
   public:
-enum {
-  NoFlags=0,
+enum RegexFlags : unsigned {
+  NoFlags = 0,
   /// Compile for matching that ignores upper/lower case distinctions.
-  IgnoreCase=1,
+  IgnoreCase = 1,
   /// Compile for newline-sensitive matching. With this flag '[^' bracket
   /// expressions and '.' never match newline. A ^ anchor matches the
   /// null string after any newline in the string in addition to its normal
   /// function, and the $ anchor matches the null string before any
   /// newline in the string in addition to its normal function.
-  Newline=2,
+  Newline = 2,
   /// By default, the POSIX extended regular expression (ERE) syntax is
   /// assumed. Pass this flag to turn on basic regular expressions (BRE)
   /// instead.
-  BasicRegex=4
+  BasicRegex = 4,
+
+  LLVM_MARK_AS_BITMASK_ENUM(BasicRegex)
 };
 
 Regex();
@@ -47,7 +50,8 @@
 ///
 /// \param Regex - referenced string is no longer needed after this
 /// constructor does finish.  Only its compiled form is kept stored.
-Regex(StringRef Regex, unsigned Flags = NoFlags);
+Regex(StringRef Regex, RegexFlags Flags = NoFlags);
+Regex(StringRef Regex, unsigned Flags);
 Regex(const Regex &) = delete;
 Regex &operator=(Regex regex) {
   std::swap(preg, regex.preg);
Index: clang/unittests/ASTMatchers/Dynamic/ParserTest.cpp
===
--- clang/unittests/ASTMatchers/Dynamic/ParserTest.cpp
+++ clang/unittests/ASTMatchers/Dynamic/ParserTest.cpp
@@ -259,6 +259,15 @@
   EXPECT_TRUE(matches("unsigned X = sizeof(int);", MStmt));
   EXPECT_FALSE(matches("unsigned X = alignof(int);", MStmt));
 
+  Code =
+  R"query(namedDecl(matchesName("^::[ABC]*$", "IgnoreCase | BasicRegex")))query";
+  llvm::Optional MatchesName(
+  Parser::parseMatcherExpression(Code, nullptr, nullptr, &Error));
+  EXPECT_EQ("", Error.toStringFull());
+  M = MatchesName->unconditionalConvertTo();
+  EXPECT_TRUE(matches("unsigned AAACCBB;", M));
+  EXPECT_TRUE(matches("unsigned aaaccbb;", M));
+
   Code = "h

[PATCH] D82707: [clang][docs] Remove untracked files from formatted status

2020-06-28 Thread Nathan James via Phabricator via cfe-commits
njames93 created this revision.
njames93 added reviewers: krasimir, JakeMerdichAMD, sammccall, curdeius, bollu, 
alexshap, jdoerfert, DavidTruby, sscalpone, MyDeveloperDay.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Currently on http://clang.llvm.org/docs/ClangFormattedStatus.html there are 
format stats on files no actually inside the tree but generated by build 
scripts. These are usually copied from somewhere else. Right now for example 
there are files from `llvm/utils/release/llvm-package...`. Adding these files 
bloats the list while not giving an accurate representation of how formatted 
the repo is.
This addresses this issue by checking the git index and ignoring any folder 
that doesn't contain tracked files.

I'm still unsure whether it would be better to just do away with the `os.walk` 
method and just check over every file returned from `git ls-index 
`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D82707

Files:
  clang/docs/tools/generate_formatted_state.py


Index: clang/docs/tools/generate_formatted_state.py
===
--- clang/docs/tools/generate_formatted_state.py
+++ clang/docs/tools/generate_formatted_state.py
@@ -72,6 +72,8 @@
  - {style2}`{percent}%`
 """
 
+FNULL = open(os.devnull, 'w')
+
 with open(DOC_FILE, 'wb') as output:
 sha = get_git_revision_short_hash()
 today = datetime.now().strftime("%B %d, %Y %H:%M:%S")
@@ -85,14 +87,22 @@
 for subdir in subdirs:
 if any(sd == subdir for sd in skipped_dirs):
 subdirs.remove(subdir)
+else:
+act_sub_dir = os.path.join(root, subdir)
+# Check the git index to see if the directory contains tracked
+# files. Reditect the output to a null descriptor as we aren't
+# interested in it, just the return code.
+git_check = subprocess.Popen(
+["git", "ls-files", "--error-unmatch", act_sub_dir],
+stdout=FNULL,
+stderr=FNULL)
+if git_check.wait() != 0:
+print("Skipping directory: ", act_sub_dir)
+subdirs.remove(subdir)
 
 path = os.path.relpath(root, TOP_DIR)
 path = path.replace('\\', '/')
 
-head, _ = os.path.split(root)
-while head:
-head, _ = os.path.split(head)
-
 file_count = 0
 file_pass = 0
 file_fail = 0


Index: clang/docs/tools/generate_formatted_state.py
===
--- clang/docs/tools/generate_formatted_state.py
+++ clang/docs/tools/generate_formatted_state.py
@@ -72,6 +72,8 @@
  - {style2}`{percent}%`
 """
 
+FNULL = open(os.devnull, 'w')
+
 with open(DOC_FILE, 'wb') as output:
 sha = get_git_revision_short_hash()
 today = datetime.now().strftime("%B %d, %Y %H:%M:%S")
@@ -85,14 +87,22 @@
 for subdir in subdirs:
 if any(sd == subdir for sd in skipped_dirs):
 subdirs.remove(subdir)
+else:
+act_sub_dir = os.path.join(root, subdir)
+# Check the git index to see if the directory contains tracked
+# files. Reditect the output to a null descriptor as we aren't
+# interested in it, just the return code.
+git_check = subprocess.Popen(
+["git", "ls-files", "--error-unmatch", act_sub_dir],
+stdout=FNULL,
+stderr=FNULL)
+if git_check.wait() != 0:
+print("Skipping directory: ", act_sub_dir)
+subdirs.remove(subdir)
 
 path = os.path.relpath(root, TOP_DIR)
 path = path.replace('\\', '/')
 
-head, _ = os.path.split(root)
-while head:
-head, _ = os.path.split(head)
-
 file_count = 0
 file_pass = 0
 file_fail = 0
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] 42a5158 - Fix build errors after b9306fd0

2020-06-28 Thread Nathan James via cfe-commits

Author: Nathan James
Date: 2020-06-28T11:02:19+01:00
New Revision: 42a51587c79a673045aec3586f4070630e5e7af3

URL: 
https://github.com/llvm/llvm-project/commit/42a51587c79a673045aec3586f4070630e5e7af3
DIFF: 
https://github.com/llvm/llvm-project/commit/42a51587c79a673045aec3586f4070630e5e7af3.diff

LOG: Fix build errors after b9306fd0

Added: 


Modified: 
clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.h

Removed: 




diff  --git a/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.h 
b/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.h
index 038814e21fb3..369ebe42715a 100644
--- a/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.h
+++ b/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.h
@@ -76,7 +76,7 @@ class IdentifierNamingCheck final : public 
RenamerClangTidyCheck {
 
 } // namespace readability
 template <>
-struct ::clang::tidy::OptionEnumMapping<
+struct OptionEnumMapping<
 readability::IdentifierNamingCheck::CaseType> {
   static llvm::ArrayRef<
   std::pair>



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D82725: [PowerPC][Power10] Implement Move to VSR Mask builtins in LLVM/Clang

2020-06-28 Thread Amy Kwan via Phabricator via cfe-commits
amyk created this revision.
amyk added reviewers: power-llvm-team, PowerPC, lei, stefanp.
amyk added projects: PowerPC, LLVM, clang.
Herald added subscribers: shchenz, hiraditya, nemanjai.

This patch implements the following function prototypes:

  vector unsigned char vec_genbm (unsigned long long bm);
  vector unsigned char vec_genbm (const unsigned long long bm);
  vector unsigned short vec_genhm (unsigned long long bm);
  vector unsigned int vec_genwm (unsigned long long bm);
  vector unsigned long long vec_gendm (unsigned long long bm);
  vector unsigned __int128 vec_genqm (unsigned long long bm);

Depends on D82675 .


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D82725

Files:
  clang/include/clang/Basic/BuiltinsPPC.def
  clang/lib/Headers/altivec.h
  clang/test/CodeGen/builtins-ppc-p10vector.c
  llvm/include/llvm/IR/IntrinsicsPowerPC.td
  llvm/lib/Target/PowerPC/PPCISelLowering.cpp
  llvm/lib/Target/PowerPC/PPCInstrPrefix.td
  llvm/test/CodeGen/PowerPC/p10-vector-mask-ops.ll
  llvm/test/MC/Disassembler/PowerPC/p10insts.txt
  llvm/test/MC/PowerPC/p10.s

Index: llvm/test/MC/PowerPC/p10.s
===
--- llvm/test/MC/PowerPC/p10.s
+++ llvm/test/MC/PowerPC/p10.s
@@ -18,6 +18,24 @@
 # CHECK-BE: vextractqm 1, 2   # encoding: [0x10,0x2c,0x16,0x42]
 # CHECK-LE: vextractqm 1, 2   # encoding: [0x42,0x16,0x2c,0x10]
 vextractqm 1, 2
+# CHECK-BE: mtvsrbm 1, 2  # encoding: [0x10,0x30,0x16,0x42]
+# CHECK-LE: mtvsrbm 1, 2  # encoding: [0x42,0x16,0x30,0x10]
+mtvsrbm 1, 2
+# CHECK-BE: mtvsrhm 1, 2  # encoding: [0x10,0x31,0x16,0x42]
+# CHECK-LE: mtvsrhm 1, 2  # encoding: [0x42,0x16,0x31,0x10]
+mtvsrhm 1, 2
+# CHECK-BE: mtvsrwm 1, 2  # encoding: [0x10,0x32,0x16,0x42]
+# CHECK-LE: mtvsrwm 1, 2  # encoding: [0x42,0x16,0x32,0x10]
+mtvsrwm 1, 2
+# CHECK-BE: mtvsrdm 1, 2  # encoding: [0x10,0x33,0x16,0x42]
+# CHECK-LE: mtvsrdm 1, 2  # encoding: [0x42,0x16,0x33,0x10]
+mtvsrdm 1, 2
+# CHECK-BE: mtvsrqm 1, 2  # encoding: [0x10,0x34,0x16,0x42]
+# CHECK-LE: mtvsrqm 1, 2  # encoding: [0x42,0x16,0x34,0x10]
+mtvsrqm 1, 2
+# CHECK-BE: mtvsrbmi 1, 31# encoding: [0x10,0x2f,0x00,0x15]
+# CHECK-LE: mtvsrbmi 1, 31# encoding: [0x15,0x00,0x2f,0x10]
+mtvsrbmi 1, 31
 # CHECK-BE: vpdepd 1, 2, 0# encoding: [0x10,0x22,0x05,0xcd]
 # CHECK-LE: vpdepd 1, 2, 0# encoding: [0xcd,0x05,0x22,0x10]
 vpdepd 1, 2, 0
Index: llvm/test/MC/Disassembler/PowerPC/p10insts.txt
===
--- llvm/test/MC/Disassembler/PowerPC/p10insts.txt
+++ llvm/test/MC/Disassembler/PowerPC/p10insts.txt
@@ -16,6 +16,24 @@
 # CHECK: vextractqm 1, 2
 0x10 0x2c 0x16 0x42
 
+# CHECK: mtvsrbm 1, 2
+0x10 0x30 0x16 0x42
+
+# CHECK: mtvsrhm 1, 2
+0x10 0x31 0x16 0x42
+
+# CHECK: mtvsrwm 1, 2
+0x10 0x32 0x16 0x42
+
+# CHECK: mtvsrdm 1, 2
+0x10 0x33 0x16 0x42
+
+# CHECK: mtvsrqm 1, 2
+0x10 0x34 0x16 0x42
+
+# CHECK: mtvsrbmi 1, 65535
+0x10 0x3f 0xff 0xd5
+
 # CHECK: vpdepd 1, 2, 0
 0x10 0x22 0x05 0xcd
 
Index: llvm/test/CodeGen/PowerPC/p10-vector-mask-ops.ll
===
--- llvm/test/CodeGen/PowerPC/p10-vector-mask-ops.ll
+++ llvm/test/CodeGen/PowerPC/p10-vector-mask-ops.ll
@@ -61,3 +61,99 @@
 declare i32 @llvm.ppc.altivec.vextractwm(<4 x i32>)
 declare i32 @llvm.ppc.altivec.vextractdm(<2 x i64>)
 declare i32 @llvm.ppc.altivec.vextractqm(<1 x i128>)
+
+define <16 x i8>  @test_mtvsrbm(i64 %a) {
+; CHECK-LABEL: test_mtvsrbm:
+; CHECK:   # %bb.0: # %entry
+; CHECK-NEXT:mtvsrbm v2, r3
+; CHECK-NEXT:blr
+entry:
+  %mv = tail call <16 x i8> @llvm.ppc.altivec.mtvsrbm(i64 %a)
+  ret <16 x i8> %mv
+}
+
+define <16 x i8>  @test_mtvsrbmi() {
+; CHECK-LABEL: test_mtvsrbmi:
+; CHECK:   # %bb.0: # %entry
+; CHECK-NEXT:mtvsrbmi v2, 1
+; CHECK-NEXT:blr
+entry:
+  %mv = tail call <16 x i8> @llvm.ppc.altivec.mtvsrbm(i64 1)
+  ret <16 x i8> %mv
+}
+
+define <16 x i8>  @test_mtvsrbmi2() {
+; CHECK-LABEL: test_mtvsrbmi2:
+; CHECK:   # %bb.0: # %entry
+; CHECK-NEXT:mtvsrbmi v2, 255
+; CHECK-NEXT:blr
+entry:
+  %mv = tail call <16 x i8> @llvm.ppc.altivec.mtvsrbm(i64 255)
+  ret <16 x i8> %mv
+}
+
+define <16 x i8>  @test_mtvsrbmi3() {
+; CHECK-LABEL: test_mtvsrbmi3:
+; CHECK:   # %bb.0: # %entry
+; CHECK-NEXT:mtvsrbmi v2, 0
+; CHECK-NEXT:blr
+entry:
+  %mv = tail call <16 x i8> @llvm.ppc.altivec.mtvsrbm(i64 256)
+  ret <16 x i8> %mv
+}
+
+define <16 x i8>  @test_mtvsrbmi4() {
+; CHECK-

[PATCH] D82726: [PowerPC][Power10] Implement Vector Count Mask Bits builtins in LLVM/Clang

2020-06-28 Thread Amy Kwan via Phabricator via cfe-commits
amyk created this revision.
amyk added reviewers: PowerPC, power-llvm-team, kamaub, stefanp.
amyk added projects: LLVM, clang.
Herald added subscribers: shchenz, hiraditya, nemanjai.

This patch adds the following function prototypes:

  unsigned long long vec_cntm (vector unsigned char a, const unsigned char mp);
  unsigned long long vec_cntm (vector unsigned short a, const unsigned char mp);
  unsigned long long vec_cntm (vector unsigned int a, const unsigned char mp);
  unsigned long long vec_cntm (vector unsigned long long a, const unsigned char 
mp);

Depends on D82675 .


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D82726

Files:
  clang/include/clang/Basic/BuiltinsPPC.def
  clang/lib/Headers/altivec.h
  clang/test/CodeGen/builtins-ppc-p10vector.c
  llvm/include/llvm/IR/IntrinsicsPowerPC.td
  llvm/lib/Target/PowerPC/PPCInstrPrefix.td
  llvm/test/CodeGen/PowerPC/p10-vector-mask-ops.ll
  llvm/test/MC/Disassembler/PowerPC/p10insts.txt
  llvm/test/MC/PowerPC/p10.s

Index: llvm/test/MC/PowerPC/p10.s
===
--- llvm/test/MC/PowerPC/p10.s
+++ llvm/test/MC/PowerPC/p10.s
@@ -18,6 +18,18 @@
 # CHECK-BE: vextractqm 1, 2   # encoding: [0x10,0x2c,0x16,0x42]
 # CHECK-LE: vextractqm 1, 2   # encoding: [0x42,0x16,0x2c,0x10]
 vextractqm 1, 2
+# CHECK-BE: vcntmbb 1, 2, 1   # encoding: [0x10,0x39,0x16,0x42]
+# CHECK-LE: vcntmbb 1, 2, 1   # encoding: [0x42,0x16,0x39,0x10]
+vcntmbb 1, 2, 1
+# CHECK-BE: vcntmbh 1, 2, 1   # encoding: [0x10,0x3b,0x16,0x42]
+# CHECK-LE: vcntmbh 1, 2, 1   # encoding: [0x42,0x16,0x3b,0x10]
+vcntmbh 1, 2, 1
+# CHECK-BE: vcntmbw 1, 2, 0   # encoding: [0x10,0x3c,0x16,0x42]
+# CHECK-LE: vcntmbw 1, 2, 0   # encoding: [0x42,0x16,0x3c,0x10]
+vcntmbw 1, 2, 0
+# CHECK-BE: vcntmbd 1, 2, 0   # encoding: [0x10,0x3e,0x16,0x42]
+# CHECK-LE: vcntmbd 1, 2, 0   # encoding: [0x42,0x16,0x3e,0x10]
+vcntmbd 1, 2, 0
 # CHECK-BE: vpdepd 1, 2, 0# encoding: [0x10,0x22,0x05,0xcd]
 # CHECK-LE: vpdepd 1, 2, 0# encoding: [0xcd,0x05,0x22,0x10]
 vpdepd 1, 2, 0
Index: llvm/test/MC/Disassembler/PowerPC/p10insts.txt
===
--- llvm/test/MC/Disassembler/PowerPC/p10insts.txt
+++ llvm/test/MC/Disassembler/PowerPC/p10insts.txt
@@ -16,6 +16,18 @@
 # CHECK: vextractqm 1, 2
 0x10 0x2c 0x16 0x42
 
+# CHECK: vcntmbb 1, 2, 1
+0x10 0x39 0x16 0x42
+
+# CHECK: vcntmbh 1, 2, 1
+0x10 0x3b 0x16 0x42
+
+# CHECK: vcntmbw 1, 2, 0
+0x10 0x3c 0x16 0x42
+
+# CHECK: vcntmbd 1, 2, 0
+0x10 0x3e 0x16 0x42
+
 # CHECK: vpdepd 1, 2, 0
 0x10 0x22 0x05 0xcd
 
Index: llvm/test/CodeGen/PowerPC/p10-vector-mask-ops.ll
===
--- llvm/test/CodeGen/PowerPC/p10-vector-mask-ops.ll
+++ llvm/test/CodeGen/PowerPC/p10-vector-mask-ops.ll
@@ -61,3 +61,48 @@
 declare i32 @llvm.ppc.altivec.vextractwm(<4 x i32>)
 declare i32 @llvm.ppc.altivec.vextractdm(<2 x i64>)
 declare i32 @llvm.ppc.altivec.vextractqm(<1 x i128>)
+
+define i64 @test_vcntmbb(<16 x i8> %a) {
+; CHECK-LABEL: test_vcntmbb:
+; CHECK:   # %bb.0: # %entry
+; CHECK-NEXT:vcntmbb r3, v2, 1
+; CHECK-NEXT:blr
+entry:
+  %cnt = tail call i64 @llvm.ppc.altivec.vcntmbb(<16 x i8> %a, i32 1)
+  ret i64 %cnt
+}
+
+define i64 @test_vcntmbh(<8 x i16> %a) {
+; CHECK-LABEL: test_vcntmbh:
+; CHECK:   # %bb.0: # %entry
+; CHECK-NEXT:vcntmbh r3, v2, 0
+; CHECK-NEXT:blr
+entry:
+  %cnt = tail call i64 @llvm.ppc.altivec.vcntmbh(<8 x i16> %a, i32 0)
+  ret i64 %cnt
+}
+
+define i64 @test_vcntmbw(<4 x i32> %a) {
+; CHECK-LABEL: test_vcntmbw:
+; CHECK:   # %bb.0: # %entry
+; CHECK-NEXT:vcntmbw r3, v2, 1
+; CHECK-NEXT:blr
+entry:
+  %cnt = tail call i64 @llvm.ppc.altivec.vcntmbw(<4 x i32> %a, i32 1)
+  ret i64 %cnt
+}
+
+define i64 @test_vcntmbd(<2 x i64> %a) {
+; CHECK-LABEL: test_vcntmbd:
+; CHECK:   # %bb.0: # %entry
+; CHECK-NEXT:vcntmbd r3, v2, 0
+; CHECK-NEXT:blr
+entry:
+  %cnt = tail call i64 @llvm.ppc.altivec.vcntmbd(<2 x i64> %a, i32 0)
+  ret i64 %cnt
+}
+
+declare i64 @llvm.ppc.altivec.vcntmbb(<16 x i8>, i32)
+declare i64 @llvm.ppc.altivec.vcntmbh(<8 x i16>, i32)
+declare i64 @llvm.ppc.altivec.vcntmbw(<4 x i32>, i32)
+declare i64 @llvm.ppc.altivec.vcntmbd(<2 x i64>, i32)
Index: llvm/lib/Target/PowerPC/PPCInstrPrefix.td
===
--- llvm/lib/Target/PowerPC/PPCInstrPrefix.td
+++ llvm/lib/Target/PowerPC/PPCInstrPrefix.td
@@ -225,6 +225,29 @@
   let Inst{21-31} = xo;
 }
 
+// VX-Form: [PO VRT / UIM RB XO].
+// We use VXForm_1 to implement it, that is, we use "VRA" (5 bit) to 

[PATCH] D82727: [PowerPC][Power10] Implement Vector Expand Mask builtins in LLVM/Clang

2020-06-28 Thread Amy Kwan via Phabricator via cfe-commits
amyk created this revision.
amyk added reviewers: power-llvm-team, PowerPC, saghir, bsaleil.
amyk added projects: LLVM, clang.
Herald added subscribers: shchenz, hiraditya, nemanjai.

This patch implements the following function prototypes:

  vector unsigned char vec_expandm (vector unsigned char a);
  vector unsigned short vec_expandm (vector unsigned short a);
  vector unsigned int vec_expandm (vector unsigned int a);
  vector unsigned long long vec_expandm (vector unsigned long long a);
  vector unsigned __int128 vec_expandm (vector unsigned __int128 a);

Depends on D82675 .


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D82727

Files:
  clang/include/clang/Basic/BuiltinsPPC.def
  clang/lib/Headers/altivec.h
  clang/test/CodeGen/builtins-ppc-p10vector.c
  llvm/include/llvm/IR/IntrinsicsPowerPC.td
  llvm/lib/Target/PowerPC/PPCInstrPrefix.td
  llvm/test/CodeGen/PowerPC/p10-vector-mask-ops.ll
  llvm/test/MC/Disassembler/PowerPC/p10insts.txt
  llvm/test/MC/PowerPC/p10.s

Index: llvm/test/MC/PowerPC/p10.s
===
--- llvm/test/MC/PowerPC/p10.s
+++ llvm/test/MC/PowerPC/p10.s
@@ -18,6 +18,21 @@
 # CHECK-BE: vextractqm 1, 2   # encoding: [0x10,0x2c,0x16,0x42]
 # CHECK-LE: vextractqm 1, 2   # encoding: [0x42,0x16,0x2c,0x10]
 vextractqm 1, 2
+# CHECK-BE: vexpandbm 1, 2# encoding: [0x10,0x20,0x16,0x42]
+# CHECK-LE: vexpandbm 1, 2# encoding: [0x42,0x16,0x20,0x10]
+vexpandbm 1, 2
+# CHECK-BE: vexpandhm 1, 2# encoding: [0x10,0x21,0x16,0x42]
+# CHECK-LE: vexpandhm 1, 2# encoding: [0x42,0x16,0x21,0x10]
+vexpandhm 1, 2
+# CHECK-BE: vexpandwm 1, 2# encoding: [0x10,0x22,0x16,0x42]
+# CHECK-LE: vexpandwm 1, 2# encoding: [0x42,0x16,0x22,0x10]
+vexpandwm 1, 2
+# CHECK-BE: vexpanddm 1, 2# encoding: [0x10,0x23,0x16,0x42]
+# CHECK-LE: vexpanddm 1, 2# encoding: [0x42,0x16,0x23,0x10]
+vexpanddm 1, 2
+# CHECK-BE: vexpandqm 1, 2# encoding: [0x10,0x24,0x16,0x42]
+# CHECK-LE: vexpandqm 1, 2# encoding: [0x42,0x16,0x24,0x10]
+vexpandqm 1, 2
 # CHECK-BE: vpdepd 1, 2, 0# encoding: [0x10,0x22,0x05,0xcd]
 # CHECK-LE: vpdepd 1, 2, 0# encoding: [0xcd,0x05,0x22,0x10]
 vpdepd 1, 2, 0
Index: llvm/test/MC/Disassembler/PowerPC/p10insts.txt
===
--- llvm/test/MC/Disassembler/PowerPC/p10insts.txt
+++ llvm/test/MC/Disassembler/PowerPC/p10insts.txt
@@ -16,6 +16,21 @@
 # CHECK: vextractqm 1, 2
 0x10 0x2c 0x16 0x42
 
+# CHECK: vexpandbm 1, 2
+0x10 0x20 0x16 0x42
+
+# CHECK: vexpandhm 1, 2
+0x10 0x21 0x16 0x42
+
+# CHECK: vexpandwm 1, 2
+0x10 0x22 0x16 0x42
+
+# CHECK: vexpanddm 1, 2
+0x10 0x23 0x16 0x42
+
+# CHECK: vexpandqm 1, 2
+0x10 0x24 0x16 0x42
+
 # CHECK: vpdepd 1, 2, 0
 0x10 0x22 0x05 0xcd
 
Index: llvm/test/CodeGen/PowerPC/p10-vector-mask-ops.ll
===
--- llvm/test/CodeGen/PowerPC/p10-vector-mask-ops.ll
+++ llvm/test/CodeGen/PowerPC/p10-vector-mask-ops.ll
@@ -61,3 +61,59 @@
 declare i32 @llvm.ppc.altivec.vextractwm(<4 x i32>)
 declare i32 @llvm.ppc.altivec.vextractdm(<2 x i64>)
 declare i32 @llvm.ppc.altivec.vextractqm(<1 x i128>)
+
+define <16 x i8> @test_vexpandbm(<16 x i8> %a) {
+; CHECK-LABEL: test_vexpandbm:
+; CHECK:   # %bb.0: # %entry
+; CHECK-NEXT:vexpandbm v2, v2
+; CHECK-NEXT:blr
+entry:
+  %exp = tail call <16 x i8> @llvm.ppc.altivec.vexpandbm(<16 x i8> %a)
+  ret <16 x i8> %exp
+}
+
+define <8 x i16> @test_vexpandhm(<8 x i16> %a) {
+; CHECK-LABEL: test_vexpandhm:
+; CHECK:   # %bb.0: # %entry
+; CHECK-NEXT:vexpandhm v2, v2
+; CHECK-NEXT:blr
+entry:
+  %exp = tail call <8 x i16> @llvm.ppc.altivec.vexpandhm(<8 x i16> %a)
+  ret <8 x i16> %exp
+}
+
+define <4 x i32> @test_vexpandwm(<4 x i32> %a) {
+; CHECK-LABEL: test_vexpandwm:
+; CHECK:   # %bb.0: # %entry
+; CHECK-NEXT:vexpandwm v2, v2
+; CHECK-NEXT:blr
+entry:
+  %exp = tail call <4 x i32> @llvm.ppc.altivec.vexpandwm(<4 x i32> %a)
+  ret <4 x i32> %exp
+}
+
+define <2 x i64> @test_vexpanddm(<2 x i64> %a) {
+; CHECK-LABEL: test_vexpanddm:
+; CHECK:   # %bb.0: # %entry
+; CHECK-NEXT:vexpanddm v2, v2
+; CHECK-NEXT:blr
+entry:
+  %exp = tail call <2 x i64> @llvm.ppc.altivec.vexpanddm(<2 x i64> %a)
+  ret <2 x i64> %exp
+}
+
+define <1 x i128> @test_vexpandqm(<1 x i128> %a) {
+; CHECK-LABEL: test_vexpandqm:
+; CHECK:   # %bb.0: # %entry
+; CHECK-NEXT:vexpandqm v2, v2
+; CHECK-NEXT:blr
+entry:
+  %exp = tail call <1 x i128> @llvm.ppc.altivec.vexpandqm(<1 x i128> %a)
+  ret <1 x i128> %exp