[clang] [buildbot] VE builders: disable ctx_profile (PR #89969)

2024-04-24 Thread Kazushi Marukawa via cfe-commits

https://github.com/kaz7 approved this pull request.

This solves a problem in a buildbot for VE. Thank you.

https://github.com/llvm/llvm-project/pull/89969
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [buildbot] VE builders: disable ctx_profile (PR #89969)

2024-04-24 Thread Kazushi Marukawa via cfe-commits

https://github.com/jam7 approved this pull request.

This solves a problem in a buildbot for VE.  Thank you.

https://github.com/llvm/llvm-project/pull/89969
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] Reland Print library module manifest path again (PR #84881)

2024-03-16 Thread Kazushi Marukawa via cfe-commits

https://github.com/kaz7 approved this pull request.

Thank you for updating test scripts.  It works fine in the situation I 
explained before.  It works fine under VE buildbot configuration too.

https://github.com/llvm/llvm-project/pull/84881
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] Reland "[clang][modules] Print library module manifest path." (PR #82160)

2024-03-04 Thread Kazushi Marukawa via cfe-commits

kaz7 wrote:

The point is to build libraries and test clang.  The `TC.getFilePaths` is 
constructed from following items in `ToolChain::ToolChain`

1. `BUILD/bin/../lib/x86_64-unknown-linux-gnu`
2. `%t/Inputs/usr/lib/x86_64-linux-gnu`
3. `%t/Inputs/usr/lib`

Yes.  It contains 1st item at run time if you build not only clang but also 
libraries.  And `GetStdModuleManifestPath` find 
`BUILD/bin/../lib/x86_64-unknown-linux-gnu/libc++.so` at first.  However, 
`modules.json` is not in that directory.  It is in 
`%t/Inputs/usr/lib/x86_64-linux-gnu/modules.json`.

Hope this helps you.


https://github.com/llvm/llvm-project/pull/82160
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] Reland "[clang][modules] Print library module manifest path." (PR #82160)

2024-03-04 Thread Kazushi Marukawa via cfe-commits

kaz7 wrote:

Reverted.  It is possible to reproduce erros by following commands.

```
$ mkdir build
$ cd build
$ cmake -G Ninja -DCMAKE_BUILD_TYPE=Release ../llvm-project/llvm 
-DLLVM_ENABLE_PROJECTS=clang -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind"
$ ninja
$ ninja check-clang


Failed Tests (1):
  Clang :: Driver/modules-print-library-module-manifest-path.cpp
```

https://github.com/llvm/llvm-project/pull/82160
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] c240aca - Revert "Reland "[clang][modules] Print library module manifest path." (#82160)"

2024-03-04 Thread Kazushi Marukawa via cfe-commits

Author: Kazushi (Jam) Marukawa
Date: 2024-03-05T01:34:48+09:00
New Revision: c240aca7a8a71f7218724aeb6c040289b51057dc

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

LOG: Revert "Reland "[clang][modules] Print library module manifest path." 
(#82160)"

This reverts commit 0c89427b99f6f6d7c217c70ff880ca097340f9a4.

Added: 


Modified: 
clang/include/clang/Driver/Driver.h
clang/include/clang/Driver/Options.td
clang/lib/Driver/Driver.cpp

Removed: 
clang/test/Driver/modules-print-library-module-manifest-path.cpp



diff  --git a/clang/include/clang/Driver/Driver.h 
b/clang/include/clang/Driver/Driver.h
index bcf8c1295f2ddf..c4cab360bab3bb 100644
--- a/clang/include/clang/Driver/Driver.h
+++ b/clang/include/clang/Driver/Driver.h
@@ -615,16 +615,6 @@ class Driver {
   // FIXME: This should be in CompilationInfo.
   std::string GetProgramPath(StringRef Name, const ToolChain ) const;
 
-  /// Lookup the path to the Standard library module manifest.
-  ///
-  /// \param C - The compilation.
-  /// \param TC - The tool chain for additional information on
-  /// directories to search.
-  //
-  // FIXME: This should be in CompilationInfo.
-  std::string GetStdModuleManifestPath(const Compilation ,
-   const ToolChain ) const;
-
   /// HandleAutocompletions - Handle --autocomplete by searching and printing
   /// possible flags, descriptions, and its arguments.
   void HandleAutocompletions(StringRef PassedFlags) const;

diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 3e857f4e6faf87..bef38738fde82e 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -5364,9 +5364,6 @@ def print_resource_dir : Flag<["-", "--"], 
"print-resource-dir">,
 def print_search_dirs : Flag<["-", "--"], "print-search-dirs">,
   HelpText<"Print the paths used for finding libraries and programs">,
   Visibility<[ClangOption, CLOption]>;
-def print_std_module_manifest_path : Flag<["-", "--"], 
"print-library-module-manifest-path">,
-  HelpText<"Print the path for the C++ Standard library module manifest">,
-  Visibility<[ClangOption, CLOption]>;
 def print_targets : Flag<["-", "--"], "print-targets">,
   HelpText<"Print the registered targets">,
   Visibility<[ClangOption, CLOption]>;

diff  --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index b8ec0791dc51f7..de8ceb2f0898bb 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -2196,12 +2196,6 @@ bool Driver::HandleImmediateArgs(const Compilation ) {
 return false;
   }
 
-  if (C.getArgs().hasArg(options::OPT_print_std_module_manifest_path)) {
-llvm::outs() << GetStdModuleManifestPath(C, C.getDefaultToolChain())
- << '\n';
-return false;
-  }
-
   if (C.getArgs().hasArg(options::OPT_print_runtime_dir)) {
 if (std::optional RuntimePath = TC.getRuntimePath())
   llvm::outs() << *RuntimePath << '\n';
@@ -6174,44 +6168,6 @@ std::string Driver::GetProgramPath(StringRef Name, const 
ToolChain ) const {
   return std::string(Name);
 }
 
-std::string Driver::GetStdModuleManifestPath(const Compilation ,
- const ToolChain ) const {
-  std::string error = "";
-
-  switch (TC.GetCXXStdlibType(C.getArgs())) {
-  case ToolChain::CST_Libcxx: {
-std::string lib = GetFilePath("libc++.so", TC);
-
-// Note when there are multiple flavours of libc++ the module json needs to
-// look at the command-line arguments for the proper json.
-// These flavours do not exist at the moment, but there are plans to
-// provide a variant that is built with sanitizer instrumentation enabled.
-
-// For example
-//  StringRef modules = [&] {
-//const SanitizerArgs  = TC.getSanitizerArgs(C.getArgs());
-//if (Sanitize.needsAsanRt())
-//  return "modules-asan.json";
-//return "modules.json";
-//  }();
-
-SmallString<128> path(lib.begin(), lib.end());
-llvm::sys::path::remove_filename(path);
-llvm::sys::path::append(path, "modules.json");
-if (TC.getVFS().exists(path))
-  return static_cast(path);
-
-return error;
-  }
-
-  case ToolChain::CST_Libstdcxx:
-// libstdc++ does not provide Standard library modules yet.
-return error;
-  }
-
-  return error;
-}
-
 std::string Driver::GetTemporaryPath(StringRef Prefix, StringRef Suffix) const 
{
   SmallString<128> Path;
   std::error_code EC = llvm::sys::fs::createTemporaryFile(Prefix, Suffix, 
Path);

diff  --git a/clang/test/Driver/modules-print-library-module-manifest-path.cpp 
b/clang/test/Driver/modules-print-library-module-manifest-path.cpp
deleted file mode 100644
index 95bcc59ae23c2a..00

[clang] Reland "[clang][modules] Print library module manifest path." (PR #82160)

2024-03-04 Thread Kazushi Marukawa via cfe-commits

kaz7 wrote:

Unfortunately, this is breaking VE buildbot again.  I'll check the source of 
your problem, but can you revert your patch once?

https://lab.llvm.org/buildbot/#/builders/91/builds/23291

https://github.com/llvm/llvm-project/pull/82160
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang][modules] Print library module manifest path. (PR #76451)

2024-01-22 Thread Kazushi Marukawa via cfe-commits

kaz7 wrote:

Hi @mordante,

Does this test, `Driver/modules-print-library-module-manifest-path.cpp`, work 
on other than x86?  It is failing on VE build bot like below.

https://lab.llvm.org/buildbot/#/builders/91/builds/22189

https://github.com/llvm/llvm-project/pull/76451
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libunwind] [libunwind][WebAssembly] Fix libunwind.cpp guard (PR #78230)

2024-01-16 Thread Kazushi Marukawa via cfe-commits

https://github.com/kaz7 approved this pull request.

It's compilable on VE now.  Thank you!

https://github.com/llvm/llvm-project/pull/78230
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libunwind] [libunwind][WebAssembly] Omit unused parts of libunwind.cpp for Wasm (PR #73196)

2024-01-16 Thread Kazushi Marukawa via cfe-commits


@@ -26,7 +26,7 @@
 #include 
 #endif
 
-#if !defined(__USING_SJLJ_EXCEPTIONS__)
+#if !defined(__USING_SJLJ_EXCEPTIONS__) || !defined(__USING_WASM_EXCEPTIONS__)

kaz7 wrote:

Thanks a lot!!

https://github.com/llvm/llvm-project/pull/73196
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libunwind] [libunwind][WebAssembly] Omit unused parts of libunwind.cpp for Wasm (PR #73196)

2024-01-15 Thread Kazushi Marukawa via cfe-commits


@@ -26,7 +26,7 @@
 #include 
 #endif
 
-#if !defined(__USING_SJLJ_EXCEPTIONS__)
+#if !defined(__USING_SJLJ_EXCEPTIONS__) || !defined(__USING_WASM_EXCEPTIONS__)

kaz7 wrote:

This must be `#if !defined(__USING_SJLJ_EXCEPTIONS__) && 
!defined(__USING_WASM_EXCEPTIONS__)` since we don't want to compile this code 
for either sjlj or wasm users.  `not (sjlj || wasm)` is equal to `not(sjlj) && 
not(wasm)` as you know...

VE use only SjLj, so it should be warnned by the buildbot for VE, but our 
buildbot has been stopped last 2 months.  I've noticed this problem when I've 
been trying to recover our buildbot.  ;-)

https://github.com/llvm/llvm-project/pull/73196
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libunwind] [libunwind][WebAssembly] Omit unused parts of libunwind.cpp for Wasm (PR #73196)

2024-01-15 Thread Kazushi Marukawa via cfe-commits

https://github.com/kaz7 commented:

Please correct this code.  Thank you!

https://github.com/llvm/llvm-project/pull/73196
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libunwind] [libunwind][WebAssembly] Omit unused parts of libunwind.cpp for Wasm (PR #73196)

2024-01-15 Thread Kazushi Marukawa via cfe-commits

https://github.com/kaz7 edited https://github.com/llvm/llvm-project/pull/73196
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] a3c1172 - [Clang][test][VE] Correct bad test in 1e00423

2023-09-29 Thread Kazushi Marukawa via cfe-commits

Author: Kazushi (Jam) Marukawa
Date: 2023-09-30T07:27:00+09:00
New Revision: a3c11723d508efd59dbadcc078fec7513f99fdfd

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

LOG: [Clang][test][VE] Correct bad test in 1e00423

Correct bad test in 1e004237883260d5349d145cefd829824a86cdb8.  This
affects clang-ppc64le-rhel.

Added: 


Modified: 
clang/test/Driver/ve-toolchain.cpp

Removed: 




diff  --git a/clang/test/Driver/ve-toolchain.cpp 
b/clang/test/Driver/ve-toolchain.cpp
index 15a556517182e87..cd48dd792f85826 100644
--- a/clang/test/Driver/ve-toolchain.cpp
+++ b/clang/test/Driver/ve-toolchain.cpp
@@ -13,7 +13,7 @@
 /// Checking include-path
 
 // RUN: %clangxx -### --target=ve-unknown-linux-gnu \
-// RUN: --sysroot %S/Inputs/basic_ve_tree %s \
+// RUN: --sysroot %S/Inputs/basic_ve_tree %s -fuse-ld=ld \
 // RUN: -ccc-install-dir %S/Inputs/basic_ve_tree/bin \
 // RUN: -resource-dir=%S/Inputs/basic_ve_tree/resource_dir \
 // RUN: 2>&1 | FileCheck -check-prefix=DEFINC %s



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


[clang] [Clang][VE] Correct rpath handling on VE (PR #67671)

2023-09-29 Thread Kazushi Marukawa via cfe-commits

https://github.com/kaz7 closed https://github.com/llvm/llvm-project/pull/67671
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Clang][VE] Correct rpath handling on VE (PR #67671)

2023-09-29 Thread Kazushi Marukawa via cfe-commits

https://github.com/kaz7 resolved https://github.com/llvm/llvm-project/pull/67671
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Clang][VE] Correct rpath handling on VE (PR #67671)

2023-09-29 Thread Kazushi Marukawa via cfe-commits

https://github.com/kaz7 resolved https://github.com/llvm/llvm-project/pull/67671
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Clang][VE] Correct rpath handling on VE (PR #67671)

2023-09-28 Thread Kazushi Marukawa via cfe-commits


@@ -2213,12 +2210,12 @@ bool tools::GetSDLFromOffloadArchive(
 
 // Wrapper function used by driver for adding SDLs during link phase.
 void tools::AddStaticDeviceLibsLinking(Compilation , const Tool ,
-const JobAction ,

kaz7 wrote:

Thanks.  I rebased my patch.

https://github.com/llvm/llvm-project/pull/67671
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Clang][VE] Correct rpath handling on VE (PR #67671)

2023-09-28 Thread Kazushi Marukawa via cfe-commits

https://github.com/kaz7 updated https://github.com/llvm/llvm-project/pull/67671

>From 80e49b131f2a00d8eb71e7d23652870b53603a37 Mon Sep 17 00:00:00 2001
From: "Kazushi (Jam) Marukawa" 
Date: Thu, 28 Sep 2023 19:25:09 +0900
Subject: [PATCH] [Clang][VE] Correct rpath handling on VE

Add rpath for libc++ libraries in order to not specify rpath by user each
time.  Disable -frthlib-add-ppath by default for VE similar to other
architectures.  Update regression tests to check modifications.
---
 clang/lib/Driver/ToolChains/CommonArgs.cpp |  5 +
 clang/lib/Driver/ToolChains/VEToolchain.cpp|  8 
 .../ve-unknown-linux-gnu/libc++.so}|  0
 .../clang_rt.crtbegin.o}   |  0
 .../clang_rt.crtend.o} |  0
 .../lib/ve-unknown-linux-gnu/libclang_rt.builtins.a|  0
 clang/test/Driver/ve-toolchain.c   |  8 
 clang/test/Driver/ve-toolchain.cpp | 10 ++
 8 files changed, 19 insertions(+), 12 deletions(-)
 rename 
clang/test/Driver/Inputs/basic_ve_tree/{resource_dir/lib/linux/clang_rt.crtbegin-ve.o
 => lib/ve-unknown-linux-gnu/libc++.so} (100%)
 rename 
clang/test/Driver/Inputs/basic_ve_tree/resource_dir/lib/{linux/clang_rt.crtend-ve.o
 => ve-unknown-linux-gnu/clang_rt.crtbegin.o} (100%)
 rename 
clang/test/Driver/Inputs/basic_ve_tree/resource_dir/lib/{linux/libclang_rt.builtins-ve.a
 => ve-unknown-linux-gnu/clang_rt.crtend.o} (100%)
 create mode 100644 
clang/test/Driver/Inputs/basic_ve_tree/resource_dir/lib/ve-unknown-linux-gnu/libclang_rt.builtins.a

diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp 
b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index 483ecd0ae592a1a..48170fa908fd62f 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -902,11 +902,8 @@ void tools::addOpenMPRuntimeLibraryPath(const ToolChain 
,
 
 void tools::addArchSpecificRPath(const ToolChain , const ArgList ,
  ArgStringList ) {
-  // Enable -frtlib-add-rpath by default for the case of VE.
-  const bool IsVE = TC.getTriple().isVE();
-  bool DefaultValue = IsVE;
   if (!Args.hasFlag(options::OPT_frtlib_add_rpath,
-options::OPT_fno_rtlib_add_rpath, DefaultValue))
+options::OPT_fno_rtlib_add_rpath, false))
 return;
 
   for (const auto  : TC.getArchSpecificLibPaths()) {
diff --git a/clang/lib/Driver/ToolChains/VEToolchain.cpp 
b/clang/lib/Driver/ToolChains/VEToolchain.cpp
index 71b6fe2ea3619c1..39529e0b6b35915 100644
--- a/clang/lib/Driver/ToolChains/VEToolchain.cpp
+++ b/clang/lib/Driver/ToolChains/VEToolchain.cpp
@@ -33,6 +33,7 @@ VEToolChain::VEToolChain(const Driver , const llvm::Triple 
,
   // These are OK.
 
   // Default file paths are following:
+  //   ${RESOURCEDIR}/lib/ve-unknown-linux-gnu, (== getArchSpecificLibPaths)
   //   ${RESOURCEDIR}/lib/linux/ve, (== getArchSpecificLibPaths)
   //   /lib/../lib64,
   //   /usr/lib/../lib64,
@@ -46,6 +47,7 @@ VEToolChain::VEToolChain(const Driver , const llvm::Triple 
,
 
   // Add library directories:
   //   ${BINPATH}/../lib/ve-unknown-linux-gnu, (== getStdlibPath)
+  //   ${RESOURCEDIR}/lib/ve-unknown-linux-gnu, (== getArchSpecificLibPaths)
   //   ${RESOURCEDIR}/lib/linux/ve, (== getArchSpecificLibPaths)
   //   ${SYSROOT}/opt/nec/ve/lib,
   if (std::optional Path = getStdlibPath())
@@ -141,6 +143,12 @@ void VEToolChain::AddCXXStdlibLibArgs(const ArgList ,
 
   tools::addArchSpecificRPath(*this, Args, CmdArgs);
 
+  // Add paths for libc++.so and other shared libraries.
+  if (std::optional Path = getStdlibPath()) {
+CmdArgs.push_back("-rpath");
+CmdArgs.push_back(Args.MakeArgString(*Path));
+  }
+
   CmdArgs.push_back("-lc++");
   if (Args.hasArg(options::OPT_fexperimental_library))
 CmdArgs.push_back("-lc++experimental");
diff --git 
a/clang/test/Driver/Inputs/basic_ve_tree/resource_dir/lib/linux/clang_rt.crtbegin-ve.o
 b/clang/test/Driver/Inputs/basic_ve_tree/lib/ve-unknown-linux-gnu/libc++.so
similarity index 100%
rename from 
clang/test/Driver/Inputs/basic_ve_tree/resource_dir/lib/linux/clang_rt.crtbegin-ve.o
rename to 
clang/test/Driver/Inputs/basic_ve_tree/lib/ve-unknown-linux-gnu/libc++.so
diff --git 
a/clang/test/Driver/Inputs/basic_ve_tree/resource_dir/lib/linux/clang_rt.crtend-ve.o
 
b/clang/test/Driver/Inputs/basic_ve_tree/resource_dir/lib/ve-unknown-linux-gnu/clang_rt.crtbegin.o
similarity index 100%
rename from 
clang/test/Driver/Inputs/basic_ve_tree/resource_dir/lib/linux/clang_rt.crtend-ve.o
rename to 
clang/test/Driver/Inputs/basic_ve_tree/resource_dir/lib/ve-unknown-linux-gnu/clang_rt.crtbegin.o
diff --git 
a/clang/test/Driver/Inputs/basic_ve_tree/resource_dir/lib/linux/libclang_rt.builtins-ve.a
 
b/clang/test/Driver/Inputs/basic_ve_tree/resource_dir/lib/ve-unknown-linux-gnu/clang_rt.crtend.o
similarity index 100%
rename from 

[clang] [Clang][VE] Correct rpath handling on VE (PR #67671)

2023-09-28 Thread Kazushi Marukawa via cfe-commits

https://github.com/kaz7 updated https://github.com/llvm/llvm-project/pull/67671

>From f50505a9eb1d86f029bf552cd846ccc8c6deb0e4 Mon Sep 17 00:00:00 2001
From: "Kazushi (Jam) Marukawa" 
Date: Thu, 28 Sep 2023 19:25:09 +0900
Subject: [PATCH 1/2] [Clang][VE] Correct rpath handling on VE

Add rpath for libc++ libraries in order to not specify rpath by user each
time.  Disable -frthlib-add-ppath by default for VE similar to other
architectures.  Update regression tests to check modifications.
---
 clang/lib/Driver/ToolChains/CommonArgs.cpp |  5 +
 clang/lib/Driver/ToolChains/VEToolchain.cpp|  8 
 .../ve-unknown-linux-gnu/libc++.so}|  0
 .../clang_rt.crtbegin.o}   |  0
 .../clang_rt.crtend.o} |  0
 .../lib/ve-unknown-linux-gnu/libclang_rt.builtins.a|  0
 clang/test/Driver/ve-toolchain.c   |  8 
 clang/test/Driver/ve-toolchain.cpp | 10 ++
 8 files changed, 19 insertions(+), 12 deletions(-)
 rename 
clang/test/Driver/Inputs/basic_ve_tree/{resource_dir/lib/linux/clang_rt.crtbegin-ve.o
 => lib/ve-unknown-linux-gnu/libc++.so} (100%)
 rename 
clang/test/Driver/Inputs/basic_ve_tree/resource_dir/lib/{linux/clang_rt.crtend-ve.o
 => ve-unknown-linux-gnu/clang_rt.crtbegin.o} (100%)
 rename 
clang/test/Driver/Inputs/basic_ve_tree/resource_dir/lib/{linux/libclang_rt.builtins-ve.a
 => ve-unknown-linux-gnu/clang_rt.crtend.o} (100%)
 create mode 100644 
clang/test/Driver/Inputs/basic_ve_tree/resource_dir/lib/ve-unknown-linux-gnu/libclang_rt.builtins.a

diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp 
b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index 6041ef4aeb673ef..e07744e42968596 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -882,11 +882,8 @@ void tools::addOpenMPRuntimeLibraryPath(const ToolChain 
,
 
 void tools::addArchSpecificRPath(const ToolChain , const ArgList ,
  ArgStringList ) {
-  // Enable -frtlib-add-rpath by default for the case of VE.
-  const bool IsVE = TC.getTriple().isVE();
-  bool DefaultValue = IsVE;
   if (!Args.hasFlag(options::OPT_frtlib_add_rpath,
-options::OPT_fno_rtlib_add_rpath, DefaultValue))
+options::OPT_fno_rtlib_add_rpath, false))
 return;
 
   for (const auto  : TC.getArchSpecificLibPaths()) {
diff --git a/clang/lib/Driver/ToolChains/VEToolchain.cpp 
b/clang/lib/Driver/ToolChains/VEToolchain.cpp
index 71b6fe2ea3619c1..39529e0b6b35915 100644
--- a/clang/lib/Driver/ToolChains/VEToolchain.cpp
+++ b/clang/lib/Driver/ToolChains/VEToolchain.cpp
@@ -33,6 +33,7 @@ VEToolChain::VEToolChain(const Driver , const llvm::Triple 
,
   // These are OK.
 
   // Default file paths are following:
+  //   ${RESOURCEDIR}/lib/ve-unknown-linux-gnu, (== getArchSpecificLibPaths)
   //   ${RESOURCEDIR}/lib/linux/ve, (== getArchSpecificLibPaths)
   //   /lib/../lib64,
   //   /usr/lib/../lib64,
@@ -46,6 +47,7 @@ VEToolChain::VEToolChain(const Driver , const llvm::Triple 
,
 
   // Add library directories:
   //   ${BINPATH}/../lib/ve-unknown-linux-gnu, (== getStdlibPath)
+  //   ${RESOURCEDIR}/lib/ve-unknown-linux-gnu, (== getArchSpecificLibPaths)
   //   ${RESOURCEDIR}/lib/linux/ve, (== getArchSpecificLibPaths)
   //   ${SYSROOT}/opt/nec/ve/lib,
   if (std::optional Path = getStdlibPath())
@@ -141,6 +143,12 @@ void VEToolChain::AddCXXStdlibLibArgs(const ArgList ,
 
   tools::addArchSpecificRPath(*this, Args, CmdArgs);
 
+  // Add paths for libc++.so and other shared libraries.
+  if (std::optional Path = getStdlibPath()) {
+CmdArgs.push_back("-rpath");
+CmdArgs.push_back(Args.MakeArgString(*Path));
+  }
+
   CmdArgs.push_back("-lc++");
   if (Args.hasArg(options::OPT_fexperimental_library))
 CmdArgs.push_back("-lc++experimental");
diff --git 
a/clang/test/Driver/Inputs/basic_ve_tree/resource_dir/lib/linux/clang_rt.crtbegin-ve.o
 b/clang/test/Driver/Inputs/basic_ve_tree/lib/ve-unknown-linux-gnu/libc++.so
similarity index 100%
rename from 
clang/test/Driver/Inputs/basic_ve_tree/resource_dir/lib/linux/clang_rt.crtbegin-ve.o
rename to 
clang/test/Driver/Inputs/basic_ve_tree/lib/ve-unknown-linux-gnu/libc++.so
diff --git 
a/clang/test/Driver/Inputs/basic_ve_tree/resource_dir/lib/linux/clang_rt.crtend-ve.o
 
b/clang/test/Driver/Inputs/basic_ve_tree/resource_dir/lib/ve-unknown-linux-gnu/clang_rt.crtbegin.o
similarity index 100%
rename from 
clang/test/Driver/Inputs/basic_ve_tree/resource_dir/lib/linux/clang_rt.crtend-ve.o
rename to 
clang/test/Driver/Inputs/basic_ve_tree/resource_dir/lib/ve-unknown-linux-gnu/clang_rt.crtbegin.o
diff --git 
a/clang/test/Driver/Inputs/basic_ve_tree/resource_dir/lib/linux/libclang_rt.builtins-ve.a
 
b/clang/test/Driver/Inputs/basic_ve_tree/resource_dir/lib/ve-unknown-linux-gnu/clang_rt.crtend.o
similarity index 100%
rename from 

[clang] [Clang][VE] Correct rpath handling on VE (PR #67671)

2023-09-28 Thread Kazushi Marukawa via cfe-commits

https://github.com/kaz7 created https://github.com/llvm/llvm-project/pull/67671

Add rpath for libc++ libraries in order to not specify rpath by user each time. 
 Disable -frthlib-add-ppath by default for VE similar to other architectures.  
Update regression tests to check modifications.

>From f50505a9eb1d86f029bf552cd846ccc8c6deb0e4 Mon Sep 17 00:00:00 2001
From: "Kazushi (Jam) Marukawa" 
Date: Thu, 28 Sep 2023 19:25:09 +0900
Subject: [PATCH] [Clang][VE] Correct rpath handling on VE

Add rpath for libc++ libraries in order to not specify rpath by user each
time.  Disable -frthlib-add-ppath by default for VE similar to other
architectures.  Update regression tests to check modifications.
---
 clang/lib/Driver/ToolChains/CommonArgs.cpp |  5 +
 clang/lib/Driver/ToolChains/VEToolchain.cpp|  8 
 .../ve-unknown-linux-gnu/libc++.so}|  0
 .../clang_rt.crtbegin.o}   |  0
 .../clang_rt.crtend.o} |  0
 .../lib/ve-unknown-linux-gnu/libclang_rt.builtins.a|  0
 clang/test/Driver/ve-toolchain.c   |  8 
 clang/test/Driver/ve-toolchain.cpp | 10 ++
 8 files changed, 19 insertions(+), 12 deletions(-)
 rename 
clang/test/Driver/Inputs/basic_ve_tree/{resource_dir/lib/linux/clang_rt.crtbegin-ve.o
 => lib/ve-unknown-linux-gnu/libc++.so} (100%)
 rename 
clang/test/Driver/Inputs/basic_ve_tree/resource_dir/lib/{linux/clang_rt.crtend-ve.o
 => ve-unknown-linux-gnu/clang_rt.crtbegin.o} (100%)
 rename 
clang/test/Driver/Inputs/basic_ve_tree/resource_dir/lib/{linux/libclang_rt.builtins-ve.a
 => ve-unknown-linux-gnu/clang_rt.crtend.o} (100%)
 create mode 100644 
clang/test/Driver/Inputs/basic_ve_tree/resource_dir/lib/ve-unknown-linux-gnu/libclang_rt.builtins.a

diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp 
b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index 6041ef4aeb673ef..e07744e42968596 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -882,11 +882,8 @@ void tools::addOpenMPRuntimeLibraryPath(const ToolChain 
,
 
 void tools::addArchSpecificRPath(const ToolChain , const ArgList ,
  ArgStringList ) {
-  // Enable -frtlib-add-rpath by default for the case of VE.
-  const bool IsVE = TC.getTriple().isVE();
-  bool DefaultValue = IsVE;
   if (!Args.hasFlag(options::OPT_frtlib_add_rpath,
-options::OPT_fno_rtlib_add_rpath, DefaultValue))
+options::OPT_fno_rtlib_add_rpath, false))
 return;
 
   for (const auto  : TC.getArchSpecificLibPaths()) {
diff --git a/clang/lib/Driver/ToolChains/VEToolchain.cpp 
b/clang/lib/Driver/ToolChains/VEToolchain.cpp
index 71b6fe2ea3619c1..39529e0b6b35915 100644
--- a/clang/lib/Driver/ToolChains/VEToolchain.cpp
+++ b/clang/lib/Driver/ToolChains/VEToolchain.cpp
@@ -33,6 +33,7 @@ VEToolChain::VEToolChain(const Driver , const llvm::Triple 
,
   // These are OK.
 
   // Default file paths are following:
+  //   ${RESOURCEDIR}/lib/ve-unknown-linux-gnu, (== getArchSpecificLibPaths)
   //   ${RESOURCEDIR}/lib/linux/ve, (== getArchSpecificLibPaths)
   //   /lib/../lib64,
   //   /usr/lib/../lib64,
@@ -46,6 +47,7 @@ VEToolChain::VEToolChain(const Driver , const llvm::Triple 
,
 
   // Add library directories:
   //   ${BINPATH}/../lib/ve-unknown-linux-gnu, (== getStdlibPath)
+  //   ${RESOURCEDIR}/lib/ve-unknown-linux-gnu, (== getArchSpecificLibPaths)
   //   ${RESOURCEDIR}/lib/linux/ve, (== getArchSpecificLibPaths)
   //   ${SYSROOT}/opt/nec/ve/lib,
   if (std::optional Path = getStdlibPath())
@@ -141,6 +143,12 @@ void VEToolChain::AddCXXStdlibLibArgs(const ArgList ,
 
   tools::addArchSpecificRPath(*this, Args, CmdArgs);
 
+  // Add paths for libc++.so and other shared libraries.
+  if (std::optional Path = getStdlibPath()) {
+CmdArgs.push_back("-rpath");
+CmdArgs.push_back(Args.MakeArgString(*Path));
+  }
+
   CmdArgs.push_back("-lc++");
   if (Args.hasArg(options::OPT_fexperimental_library))
 CmdArgs.push_back("-lc++experimental");
diff --git 
a/clang/test/Driver/Inputs/basic_ve_tree/resource_dir/lib/linux/clang_rt.crtbegin-ve.o
 b/clang/test/Driver/Inputs/basic_ve_tree/lib/ve-unknown-linux-gnu/libc++.so
similarity index 100%
rename from 
clang/test/Driver/Inputs/basic_ve_tree/resource_dir/lib/linux/clang_rt.crtbegin-ve.o
rename to 
clang/test/Driver/Inputs/basic_ve_tree/lib/ve-unknown-linux-gnu/libc++.so
diff --git 
a/clang/test/Driver/Inputs/basic_ve_tree/resource_dir/lib/linux/clang_rt.crtend-ve.o
 
b/clang/test/Driver/Inputs/basic_ve_tree/resource_dir/lib/ve-unknown-linux-gnu/clang_rt.crtbegin.o
similarity index 100%
rename from 
clang/test/Driver/Inputs/basic_ve_tree/resource_dir/lib/linux/clang_rt.crtend-ve.o
rename to 
clang/test/Driver/Inputs/basic_ve_tree/resource_dir/lib/ve-unknown-linux-gnu/clang_rt.crtbegin.o
diff --git 

[libunwind] [libunwind][nfc] Avoid type warning of debug printf (PR #67390)

2023-09-28 Thread Kazushi Marukawa via cfe-commits

https://github.com/kaz7 closed https://github.com/llvm/llvm-project/pull/67390
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libunwind] [libunwind][nfc] Avoid type warning of debug printf (PR #67390)

2023-09-26 Thread Kazushi Marukawa via cfe-commits

kaz7 wrote:

Update the top comment to describe what I modify.

https://github.com/llvm/llvm-project/pull/67390
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libunwind] [libunwind][nfc] Avoid type warning of debug printf (PR #67390)

2023-09-26 Thread Kazushi Marukawa via cfe-commits

https://github.com/kaz7 edited https://github.com/llvm/llvm-project/pull/67390
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libunwind] [libunwind][nfc] Avoid type warning of debug printf (PR #67390)

2023-09-26 Thread Kazushi Marukawa via cfe-commits

https://github.com/kaz7 updated https://github.com/llvm/llvm-project/pull/67390

>From 18e3568db4a3a11c794f077e9effd0a713dbd2dc Mon Sep 17 00:00:00 2001
From: "Kazushi (Jam) Marukawa" 
Date: Sun, 24 Sep 2023 08:08:24 +0200
Subject: [PATCH 1/2] [libunwind][nfc] Avoid type warning of debug printf

Avoid type warning of debug printf since VE uses 64 bits SjLj.
---
 libunwind/src/Unwind-sjlj.c | 18 --
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/libunwind/src/Unwind-sjlj.c b/libunwind/src/Unwind-sjlj.c
index 4d9a02699cddd78..f24088a0e98ae99 100644
--- a/libunwind/src/Unwind-sjlj.c
+++ b/libunwind/src/Unwind-sjlj.c
@@ -42,12 +42,18 @@ struct _Unwind_FunctionContext {
 
   // set by personality handler to be parameters passed to landing pad function
   uint64_tresumeParameters[4];
+
+  // specify format for debug dump of resumeLocation and resumeParameters[]
+#define SJLJ_PRI_PTR PRIxPTR
 #else
   // set by calling function before registering to be the landing pad
   uint32_tresumeLocation;
 
   // set by personality handler to be parameters passed to landing pad function
   uint32_tresumeParameters[4];
+
+  // specify format for debug dump of resumeLocation and resumeParameters[]
+#define SJLJ_PRI_PTR PRIuPTR
 #endif
 
   // set by calling function before registering
@@ -427,9 +433,9 @@ _LIBUNWIND_EXPORT uintptr_t _Unwind_GetGR(struct 
_Unwind_Context *context,
 /// Called by personality handler during phase 2 to alter register values.
 _LIBUNWIND_EXPORT void _Unwind_SetGR(struct _Unwind_Context *context, int 
index,
  uintptr_t new_value) {
-  _LIBUNWIND_TRACE_API("_Unwind_SetGR(context=%p, reg=%d, value=0x%" PRIuPTR
-   ")",
-   (void *)context, index, new_value);
+  _LIBUNWIND_TRACE_API(
+  "_Unwind_SetGR(context=%p, reg=%d, value=0x%" SJLJ_PRI_PTR ")",
+  (void *)context, index, new_value);
   _Unwind_FunctionContext_t ufc = (_Unwind_FunctionContext_t) context;
   ufc->resumeParameters[index] = new_value;
 }
@@ -438,7 +444,7 @@ _LIBUNWIND_EXPORT void _Unwind_SetGR(struct _Unwind_Context 
*context, int index,
 /// Called by personality handler during phase 2 to get instruction pointer.
 _LIBUNWIND_EXPORT uintptr_t _Unwind_GetIP(struct _Unwind_Context *context) {
   _Unwind_FunctionContext_t ufc = (_Unwind_FunctionContext_t) context;
-  _LIBUNWIND_TRACE_API("_Unwind_GetIP(context=%p) => 0x%" PRIu32,
+  _LIBUNWIND_TRACE_API("_Unwind_GetIP(context=%p) => 0x%" SJLJ_PRI_PTR,
(void *)context, ufc->resumeLocation + 1);
   return ufc->resumeLocation + 1;
 }
@@ -451,7 +457,7 @@ _LIBUNWIND_EXPORT uintptr_t _Unwind_GetIPInfo(struct 
_Unwind_Context *context,
   int *ipBefore) {
   _Unwind_FunctionContext_t ufc = (_Unwind_FunctionContext_t) context;
   *ipBefore = 0;
-  _LIBUNWIND_TRACE_API("_Unwind_GetIPInfo(context=%p, %p) => 0x%" PRIu32,
+  _LIBUNWIND_TRACE_API("_Unwind_GetIPInfo(context=%p, %p) => 0x%" SJLJ_PRI_PTR,
(void *)context, (void *)ipBefore,
ufc->resumeLocation + 1);
   return ufc->resumeLocation + 1;
@@ -461,7 +467,7 @@ _LIBUNWIND_EXPORT uintptr_t _Unwind_GetIPInfo(struct 
_Unwind_Context *context,
 /// Called by personality handler during phase 2 to alter instruction pointer.
 _LIBUNWIND_EXPORT void _Unwind_SetIP(struct _Unwind_Context *context,
  uintptr_t new_value) {
-  _LIBUNWIND_TRACE_API("_Unwind_SetIP(context=%p, value=0x%" PRIuPTR ")",
+  _LIBUNWIND_TRACE_API("_Unwind_SetIP(context=%p, value=0x%" SJLJ_PRI_PTR ")",
(void *)context, new_value);
   _Unwind_FunctionContext_t ufc = (_Unwind_FunctionContext_t) context;
   ufc->resumeLocation = new_value - 1;

>From 0da56a015da4158c067c692fcaf6549752534419 Mon Sep 17 00:00:00 2001
From: "Kazushi (Jam) Marukawa" 
Date: Wed, 27 Sep 2023 02:23:40 +0200
Subject: [PATCH 2/2] Change to use PRIxPTR in order to follow suggestions.

---
 libunwind/src/Unwind-sjlj.c | 18 ++
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/libunwind/src/Unwind-sjlj.c b/libunwind/src/Unwind-sjlj.c
index f24088a0e98ae99..7e8faf098fe14b1 100644
--- a/libunwind/src/Unwind-sjlj.c
+++ b/libunwind/src/Unwind-sjlj.c
@@ -42,18 +42,12 @@ struct _Unwind_FunctionContext {
 
   // set by personality handler to be parameters passed to landing pad function
   uint64_tresumeParameters[4];
-
-  // specify format for debug dump of resumeLocation and resumeParameters[]
-#define SJLJ_PRI_PTR PRIxPTR
 #else
   // set by calling function before registering to be the landing pad
   uint32_tresumeLocation;
 
   // set by personality handler to be parameters passed to landing pad function
   uint32_tresumeParameters[4];
-
-  // specify format 

[libunwind] [libunwind][nfc] Avoid type warning of debug printf (PR #67390)

2023-09-26 Thread Kazushi Marukawa via cfe-commits

kaz7 wrote:

@arichardson Thank for your kind comment.  I confused them already.  I update 
my patch following your 2nd suggestion.

https://github.com/llvm/llvm-project/pull/67390
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libunwind] [libunwind][nfc] Avoid type warning of debug printf (PR #67390)

2023-09-25 Thread Kazushi Marukawa via cfe-commits

https://github.com/kaz7 created https://github.com/llvm/llvm-project/pull/67390

Avoid type warning of debug printf since VE uses 64 bits SjLj.

>From 18e3568db4a3a11c794f077e9effd0a713dbd2dc Mon Sep 17 00:00:00 2001
From: "Kazushi (Jam) Marukawa" 
Date: Sun, 24 Sep 2023 08:08:24 +0200
Subject: [PATCH] [libunwind][nfc] Avoid type warning of debug printf

Avoid type warning of debug printf since VE uses 64 bits SjLj.
---
 libunwind/src/Unwind-sjlj.c | 18 --
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/libunwind/src/Unwind-sjlj.c b/libunwind/src/Unwind-sjlj.c
index 4d9a02699cddd78..f24088a0e98ae99 100644
--- a/libunwind/src/Unwind-sjlj.c
+++ b/libunwind/src/Unwind-sjlj.c
@@ -42,12 +42,18 @@ struct _Unwind_FunctionContext {
 
   // set by personality handler to be parameters passed to landing pad function
   uint64_tresumeParameters[4];
+
+  // specify format for debug dump of resumeLocation and resumeParameters[]
+#define SJLJ_PRI_PTR PRIxPTR
 #else
   // set by calling function before registering to be the landing pad
   uint32_tresumeLocation;
 
   // set by personality handler to be parameters passed to landing pad function
   uint32_tresumeParameters[4];
+
+  // specify format for debug dump of resumeLocation and resumeParameters[]
+#define SJLJ_PRI_PTR PRIuPTR
 #endif
 
   // set by calling function before registering
@@ -427,9 +433,9 @@ _LIBUNWIND_EXPORT uintptr_t _Unwind_GetGR(struct 
_Unwind_Context *context,
 /// Called by personality handler during phase 2 to alter register values.
 _LIBUNWIND_EXPORT void _Unwind_SetGR(struct _Unwind_Context *context, int 
index,
  uintptr_t new_value) {
-  _LIBUNWIND_TRACE_API("_Unwind_SetGR(context=%p, reg=%d, value=0x%" PRIuPTR
-   ")",
-   (void *)context, index, new_value);
+  _LIBUNWIND_TRACE_API(
+  "_Unwind_SetGR(context=%p, reg=%d, value=0x%" SJLJ_PRI_PTR ")",
+  (void *)context, index, new_value);
   _Unwind_FunctionContext_t ufc = (_Unwind_FunctionContext_t) context;
   ufc->resumeParameters[index] = new_value;
 }
@@ -438,7 +444,7 @@ _LIBUNWIND_EXPORT void _Unwind_SetGR(struct _Unwind_Context 
*context, int index,
 /// Called by personality handler during phase 2 to get instruction pointer.
 _LIBUNWIND_EXPORT uintptr_t _Unwind_GetIP(struct _Unwind_Context *context) {
   _Unwind_FunctionContext_t ufc = (_Unwind_FunctionContext_t) context;
-  _LIBUNWIND_TRACE_API("_Unwind_GetIP(context=%p) => 0x%" PRIu32,
+  _LIBUNWIND_TRACE_API("_Unwind_GetIP(context=%p) => 0x%" SJLJ_PRI_PTR,
(void *)context, ufc->resumeLocation + 1);
   return ufc->resumeLocation + 1;
 }
@@ -451,7 +457,7 @@ _LIBUNWIND_EXPORT uintptr_t _Unwind_GetIPInfo(struct 
_Unwind_Context *context,
   int *ipBefore) {
   _Unwind_FunctionContext_t ufc = (_Unwind_FunctionContext_t) context;
   *ipBefore = 0;
-  _LIBUNWIND_TRACE_API("_Unwind_GetIPInfo(context=%p, %p) => 0x%" PRIu32,
+  _LIBUNWIND_TRACE_API("_Unwind_GetIPInfo(context=%p, %p) => 0x%" SJLJ_PRI_PTR,
(void *)context, (void *)ipBefore,
ufc->resumeLocation + 1);
   return ufc->resumeLocation + 1;
@@ -461,7 +467,7 @@ _LIBUNWIND_EXPORT uintptr_t _Unwind_GetIPInfo(struct 
_Unwind_Context *context,
 /// Called by personality handler during phase 2 to alter instruction pointer.
 _LIBUNWIND_EXPORT void _Unwind_SetIP(struct _Unwind_Context *context,
  uintptr_t new_value) {
-  _LIBUNWIND_TRACE_API("_Unwind_SetIP(context=%p, value=0x%" PRIuPTR ")",
+  _LIBUNWIND_TRACE_API("_Unwind_SetIP(context=%p, value=0x%" SJLJ_PRI_PTR ")",
(void *)context, new_value);
   _Unwind_FunctionContext_t ufc = (_Unwind_FunctionContext_t) context;
   ufc->resumeLocation = new_value - 1;

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


[clang] [CMake] Add VE cache file (PR #65921)

2023-09-25 Thread Kazushi Marukawa via cfe-commits

https://github.com/kaz7 closed https://github.com/llvm/llvm-project/pull/65921
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libunwind] [libunwind][nfc] avoid prototype warning (PR #67250)

2023-09-24 Thread Kazushi Marukawa via cfe-commits

https://github.com/kaz7 closed https://github.com/llvm/llvm-project/pull/67250
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libunwind] [libunwind][nfc] avoid prototype warning (PR #67250)

2023-09-24 Thread Kazushi Marukawa via cfe-commits

kaz7 wrote:

This is "NFC" commit, so I'm going to merge this without reviewers.  Let me 
know if someone has problem on this.

https://github.com/llvm/llvm-project/pull/67250
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [CMake] Add VE cache file (PR #65921)

2023-09-24 Thread Kazushi Marukawa via cfe-commits

kaz7 wrote:

ping.  Is it possible to look over this someone in pr-subscribers-clang?  Or is 
it OK to merge this since this is a cache file for cmake to compile llvm for 
VE?  Thanks in advance!

https://github.com/llvm/llvm-project/pull/65921
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libunwind] [libunwind][nfc] avoid prototype warning (PR #67250)

2023-09-23 Thread Kazushi Marukawa via cfe-commits

https://github.com/kaz7 created https://github.com/llvm/llvm-project/pull/67250

Avoid following prototype related warning.

Unwind-sjlj.c:85:75: warning: a function declaration without a prototype is 
deprecated in all versions of C [-Wstrict-prototypes]

>From 5c4fbab9e6140cd6a7ec2edfcdb4bcd615a38a89 Mon Sep 17 00:00:00 2001
From: "Kazushi (Jam) Marukawa" 
Date: Sun, 24 Sep 2023 09:26:15 +0900
Subject: [PATCH] [libunwind][nfc] avoid prototype warning

Avoid following prototype related warning.

Unwind-sjlj.c:85:75: warning: a function declaration without a prototype is 
deprecated in all versions of C [-Wstrict-prototypes]
---
 libunwind/src/Unwind-sjlj.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libunwind/src/Unwind-sjlj.c b/libunwind/src/Unwind-sjlj.c
index 90a55fd29db1faa..4d9a02699cddd78 100644
--- a/libunwind/src/Unwind-sjlj.c
+++ b/libunwind/src/Unwind-sjlj.c
@@ -82,7 +82,8 @@ struct _Unwind_FunctionContext {
 static _LIBUNWIND_THREAD_LOCAL struct _Unwind_FunctionContext *stack = NULL;
 #endif
 
-static struct _Unwind_FunctionContext *__Unwind_SjLj_GetTopOfFunctionStack() {
+static struct _Unwind_FunctionContext *
+__Unwind_SjLj_GetTopOfFunctionStack(void) {
 #if defined(__APPLE__)
   return _pthread_getspecific_direct(__PTK_LIBC_DYLD_Unwind_SjLj_Key);
 #else

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


[clang] [CMake] Add VE cache file (PR #65921)

2023-09-13 Thread Kazushi Marukawa via cfe-commits

kaz7 wrote:

Add a comment to the cache file and rebase.

https://github.com/llvm/llvm-project/pull/65921
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [CMake] Add VE cache file (PR #65921)

2023-09-13 Thread Kazushi Marukawa via cfe-commits

https://github.com/kaz7 updated https://github.com/llvm/llvm-project/pull/65921:

>From 7c1a3ccb7977781ec8b45f4c230520abeca907f5 Mon Sep 17 00:00:00 2001
From: "Kazushi (Jam) Marukawa" 
Date: Mon, 11 Sep 2023 11:46:56 +0900
Subject: [PATCH] [CMake] Add VE cache file

Add VE cache file for the ease of compiling.
---
 clang/cmake/caches/VectorEngine.cmake | 129 ++
 1 file changed, 129 insertions(+)
 create mode 100644 clang/cmake/caches/VectorEngine.cmake

diff --git a/clang/cmake/caches/VectorEngine.cmake 
b/clang/cmake/caches/VectorEngine.cmake
new file mode 100644
index 000..e3976f3206db530
--- /dev/null
+++ b/clang/cmake/caches/VectorEngine.cmake
@@ -0,0 +1,129 @@
+# This file sets up a CMakeCache for the simple VE build.
+#
+# VE is a CPU with vector engine.  But it is a connected to a host CPU as
+# an accelerator.  So, we compile programs for VE on a host using clang/llvm
+# as a cross compiler.  Therefore, the purpose of this cache file is to
+# compile clang/llvm supporting both targets.
+#
+# Configure:
+#   cmake -G Ninja -DCMAKE_BUILD_TYPE=Release
+#   -C /clang/cmake/caches/VectorEngine.cmake
+#   /llvm-project/llvm
+# Build:
+#   ninja
+#
+
+# Disable TERMINFO, ZLIB, and ZSTD for VE since there is no pre-compiled
+# libraries.
+set(LLVM_ENABLE_TERMINFO OFF CACHE BOOL "")
+set(LLVM_ENABLE_ZLIB OFF CACHE BOOL "")
+set(LLVM_ENABLE_ZSTD OFF CACHE BOOL "")
+
+# Enable per-target runtimes directory
+set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR On CACHE BOOL "")
+
+# The lld is not supported for VE yet.
+set(LLVM_ENABLE_PROJECTS "clang;clang-tools-extra" CACHE STRING "")
+set(LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind;openmp" CACHE 
STRING "")
+
+# Compile for X86 and VE
+set(LLVM_TARGETS_TO_BUILD "X86;VE" CACHE STRING "")
+
+# Not use default here to use RUNTIMES_x86_64-unknown-linux-gnu_* variables.
+set(LLVM_BUILTIN_TARGETS "x86_64-unknown-linux-gnu;ve-unknown-linux-gnu" CACHE 
STRING "")
+set(LLVM_RUNTIME_TARGETS "x86_64-unknown-linux-gnu;ve-unknown-linux-gnu" CACHE 
STRING "")
+
+# For the case of X86, we don't want to test compiler-rt for x86,
+# so disable them as much as possible.
+set(RUNTIMES_x86_64-unknown-linux-gnu_COMPILER_RT_BUILD_BUILTINS ON CACHE BOOL 
"")
+set(RUNTIMES_x86_64-unknown-linux-gnu_COMPILER_RT_BUILD_CRT OFF CACHE BOOL "")
+set(RUNTIMES_x86_64-unknown-linux-gnu_COMPILER_RT_BUILD_SANITIZERS OFF CACHE 
BOOL "")
+set(RUNTIMES_x86_64-unknown-linux-gnu_COMPILER_RT_BUILD_XRAY OFF CACHE BOOL "")
+set(RUNTIMES_x86_64-unknown-linux-gnu_COMPILER_RT_BUILD_LIBFUZZER OFF CACHE 
BOOL "")
+set(RUNTIMES_x86_64-unknown-linux-gnu_COMPILER_RT_BUILD_PROFILE OFF CACHE BOOL 
"")
+set(RUNTIMES_x86_64-unknown-linux-gnu_COMPILER_RT_BUILD_MEMPROF OFF CACHE BOOL 
"")
+set(RUNTIMES_x86_64-unknown-linux-gnu_COMPILER_RT_BUILD_ORC OFF CACHE BOOL "")
+set(RUNTIMES_x86_64-unknown-linux-gnu_COMPILER_RT_BUILD_GWP_ASAN OFF CACHE 
BOOL "")
+
+# VE supports builtins, crt, and profile only.
+set(RUNTIMES_ve-unknown-linux-gnu_COMPILER_RT_BUILD_BUILTINS ON CACHE BOOL "")
+set(RUNTIMES_ve-unknown-linux-gnu_COMPILER_RT_BUILD_CRT ON CACHE BOOL "")
+set(RUNTIMES_ve-unknown-linux-gnu_COMPILER_RT_BUILD_SANITIZERS OFF CACHE BOOL 
"")
+set(RUNTIMES_ve-unknown-linux-gnu_COMPILER_RT_BUILD_XRAY OFF CACHE BOOL "")
+set(RUNTIMES_ve-unknown-linux-gnu_COMPILER_RT_BUILD_LIBFUZZER OFF CACHE BOOL 
"")
+set(RUNTIMES_ve-unknown-linux-gnu_COMPILER_RT_BUILD_PROFILE ON CACHE BOOL "")
+set(RUNTIMES_ve-unknown-linux-gnu_COMPILER_RT_BUILD_MEMPROF OFF CACHE BOOL "")
+set(RUNTIMES_ve-unknown-linux-gnu_COMPILER_RT_BUILD_ORC OFF CACHE BOOL "")
+set(RUNTIMES_ve-unknown-linux-gnu_COMPILER_RT_BUILD_GWP_ASAN OFF CACHE BOOL "")
+
+# VE uses builtins from Compiler-RT.
+set(RUNTIMES_ve-unknown-linux-gnu_COMPILER_RT_USE_BUILTINS_LIBRARY TRUE CACHE 
BOOL "")
+
+# VE uses libunwind and Compiler-RT from libcxxabi.
+set(RUNTIMES_ve-unknown-linux-gnu_LIBCXXABI_USE_LLVM_UNWINDER TRUE CACHE BOOL 
"")
+set(RUNTIMES_ve-unknown-linux-gnu_LIBCXXABI_USE_COMPILER_RT TRUE CACHE BOOL "")
+
+# VE uses Compiler-RT from libcxx.
+set(RUNTIMES_ve-unknown-linux-gnu_LIBCXX_USE_COMPILER_RT TRUE CACHE BOOL "")
+
+# Pretended standalone build for OpenMP since OpenMP doesn't support
+# LLVM_ENABLE_PER_TARGET_RUNTIME_DIR yet.
+#   - Use OPENMP_STANDALONE_BUILD
+#   - Define OPENMP_LIBDIR_SUFFIX to pretend per-target openmp directory
+#   - Define OPENMP_LLVM_TOOLS_DIR for test
+set(RUNTIMES_x86_64-unknown-linux-gnu_OPENMP_STANDALONE_BUILD ON CACHE BOOL "")
+set(RUNTIMES_ve-unknown-linux-gnu_OPENMP_STANDALONE_BUILD ON CACHE BOOL "")
+
+# Specify LIBDIR_SUFFIX for OpenMP to install them at following directories.
+#   install/lib/clang/${VERSION}/lib/x86_64-unknown-linux-gnu
+#   install/lib/clang/${VERSION}/lib/ve-unknown-linux-gnu
+set(RUNTIMES_x86_64-unknown-linux-gnu_OPENMP_LIBDIR_SUFFIX 
"/x86_64-unknown-linux-gnu" CACHE STRING "")
+set(RUNTIMES_ve-unknown-linux-gnu_OPENMP_LIBDIR_SUFFIX "/ve-unknown-linux-gnu" 
CACHE 

[clang] [CMake] Add VE cache file (PR #65921)

2023-09-10 Thread Kazushi Marukawa via cfe-commits

https://github.com/kaz7 review_requested 
https://github.com/llvm/llvm-project/pull/65921
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [CMake] Add VE cache file (PR #65921)

2023-09-10 Thread Kazushi Marukawa via cfe-commits

https://github.com/kaz7 labeled https://github.com/llvm/llvm-project/pull/65921
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [CMake] Add VE cache file (PR #65921)

2023-09-10 Thread Kazushi Marukawa via cfe-commits

https://github.com/kaz7 created https://github.com/llvm/llvm-project/pull/65921:

Add VE cache file for the ease of compiling.

>From fd2b43aaf57427699be9caab9ff32e1190b15de0 Mon Sep 17 00:00:00 2001
From: "Kazushi (Jam) Marukawa" 
Date: Mon, 11 Sep 2023 11:46:56 +0900
Subject: [PATCH] [CMake] Add VE cache file

Add VE cache file for the ease of compiling.
---
 clang/cmake/caches/VectorEngine.cmake | 124 ++
 1 file changed, 124 insertions(+)
 create mode 100644 clang/cmake/caches/VectorEngine.cmake

diff --git a/clang/cmake/caches/VectorEngine.cmake 
b/clang/cmake/caches/VectorEngine.cmake
new file mode 100644
index 000..100225dbd4ca665
--- /dev/null
+++ b/clang/cmake/caches/VectorEngine.cmake
@@ -0,0 +1,124 @@
+# This file sets up a CMakeCache for the simple VE build.
+#
+# Configure:
+#   cmake -G Ninja -DCMAKE_BUILD_TYPE=Release
+#   -C /clang/cmake/caches/VectorEngine.cmake
+#   /llvm-project/llvm
+# Build:
+#   ninja
+#
+
+# Disable TERMINFO, ZLIB, and ZSTD for VE since there is no pre-compiled
+# libraries.
+set(LLVM_ENABLE_TERMINFO OFF CACHE BOOL "")
+set(LLVM_ENABLE_ZLIB OFF CACHE BOOL "")
+set(LLVM_ENABLE_ZSTD OFF CACHE BOOL "")
+
+# Enable per-target runtimes directory
+set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR On CACHE BOOL "")
+
+# The lld is not supported for VE yet.
+set(LLVM_ENABLE_PROJECTS "clang;clang-tools-extra" CACHE STRING "")
+set(LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind;openmp" CACHE 
STRING "")
+
+# Compile for X86 and VE
+set(LLVM_TARGETS_TO_BUILD "X86;VE" CACHE STRING "")
+
+# Not use default here to use RUNTIMES_x86_64-unknown-linux-gnu_* variables.
+set(LLVM_BUILTIN_TARGETS "x86_64-unknown-linux-gnu;ve-unknown-linux-gnu" CACHE 
STRING "")
+set(LLVM_RUNTIME_TARGETS "x86_64-unknown-linux-gnu;ve-unknown-linux-gnu" CACHE 
STRING "")
+
+# For the case of X86, we don't want to test compiler-rt for x86,
+# so disable them as much as possible.
+set(RUNTIMES_x86_64-unknown-linux-gnu_COMPILER_RT_BUILD_BUILTINS ON CACHE BOOL 
"")
+set(RUNTIMES_x86_64-unknown-linux-gnu_COMPILER_RT_BUILD_CRT OFF CACHE BOOL "")
+set(RUNTIMES_x86_64-unknown-linux-gnu_COMPILER_RT_BUILD_SANITIZERS OFF CACHE 
BOOL "")
+set(RUNTIMES_x86_64-unknown-linux-gnu_COMPILER_RT_BUILD_XRAY OFF CACHE BOOL "")
+set(RUNTIMES_x86_64-unknown-linux-gnu_COMPILER_RT_BUILD_LIBFUZZER OFF CACHE 
BOOL "")
+set(RUNTIMES_x86_64-unknown-linux-gnu_COMPILER_RT_BUILD_PROFILE OFF CACHE BOOL 
"")
+set(RUNTIMES_x86_64-unknown-linux-gnu_COMPILER_RT_BUILD_MEMPROF OFF CACHE BOOL 
"")
+set(RUNTIMES_x86_64-unknown-linux-gnu_COMPILER_RT_BUILD_ORC OFF CACHE BOOL "")
+set(RUNTIMES_x86_64-unknown-linux-gnu_COMPILER_RT_BUILD_GWP_ASAN OFF CACHE 
BOOL "")
+
+# VE supports builtins, crt, and profile only.
+set(RUNTIMES_ve-unknown-linux-gnu_COMPILER_RT_BUILD_BUILTINS ON CACHE BOOL "")
+set(RUNTIMES_ve-unknown-linux-gnu_COMPILER_RT_BUILD_CRT ON CACHE BOOL "")
+set(RUNTIMES_ve-unknown-linux-gnu_COMPILER_RT_BUILD_SANITIZERS OFF CACHE BOOL 
"")
+set(RUNTIMES_ve-unknown-linux-gnu_COMPILER_RT_BUILD_XRAY OFF CACHE BOOL "")
+set(RUNTIMES_ve-unknown-linux-gnu_COMPILER_RT_BUILD_LIBFUZZER OFF CACHE BOOL 
"")
+set(RUNTIMES_ve-unknown-linux-gnu_COMPILER_RT_BUILD_PROFILE ON CACHE BOOL "")
+set(RUNTIMES_ve-unknown-linux-gnu_COMPILER_RT_BUILD_MEMPROF OFF CACHE BOOL "")
+set(RUNTIMES_ve-unknown-linux-gnu_COMPILER_RT_BUILD_ORC OFF CACHE BOOL "")
+set(RUNTIMES_ve-unknown-linux-gnu_COMPILER_RT_BUILD_GWP_ASAN OFF CACHE BOOL "")
+
+# VE uses builtins from Compiler-RT.
+set(RUNTIMES_ve-unknown-linux-gnu_COMPILER_RT_USE_BUILTINS_LIBRARY TRUE CACHE 
BOOL "")
+
+# VE uses libunwind and Compiler-RT from libcxxabi.
+set(RUNTIMES_ve-unknown-linux-gnu_LIBCXXABI_USE_LLVM_UNWINDER TRUE CACHE BOOL 
"")
+set(RUNTIMES_ve-unknown-linux-gnu_LIBCXXABI_USE_COMPILER_RT TRUE CACHE BOOL "")
+
+# VE uses Compiler-RT from libcxx.
+set(RUNTIMES_ve-unknown-linux-gnu_LIBCXX_USE_COMPILER_RT TRUE CACHE BOOL "")
+
+# Pretended standalone build for OpenMP since OpenMP doesn't support
+# LLVM_ENABLE_PER_TARGET_RUNTIME_DIR yet.
+#   - Use OPENMP_STANDALONE_BUILD
+#   - Define OPENMP_LIBDIR_SUFFIX to pretend per-target openmp directory
+#   - Define OPENMP_LLVM_TOOLS_DIR for test
+set(RUNTIMES_x86_64-unknown-linux-gnu_OPENMP_STANDALONE_BUILD ON CACHE BOOL "")
+set(RUNTIMES_ve-unknown-linux-gnu_OPENMP_STANDALONE_BUILD ON CACHE BOOL "")
+
+# Specify LIBDIR_SUFFIX for OpenMP to install them at following directories.
+#   install/lib/clang/${VERSION}/lib/x86_64-unknown-linux-gnu
+#   install/lib/clang/${VERSION}/lib/ve-unknown-linux-gnu
+set(RUNTIMES_x86_64-unknown-linux-gnu_OPENMP_LIBDIR_SUFFIX 
"/x86_64-unknown-linux-gnu" CACHE STRING "")
+set(RUNTIMES_ve-unknown-linux-gnu_OPENMP_LIBDIR_SUFFIX "/ve-unknown-linux-gnu" 
CACHE STRING "")
+
+# Specify OPENMP_LLVM_TOOLS_DIR for test
+set(RUNTIMES_x86_64-unknown-linux-gnu_OPENMP_LLVM_TOOLS_DIR 
"${CMAKE_BINARY_DIR}/bin" CACHE STRING "")
+set(RUNTIMES_ve-unknown-linux-gnu_OPENMP_LLVM_TOOLS_DIR 

[clang] b6ce860 - [Driver][VE] Change to enable VPU flag by default

2023-08-31 Thread Kazushi Marukawa via cfe-commits

Author: Kazushi (Jam) Marukawa
Date: 2023-09-01T00:41:38+09:00
New Revision: b6ce860024013397982cdd26b762df8182b14df9

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

LOG: [Driver][VE] Change to enable VPU flag by default

Change to enable VPU flag for VE by default in order to support vector
intrinsics from clang.

Reviewed By: efocht, MaskRay

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

Added: 
clang/test/Driver/ve-features.c

Modified: 
clang/include/clang/Driver/Options.td
clang/lib/Driver/ToolChains/Arch/VE.cpp

Removed: 




diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index b8b02af9f35f0c..3d73e24a4dc5af 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -199,6 +199,8 @@ def m_x86_Features_Group : OptionGroup<"">,
DocName<"X86">;
 def m_riscv_Features_Group : OptionGroup<"">,
  Group, DocName<"RISC-V">;
+def m_ve_Features_Group : OptionGroup<"">,
+  Group, DocName<"VE">;
 
 def m_libc_Group : OptionGroup<"">, Group,
Flags<[HelpHidden]>;
@@ -5845,6 +5847,13 @@ def mno_scatter : Flag<["-"], "mno-scatter">, 
Group,
   HelpText<"Disable generation of scatter instructions in 
auto-vectorization(x86 only)">;
 } // let Flags = [TargetSpecific]
 
+// VE feature flags
+let Flags = [TargetSpecific] in {
+def mvevpu : Flag<["-"], "mvevpu">, Group,
+  HelpText<"Emit VPU instructions for VE">;
+def mno_vevpu : Flag<["-"], "mno-vevpu">, Group;
+} // let Flags = [TargetSpecific]
+
 // These are legacy user-facing driver-level option spellings. They are always
 // aliases for options that are spelled using the more common Unix / GNU flag
 // style of double-dash and equals-joined flags.

diff  --git a/clang/lib/Driver/ToolChains/Arch/VE.cpp 
b/clang/lib/Driver/ToolChains/Arch/VE.cpp
index 97d74eb4e5efd0..b19760898c6477 100644
--- a/clang/lib/Driver/ToolChains/Arch/VE.cpp
+++ b/clang/lib/Driver/ToolChains/Arch/VE.cpp
@@ -18,4 +18,9 @@ using namespace clang;
 using namespace llvm::opt;
 
 void ve::getVETargetFeatures(const Driver , const ArgList ,
- std::vector ) {}
+ std::vector ) {
+  if (Args.hasFlag(options::OPT_mvevpu, options::OPT_mno_vevpu, true))
+Features.push_back("+vpu");
+  else
+Features.push_back("-vpu");
+}

diff  --git a/clang/test/Driver/ve-features.c b/clang/test/Driver/ve-features.c
new file mode 100644
index 00..5e233b0893a3cf
--- /dev/null
+++ b/clang/test/Driver/ve-features.c
@@ -0,0 +1,5 @@
+// RUN: %clang --target=ve-unknown-linux-gnu -### %s 2>&1 | FileCheck %s 
-check-prefix=DEFAULT
+// RUN: %clang --target=ve-unknown-linux-gnu -### %s -mvevpu -mno-vevpu 2>&1 | 
FileCheck %s -check-prefix=NO-VEVPU
+
+// DEFAULT: "-target-feature" "+vpu"
+// NO-VEVPU: "-target-feature" "-vpu"



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


[clang] 5ba0a95 - [Clang][VE] Add missing intrinsics

2022-06-20 Thread Kazushi Marukawa via cfe-commits

Author: Kazushi (Jam) Marukawa
Date: 2022-06-21T07:30:36+09:00
New Revision: 5ba0a9571b3ee3bc76f65e16549012a440d5a0fb

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

LOG: [Clang][VE] Add missing intrinsics

Add missing intrinsics and tests for them.  An expanding  macro
from _vel_pack_f32p to __builtin_ve_vl_pack_f32p and others is
already defined in clang/lib/Headers/velintrin.h.

Reviewed By: efocht

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

Added: 


Modified: 
clang/include/clang/Basic/BuiltinsVE.def
clang/test/CodeGen/VE/ve-velintrin.c

Removed: 




diff  --git a/clang/include/clang/Basic/BuiltinsVE.def 
b/clang/include/clang/Basic/BuiltinsVE.def
index 29b2bd203ef0f..3bffb241d8dc6 100644
--- a/clang/include/clang/Basic/BuiltinsVE.def
+++ b/clang/include/clang/Basic/BuiltinsVE.def
@@ -15,6 +15,16 @@
 #   define TARGET_BUILTIN(ID, TYPE, ATTRS, FEATURE) BUILTIN(ID, TYPE, ATTRS)
 #endif
 
+// The format of this database is decribed in clang/Basic/Builtins.def.
+
+BUILTIN(__builtin_ve_vl_pack_f32p, "ULifC*fC*", "n")
+BUILTIN(__builtin_ve_vl_pack_f32a, "ULifC*", "n")
+
+BUILTIN(__builtin_ve_vl_extract_vm512u, "V256bV512b", "n")
+BUILTIN(__builtin_ve_vl_extract_vm512l, "V256bV512b", "n")
+BUILTIN(__builtin_ve_vl_insert_vm512u, "V512bV512bV256b", "n")
+BUILTIN(__builtin_ve_vl_insert_vm512l, "V512bV512bV256b", "n")
+
 // Use generated BUILTIN definitions
 #include "clang/Basic/BuiltinsVEVL.gen.def"
 

diff  --git a/clang/test/CodeGen/VE/ve-velintrin.c 
b/clang/test/CodeGen/VE/ve-velintrin.c
index 1a9aea66ea01e..f9942751fff9c 100644
--- a/clang/test/CodeGen/VE/ve-velintrin.c
+++ b/clang/test/CodeGen/VE/ve-velintrin.c
@@ -1,7 +1,7 @@
 // REQUIRES: ve-registered-target
 
-// RUN: %clang_cc1 -no-opaque-pointers -S -emit-llvm -triple 
ve-unknown-linux-gnu \
-// RUN:   -ffreestanding %s -o - | FileCheck %s
+// RUN: %clang_cc1 -S -emit-llvm -triple ve-unknown-linux-gnu \
+// RUN:   -no-opaque-pointers -ffreestanding %s -o - | FileCheck %s
 
 #include 
 
@@ -8811,3 +8811,48 @@ test_svob() {
   // CHECK: call void @llvm.ve.vl.svob()
   _vel_svob();
 }
+
+void __attribute__((noinline))
+test_pack_f32p(float* p1, float* p2) {
+  // CHECK-LABEL: @test_pack_f32p
+  // CHECK: %[[VAR1:[A-Za-z0-9.]+]] = bitcast float* %{{.*}} to i8*
+  // CHECK: %[[VAR2:[A-Za-z0-9.]+]] = bitcast float* %{{.*}} to i8*
+  // CHECK-NEXT: call i64 @llvm.ve.vl.pack.f32p(i8* %[[VAR1]], i8* %[[VAR2]])
+  v1 = _vel_pack_f32p(p1, p2);
+}
+
+void __attribute__((noinline))
+test_pack_f32a(float* p) {
+  // CHECK-LABEL: @test_pack_f32a
+  // CHECK: %[[VAR3:[A-Za-z0-9.]+]] = bitcast float* %{{.*}} to i8*
+  // CHECK-NEXT: call i64 @llvm.ve.vl.pack.f32a(i8* %[[VAR3]])
+  v1 = _vel_pack_f32a(p);
+}
+
+void __attribute__((noinline))
+test_extract_vm512u() {
+  // CHECK-LABEL: @test_extract_vm512u
+  // CHECK: call <256 x i1> @llvm.ve.vl.extract.vm512u(<512 x i1> %{{.*}})
+  vm1 = _vel_extract_vm512u(vm1_512);
+}
+
+void __attribute__((noinline))
+test_extract_vm512l() {
+  // CHECK-LABEL: @test_extract_vm512l
+  // CHECK: call <256 x i1> @llvm.ve.vl.extract.vm512l(<512 x i1> %{{.*}})
+  vm1 = _vel_extract_vm512l(vm1_512);
+}
+
+void __attribute__((noinline))
+test_insert_vm512u() {
+  // CHECK-LABEL: @test_insert_vm512u
+  // CHECK: call <512 x i1> @llvm.ve.vl.insert.vm512u(<512 x i1> %{{.*}}, <256 
x i1> %{{.*}})
+  vm1_512 = _vel_insert_vm512u(vm1_512, vm1);
+}
+
+void __attribute__((noinline))
+test_insert_vm512l() {
+  // CHECK-LABEL: @test_insert_vm512l
+  // CHECK: call <512 x i1> @llvm.ve.vl.insert.vm512l(<512 x i1> %{{.*}}, <256 
x i1> %{{.*}})
+  vm1_512 = _vel_insert_vm512l(vm1_512, vm1);
+}



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


[clang] 140ad7d - [Clang][VE][NFC] Fix a comment

2022-06-11 Thread Kazushi Marukawa via cfe-commits

Author: Kazushi (Jam) Marukawa
Date: 2022-06-12T10:27:30+09:00
New Revision: 140ad7d37813e525a202f38ceac64d7e12b38930

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

LOG: [Clang][VE][NFC] Fix a comment

Added: 


Modified: 
clang/lib/Driver/ToolChains/Arch/VE.h

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/Arch/VE.h 
b/clang/lib/Driver/ToolChains/Arch/VE.h
index 531433534914c..c47a41df25bc4 100644
--- a/clang/lib/Driver/ToolChains/Arch/VE.h
+++ b/clang/lib/Driver/ToolChains/Arch/VE.h
@@ -24,7 +24,7 @@ void getVETargetFeatures(const Driver , const 
llvm::opt::ArgList ,
  std::vector );
 
 } // end namespace ve
-} // namespace tools
+} // end namespace tools
 } // end namespace driver
 } // end namespace clang
 



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


[clang] b1b4b6f - [Clang][VE] Add vector load intrinsics

2022-03-11 Thread Kazushi Marukawa via cfe-commits

Author: Kazushi (Jam) Marukawa
Date: 2022-03-12T09:09:57+09:00
New Revision: b1b4b6f366956a5fd1bfccb3d7c2f7519ed45a28

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

LOG: [Clang][VE] Add vector load intrinsics

Add vector load intrinsic instructions for VE.

Reviewed By: simoll

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

Added: 
clang/include/clang/Basic/BuiltinsVE.def
clang/include/clang/Basic/BuiltinsVEVL.gen.def
clang/lib/Headers/velintrin.h
clang/lib/Headers/velintrin_gen.h
clang/test/CodeGen/VE/ve-velintrin.c

Modified: 
clang/include/clang/Basic/TargetBuiltins.h
clang/include/clang/module.modulemap
clang/lib/Basic/Targets/VE.cpp
clang/lib/CodeGen/CGBuiltin.cpp
clang/lib/Headers/CMakeLists.txt

Removed: 




diff  --git a/clang/include/clang/Basic/BuiltinsVE.def 
b/clang/include/clang/Basic/BuiltinsVE.def
new file mode 100644
index 0..1cb5250893819
--- /dev/null
+++ b/clang/include/clang/Basic/BuiltinsVE.def
@@ -0,0 +1,17 @@
+//===--- BuiltinsVE.def - VE Builtin function database --*- C++ 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+//
+// This file defines the VE-specific builtin function database.  Users of
+// this file must define the BUILTIN macro to make use of this information.
+//
+//===--===//
+
+// Use generated BUILTIN definitions
+#include "clang/Basic/BuiltinsVEVL.gen.def"
+
+#undef BUILTIN

diff  --git a/clang/include/clang/Basic/BuiltinsVEVL.gen.def 
b/clang/include/clang/Basic/BuiltinsVEVL.gen.def
new file mode 100644
index 0..d90e35e917451
--- /dev/null
+++ b/clang/include/clang/Basic/BuiltinsVEVL.gen.def
@@ -0,0 +1,32 @@
+BUILTIN(__builtin_ve_vl_vld_vssl, "V256dLUivC*Ui", "n")
+BUILTIN(__builtin_ve_vl_vld_vssvl, "V256dLUivC*V256dUi", "n")
+BUILTIN(__builtin_ve_vl_vldnc_vssl, "V256dLUivC*Ui", "n")
+BUILTIN(__builtin_ve_vl_vldnc_vssvl, "V256dLUivC*V256dUi", "n")
+BUILTIN(__builtin_ve_vl_vldu_vssl, "V256dLUivC*Ui", "n")
+BUILTIN(__builtin_ve_vl_vldu_vssvl, "V256dLUivC*V256dUi", "n")
+BUILTIN(__builtin_ve_vl_vldunc_vssl, "V256dLUivC*Ui", "n")
+BUILTIN(__builtin_ve_vl_vldunc_vssvl, "V256dLUivC*V256dUi", "n")
+BUILTIN(__builtin_ve_vl_vldlsx_vssl, "V256dLUivC*Ui", "n")
+BUILTIN(__builtin_ve_vl_vldlsx_vssvl, "V256dLUivC*V256dUi", "n")
+BUILTIN(__builtin_ve_vl_vldlsxnc_vssl, "V256dLUivC*Ui", "n")
+BUILTIN(__builtin_ve_vl_vldlsxnc_vssvl, "V256dLUivC*V256dUi", "n")
+BUILTIN(__builtin_ve_vl_vldlzx_vssl, "V256dLUivC*Ui", "n")
+BUILTIN(__builtin_ve_vl_vldlzx_vssvl, "V256dLUivC*V256dUi", "n")
+BUILTIN(__builtin_ve_vl_vldlzxnc_vssl, "V256dLUivC*Ui", "n")
+BUILTIN(__builtin_ve_vl_vldlzxnc_vssvl, "V256dLUivC*V256dUi", "n")
+BUILTIN(__builtin_ve_vl_vld2d_vssl, "V256dLUivC*Ui", "n")
+BUILTIN(__builtin_ve_vl_vld2d_vssvl, "V256dLUivC*V256dUi", "n")
+BUILTIN(__builtin_ve_vl_vld2dnc_vssl, "V256dLUivC*Ui", "n")
+BUILTIN(__builtin_ve_vl_vld2dnc_vssvl, "V256dLUivC*V256dUi", "n")
+BUILTIN(__builtin_ve_vl_vldu2d_vssl, "V256dLUivC*Ui", "n")
+BUILTIN(__builtin_ve_vl_vldu2d_vssvl, "V256dLUivC*V256dUi", "n")
+BUILTIN(__builtin_ve_vl_vldu2dnc_vssl, "V256dLUivC*Ui", "n")
+BUILTIN(__builtin_ve_vl_vldu2dnc_vssvl, "V256dLUivC*V256dUi", "n")
+BUILTIN(__builtin_ve_vl_vldl2dsx_vssl, "V256dLUivC*Ui", "n")
+BUILTIN(__builtin_ve_vl_vldl2dsx_vssvl, "V256dLUivC*V256dUi", "n")
+BUILTIN(__builtin_ve_vl_vldl2dsxnc_vssl, "V256dLUivC*Ui", "n")
+BUILTIN(__builtin_ve_vl_vldl2dsxnc_vssvl, "V256dLUivC*V256dUi", "n")
+BUILTIN(__builtin_ve_vl_vldl2dzx_vssl, "V256dLUivC*Ui", "n")
+BUILTIN(__builtin_ve_vl_vldl2dzx_vssvl, "V256dLUivC*V256dUi", "n")
+BUILTIN(__builtin_ve_vl_vldl2dzxnc_vssl, "V256dLUivC*Ui", "n")
+BUILTIN(__builtin_ve_vl_vldl2dzxnc_vssvl, "V256dLUivC*V256dUi", "n")

diff  --git a/clang/include/clang/Basic/TargetBuiltins.h 
b/clang/include/clang/Basic/TargetBuiltins.h
index d4ea8e98b2e3f..d8ad9858d8c80 100644
--- a/clang/include/clang/Basic/TargetBuiltins.h
+++ b/clang/include/clang/Basic/TargetBuiltins.h
@@ -121,7 +121,12 @@ namespace clang {
 
   /// VE builtins
   namespace VE {
-  enum { LastTIBuiltin = clang::Builtin::FirstTSBuiltin - 1, LastTSBuiltin };
+  enum {
+LastTIBuiltin = clang::Builtin::FirstTSBuiltin - 1,
+#define BUILTIN(ID, TYPE, ATTRS) BI##ID,
+#include "clang/Basic/BuiltinsVE.def"
+LastTSBuiltin
+  };
   }
 
   namespace RISCVVector {

diff  --git a/clang/include/clang/module.modulemap 
b/clang/include/clang/module.modulemap
index 2b73cd5451b7e..981f32aa25a10 100644
--- 

[clang] 83f5725 - [VE] Support multiple architectures installation

2021-12-06 Thread Kazushi Marukawa via cfe-commits

Author: Kazushi (Jam) Marukawa
Date: 2021-12-06T19:56:41+09:00
New Revision: 83f572527e0fcc1cd0be8ee23bc12abf27027daf

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

LOG: [VE] Support multiple architectures installation

Change C++ header files placement to support multiple LLVM_RUNTIME_TARGETS
build.  Also modifies regression test for it.

Reviewed By: simoll

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

Added: 
clang/test/Driver/Inputs/basic_ve_tree/bin/.keep
clang/test/Driver/Inputs/basic_ve_tree/include/c++/v1/.keep

clang/test/Driver/Inputs/basic_ve_tree/include/ve-unknown-linux-gnu/c++/v1/.keep

Modified: 
clang/lib/Driver/ToolChains/VEToolchain.cpp
clang/test/Driver/ve-toolchain.c
clang/test/Driver/ve-toolchain.cpp

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/VEToolchain.cpp 
b/clang/lib/Driver/ToolChains/VEToolchain.cpp
index 1fcc52684baa3..4cdeec7f9d8a9 100644
--- a/clang/lib/Driver/ToolChains/VEToolchain.cpp
+++ b/clang/lib/Driver/ToolChains/VEToolchain.cpp
@@ -28,17 +28,27 @@ VEToolChain::VEToolChain(const Driver , const 
llvm::Triple ,
   getProgramPaths().push_back("/opt/nec/ve/bin");
   // ProgramPaths are found via 'PATH' environment variable.
 
-  // default file paths are:
-  //   ${RESOURCEDIR}/lib/linux/ve (== getArchSpecificLibPath)
-  //   /lib/../lib64
-  //   /usr/lib/../lib64
-  //   ${BINPATH}/../lib
-  //   /lib
-  //   /usr/lib
-  //
-  // These are OK for host, but no go for VE.  So, defines them all
-  // from scratch here.
+  // Default library paths are following:
+  //   ${RESOURCEDIR}/lib/ve-unknown-linux-gnu,
+  // These are OK.
+
+  // Default file paths are following:
+  //   ${RESOURCEDIR}/lib/linux/ve, (== getArchSpecificLibPath)
+  //   /lib/../lib64,
+  //   /usr/lib/../lib64,
+  //   ${BINPATH}/../lib,
+  //   /lib,
+  //   /usr/lib,
+  // These are OK for host, but no go for VE.
+
+  // Define file paths from scratch here.
   getFilePaths().clear();
+
+  // Add library directories:
+  //   ${BINPATH}/../lib/ve-unknown-linux-gnu, (== getStdlibPath)
+  //   ${RESOURCEDIR}/lib/linux/ve, (== getArchSpecificLibPath)
+  //   ${SYSROOT}/opt/nec/ve/lib,
+  getFilePaths().push_back(getStdlibPath());
   getFilePaths().push_back(getArchSpecificLibPath());
   getFilePaths().push_back(computeSysRoot() + "/opt/nec/ve/lib");
 }
@@ -115,9 +125,10 @@ void VEToolChain::AddClangCXXStdlibIncludeArgs(const 
ArgList ,
 ArrayRef DirVec(Dirs);
 addSystemIncludes(DriverArgs, CC1Args, DirVec);
   } else {
-SmallString<128> P(getDriver().ResourceDir);
-llvm::sys::path::append(P, "include/c++/v1");
-addSystemInclude(DriverArgs, CC1Args, P);
+// Add following paths for multiple target installation.
+//   ${INSTALLDIR}/include/ve-unknown-linux-gnu/c++/v1,
+//   ${INSTALLDIR}/include/c++/v1,
+addLibCxxIncludePaths(DriverArgs, CC1Args);
   }
 }
 

diff  --git a/clang/test/Driver/Inputs/basic_ve_tree/bin/.keep 
b/clang/test/Driver/Inputs/basic_ve_tree/bin/.keep
new file mode 100644
index 0..e69de29bb2d1d

diff  --git a/clang/test/Driver/Inputs/basic_ve_tree/include/c++/v1/.keep 
b/clang/test/Driver/Inputs/basic_ve_tree/include/c++/v1/.keep
new file mode 100644
index 0..e69de29bb2d1d

diff  --git 
a/clang/test/Driver/Inputs/basic_ve_tree/include/ve-unknown-linux-gnu/c++/v1/.keep
 
b/clang/test/Driver/Inputs/basic_ve_tree/include/ve-unknown-linux-gnu/c++/v1/.keep
new file mode 100644
index 0..e69de29bb2d1d

diff  --git a/clang/test/Driver/ve-toolchain.c 
b/clang/test/Driver/ve-toolchain.c
index fc6a0cf88765c..8878bd8f83cc0 100644
--- a/clang/test/Driver/ve-toolchain.c
+++ b/clang/test/Driver/ve-toolchain.c
@@ -12,7 +12,7 @@
 /// Checking include-path
 
 // RUN: %clang -### -target ve --sysroot %S/Inputs/basic_ve_tree %s \
-// RUN: -resource-dir=%S/Input/basic_ve_tree/resource_dir \
+// RUN: -resource-dir=%S/Inputs/basic_ve_tree/resource_dir \
 // RUN: 2>&1 | FileCheck -check-prefix=DEFINC %s
 // DEFINC: clang{{.*}} "-cc1"
 // DEFINC-SAME: "-nostdsysteminc"
@@ -22,7 +22,7 @@
 // DEFINC-SAME: "-internal-isystem" "[[SYSROOT]]/opt/nec/ve/include"
 
 // RUN: %clang -### -target ve --sysroot %S/Inputs/basic_ve_tree %s \
-// RUN: -resource-dir=%S/Input/basic_ve_tree/resource_dir \
+// RUN: -resource-dir=%S/Inputs/basic_ve_tree/resource_dir \
 // RUN: -nostdlibinc 2>&1 | FileCheck -check-prefix=NOSTDLIBINC %s
 // NOSTDLIBINC: clang{{.*}} "-cc1"
 // NOSTDLIBINC-SAME: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
@@ -31,7 +31,7 @@
 // NOSTDLIBINC-NOT: "-internal-isystem" "[[SYSROOT]]/opt/nec/ve/include"
 
 // RUN: %clang -### -target ve --sysroot %S/Inputs/basic_ve_tree %s \
-// RUN: -resource-dir=%S/Input/basic_ve_tree/resource_dir \
+// RUN:   

[clang] 3d32218 - [VE] Change to omitting the frame pointer on leaf functions

2021-11-03 Thread Kazushi Marukawa via cfe-commits

Author: Kazushi (Jam) Marukawa
Date: 2021-11-03T17:45:18+09:00
New Revision: 3d32218d1af29a86389357b75af31af36dec051a

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

LOG: [VE] Change to omitting the frame pointer on leaf functions

Change to omitting the frame pointer on leaf functions by default for VE.

Reviewed By: simoll

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

Added: 


Modified: 
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/Driver/frame-pointer-elim.c

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index c77413ddf1ace..2dd10a7b31061 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -613,7 +613,8 @@ getFramePointerKind(const ArgList , const llvm::Triple 
) {
   A && A->getOption().matches(options::OPT_fno_omit_frame_pointer);
   bool OmitLeafFP = Args.hasFlag(options::OPT_momit_leaf_frame_pointer,
  options::OPT_mno_omit_leaf_frame_pointer,
- Triple.isAArch64() || Triple.isPS4CPU());
+ Triple.isAArch64() || Triple.isPS4CPU() ||
+ Triple.isVE());
   if (NoOmitFP || mustUseNonLeafFramePointerForTarget(Triple) ||
   (!OmitFP && useFramePointerForTargetByDefault(Args, Triple))) {
 if (OmitLeafFP)

diff  --git a/clang/test/Driver/frame-pointer-elim.c 
b/clang/test/Driver/frame-pointer-elim.c
index 83dbf3816b684..beb14a9a671a6 100644
--- a/clang/test/Driver/frame-pointer-elim.c
+++ b/clang/test/Driver/frame-pointer-elim.c
@@ -90,7 +90,8 @@
 // WARN-OMIT-LEAF-7S-NOT: warning: optimization flag 
'-momit-leaf-frame-pointer' is not supported for target 'armv7s'
 // WARN-OMIT-LEAF-7S: "-mframe-pointer=non-leaf"
 
-// On AArch64 and PS4, default to omitting the frame pointer on leaf functions
+// On AArch64, PS4, and VE, default to omitting the frame pointer on leaf
+// functions
 // RUN: %clang -### -target aarch64 -S %s 2>&1 | \
 // RUN:   FileCheck --check-prefix=KEEP-NON-LEAF %s
 // RUN: %clang -### -target x86_64-scei-ps4 -S %s 2>&1 | \
@@ -99,6 +100,8 @@
 // RUN:   FileCheck --check-prefix=KEEP-NON-LEAF %s
 // RUN: %clang -### -target aarch64-apple-darwin -arch arm64_32 -S %s 2>&1 | \
 // RUN:   FileCheck --check-prefix=KEEP-NON-LEAF %s
+// RUN: %clang -### -target ve-unknown-linux-gnu -S %s 2>&1 | \
+// RUN:   FileCheck --check-prefix=KEEP-NON-LEAF %s
 
 // RUN: %clang -### -target powerpc64 -S %s 2>&1 | \
 // RUN:   FileCheck --check-prefix=KEEP-ALL %s



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


[clang] 7313a6d - [CLANG][PATCH][FPEnv] Add support for option -ffp-eval-method and extend #pragma float_control similarly

2021-08-16 Thread Kazushi Marukawa via cfe-commits

Author: Kazushi (Jam) Marukawa
Date: 2021-08-16T18:34:29+09:00
New Revision: 7313a6d87c04c33f0bc67297241e33f2d82a0d5d

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

LOG: [CLANG][PATCH][FPEnv] Add support for option -ffp-eval-method and extend 
#pragma float_control similarly

Need to update a clang regression test for VE after
https://reviews.llvm.org/D93769.

Reviewed By: simoll

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

Added: 


Modified: 
clang/test/Preprocessor/init-ve.c

Removed: 




diff  --git a/clang/test/Preprocessor/init-ve.c 
b/clang/test/Preprocessor/init-ve.c
index 4686315f4ea0..b3ff47d54c13 100644
--- a/clang/test/Preprocessor/init-ve.c
+++ b/clang/test/Preprocessor/init-ve.c
@@ -32,7 +32,6 @@
 // VE:#define __FLT_DENORM_MIN__ 1.40129846e-45F
 // VE:#define __FLT_DIG__ 6
 // VE:#define __FLT_EPSILON__ 1.19209290e-7F
-// VE:#define __FLT_EVAL_METHOD__ 0
 // VE:#define __FLT_HAS_DENORM__ 1
 // VE:#define __FLT_HAS_INFINITY__ 1
 // VE:#define __FLT_HAS_QUIET_NAN__ 1



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


[libunwind] 3cbd476 - [VE] Support VE in libunwind

2021-01-16 Thread Kazushi Marukawa via cfe-commits

Author: Kazushi (Jam) Marukawa
Date: 2021-01-17T15:35:02+09:00
New Revision: 3cbd476c54886e8ebac64b4145d4517732a71023

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

LOG: [VE] Support VE in libunwind

Modify libunwind to support SjLj exception handling routines for VE.
In order to do that, we need to implement not only SjLj exception
handling routines but also a Registers_ve class.  This implementation
of Registers_ve is incomplete.  We will work on it later when we need
backtrace in libunwind.

Reviewed By: #libunwind, compnerd

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

Added: 


Modified: 
libunwind/include/__libunwind_config.h
libunwind/include/libunwind.h
libunwind/src/Registers.hpp
libunwind/src/Unwind-sjlj.c
libunwind/src/libunwind.cpp

Removed: 




diff  --git a/libunwind/include/__libunwind_config.h 
b/libunwind/include/__libunwind_config.h
index 80be357496c4..34ac6f717d6e 100644
--- a/libunwind/include/__libunwind_config.h
+++ b/libunwind/include/__libunwind_config.h
@@ -25,6 +25,7 @@
 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_SPARC 31
 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_HEXAGON   34
 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_RISCV 64
+#define _LIBUNWIND_HIGHEST_DWARF_REGISTER_VE143
 
 #if defined(_LIBUNWIND_IS_NATIVE_ONLY)
 # if defined(__linux__)
@@ -138,6 +139,11 @@
 #error "Unsupported RISC-V ABI"
 #  endif
 # define _LIBUNWIND_HIGHEST_DWARF_REGISTER 
_LIBUNWIND_HIGHEST_DWARF_REGISTER_RISCV
+# elif defined(__ve__)
+#  define _LIBUNWIND_TARGET_VE 1
+#  define _LIBUNWIND_CONTEXT_SIZE 67
+#  define _LIBUNWIND_CURSOR_SIZE 79
+#  define _LIBUNWIND_HIGHEST_DWARF_REGISTER 
_LIBUNWIND_HIGHEST_DWARF_REGISTER_VE
 # else
 #  error "Unsupported architecture."
 # endif
@@ -154,6 +160,7 @@
 # define _LIBUNWIND_TARGET_SPARC 1
 # define _LIBUNWIND_TARGET_HEXAGON 1
 # define _LIBUNWIND_TARGET_RISCV 1
+# define _LIBUNWIND_TARGET_VE 1
 # define _LIBUNWIND_CONTEXT_SIZE 167
 # define _LIBUNWIND_CURSOR_SIZE 179
 # define _LIBUNWIND_HIGHEST_DWARF_REGISTER 287

diff  --git a/libunwind/include/libunwind.h b/libunwind/include/libunwind.h
index 6ec649a460b8..5bae8d02f799 100644
--- a/libunwind/include/libunwind.h
+++ b/libunwind/include/libunwind.h
@@ -947,4 +947,156 @@ enum {
   UNW_RISCV_F31 = 63,
 };
 
+// VE register numbers
+enum {
+  UNW_VE_S0   = 0,
+  UNW_VE_S1   = 1,
+  UNW_VE_S2   = 2,
+  UNW_VE_S3   = 3,
+  UNW_VE_S4   = 4,
+  UNW_VE_S5   = 5,
+  UNW_VE_S6   = 6,
+  UNW_VE_S7   = 7,
+  UNW_VE_S8   = 8,
+  UNW_VE_S9   = 9,
+  UNW_VE_S10  = 10,
+  UNW_VE_S11  = 11,
+  UNW_VE_S12  = 12,
+  UNW_VE_S13  = 13,
+  UNW_VE_S14  = 14,
+  UNW_VE_S15  = 15,
+  UNW_VE_S16  = 16,
+  UNW_VE_S17  = 17,
+  UNW_VE_S18  = 18,
+  UNW_VE_S19  = 19,
+  UNW_VE_S20  = 20,
+  UNW_VE_S21  = 21,
+  UNW_VE_S22  = 22,
+  UNW_VE_S23  = 23,
+  UNW_VE_S24  = 24,
+  UNW_VE_S25  = 25,
+  UNW_VE_S26  = 26,
+  UNW_VE_S27  = 27,
+  UNW_VE_S28  = 28,
+  UNW_VE_S29  = 29,
+  UNW_VE_S30  = 30,
+  UNW_VE_S31  = 31,
+  UNW_VE_S32  = 32,
+  UNW_VE_S33  = 33,
+  UNW_VE_S34  = 34,
+  UNW_VE_S35  = 35,
+  UNW_VE_S36  = 36,
+  UNW_VE_S37  = 37,
+  UNW_VE_S38  = 38,
+  UNW_VE_S39  = 39,
+  UNW_VE_S40  = 40,
+  UNW_VE_S41  = 41,
+  UNW_VE_S42  = 42,
+  UNW_VE_S43  = 43,
+  UNW_VE_S44  = 44,
+  UNW_VE_S45  = 45,
+  UNW_VE_S46  = 46,
+  UNW_VE_S47  = 47,
+  UNW_VE_S48  = 48,
+  UNW_VE_S49  = 49,
+  UNW_VE_S50  = 50,
+  UNW_VE_S51  = 51,
+  UNW_VE_S52  = 52,
+  UNW_VE_S53  = 53,
+  UNW_VE_S54  = 54,
+  UNW_VE_S55  = 55,
+  UNW_VE_S56  = 56,
+  UNW_VE_S57  = 57,
+  UNW_VE_S58  = 58,
+  UNW_VE_S59  = 59,
+  UNW_VE_S60  = 60,
+  UNW_VE_S61  = 61,
+  UNW_VE_S62  = 62,
+  UNW_VE_S63  = 63,
+  UNW_VE_V0   = 64 + 0,
+  UNW_VE_V1   = 64 + 1,
+  UNW_VE_V2   = 64 + 2,
+  UNW_VE_V3   = 64 + 3,
+  UNW_VE_V4   = 64 + 4,
+  UNW_VE_V5   = 64 + 5,
+  UNW_VE_V6   = 64 + 6,
+  UNW_VE_V7   = 64 + 7,
+  UNW_VE_V8   = 64 + 8,
+  UNW_VE_V9   = 64 + 9,
+  UNW_VE_V10  = 64 + 10,
+  UNW_VE_V11  = 64 + 11,
+  UNW_VE_V12  = 64 + 12,
+  UNW_VE_V13  = 64 + 13,
+  UNW_VE_V14  = 64 + 14,
+  UNW_VE_V15  = 64 + 15,
+  UNW_VE_V16  = 64 + 16,
+  UNW_VE_V17  = 64 + 17,
+  UNW_VE_V18  = 64 + 18,
+  UNW_VE_V19  = 64 + 19,
+  UNW_VE_V20  = 64 + 20,
+  UNW_VE_V21  = 64 + 21,
+  UNW_VE_V22  = 64 + 22,
+  UNW_VE_V23  = 64 + 23,
+  UNW_VE_V24  = 64 + 24,
+  UNW_VE_V25  = 64 + 25,
+  UNW_VE_V26  = 64 + 26,
+  UNW_VE_V27  = 64 + 27,
+  UNW_VE_V28  = 64 + 28,
+  UNW_VE_V29  = 64 + 29,
+  UNW_VE_V30  = 64 + 30,
+  UNW_VE_V31  = 64 + 31,
+  UNW_VE_V32  = 64 + 32,
+  UNW_VE_V33  = 64 + 33,
+  UNW_VE_V34  = 64 + 34,
+  UNW_VE_V35  = 64 + 35,
+  UNW_VE_V36  = 64 + 36,
+  UNW_VE_V37  = 64 + 37,
+  UNW_VE_V38  = 64 + 38,
+  UNW_VE_V39  = 64 + 39,
+  UNW_VE_V40  = 64 + 40,
+  UNW_VE_V41  = 64 + 41,
+  UNW_VE_V42  = 64 + 42,

[clang] 489000d - [VE] Change clang to support SjLj Lowering

2021-01-05 Thread Kazushi Marukawa via cfe-commits

Author: Kazushi (Jam) Marukawa
Date: 2021-01-05T22:19:02+09:00
New Revision: 489000d8516da7eaf6aabaad11cce0ed7e67c61f

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

LOG: [VE] Change clang to support SjLj Lowering

We supports SjLj exception handling in the backend, so changing
clang to allow lowering using SjLj exceptions.  Update a regression
test also.

Reviewed By: simoll

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

Added: 


Modified: 
clang/lib/Basic/Targets/VE.h
clang/test/Sema/builtin-longjmp.c

Removed: 




diff  --git a/clang/lib/Basic/Targets/VE.h b/clang/lib/Basic/Targets/VE.h
index 2d9c74ac5247..71d6fc08d859 100644
--- a/clang/lib/Basic/Targets/VE.h
+++ b/clang/lib/Basic/Targets/VE.h
@@ -53,10 +53,7 @@ class LLVM_LIBRARY_VISIBILITY VETargetInfo : public 
TargetInfo {
   void getTargetDefines(const LangOptions ,
 MacroBuilder ) const override;
 
-  bool hasSjLjLowering() const override {
-// TODO
-return false;
-  }
+  bool hasSjLjLowering() const override { return true; }
 
   ArrayRef getTargetBuiltins() const override;
 

diff  --git a/clang/test/Sema/builtin-longjmp.c 
b/clang/test/Sema/builtin-longjmp.c
index d80208f82c67..3023098a7631 100644
--- a/clang/test/Sema/builtin-longjmp.c
+++ b/clang/test/Sema/builtin-longjmp.c
@@ -4,6 +4,7 @@
 // RUN: %clang_cc1 -triple powerpc-unknown-unknown -emit-llvm < %s| FileCheck 
%s
 // RUN: %clang_cc1 -triple powerpc64-unknown-unknown -emit-llvm < %s| 
FileCheck %s
 // RUN: %clang_cc1 -triple sparc-eabi-unknown -emit-llvm < %s | FileCheck %s
+// RUN: %clang_cc1 -triple ve-unknown-unknown -emit-llvm < %s | FileCheck %s
 
 // RUN: %clang_cc1 -triple aarch64-unknown-unknown -emit-llvm-only -verify %s
 // RUN: %clang_cc1 -triple mips-unknown-unknown -emit-llvm-only -verify %s



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


[clang] 05d1729 - [VE] Optimize toolchain regression test

2020-12-13 Thread Kazushi Marukawa via cfe-commits

Author: Kazushi (Jam) Marukawa
Date: 2020-12-13T20:26:05+09:00
New Revision: 05d1729232cdff323cafd469532504aa85740967

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

LOG: [VE] Optimize toolchain regression test

Optimize toolchain regression test for VE by removing not a useful test
(-fuse-init-array test) and merge several tests to one test which checks
default behavior of driver.  Also add sysroot to reduce conflicts.

These are suggested in https://reviews.llvm.org/D92996.
Thank you so much.

Reviewed By: MaskRay

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

Added: 
clang/test/Driver/Inputs/basic_ve_tree/opt/nec/ve/lib/crt1.o
clang/test/Driver/Inputs/basic_ve_tree/opt/nec/ve/lib/crti.o
clang/test/Driver/Inputs/basic_ve_tree/opt/nec/ve/lib/crtn.o

clang/test/Driver/Inputs/basic_ve_tree/resource_dir/lib/linux/clang_rt.crtbegin-ve.o

clang/test/Driver/Inputs/basic_ve_tree/resource_dir/lib/linux/clang_rt.crtend-ve.o

clang/test/Driver/Inputs/basic_ve_tree/resource_dir/lib/linux/libclang_rt.builtins-ve.a

Modified: 
clang/test/Driver/ve-toolchain.c
clang/test/Driver/ve-toolchain.cpp

Removed: 




diff  --git a/clang/test/Driver/Inputs/basic_ve_tree/opt/nec/ve/lib/crt1.o 
b/clang/test/Driver/Inputs/basic_ve_tree/opt/nec/ve/lib/crt1.o
new file mode 100644
index ..e69de29bb2d1

diff  --git a/clang/test/Driver/Inputs/basic_ve_tree/opt/nec/ve/lib/crti.o 
b/clang/test/Driver/Inputs/basic_ve_tree/opt/nec/ve/lib/crti.o
new file mode 100644
index ..e69de29bb2d1

diff  --git a/clang/test/Driver/Inputs/basic_ve_tree/opt/nec/ve/lib/crtn.o 
b/clang/test/Driver/Inputs/basic_ve_tree/opt/nec/ve/lib/crtn.o
new file mode 100644
index ..e69de29bb2d1

diff  --git 
a/clang/test/Driver/Inputs/basic_ve_tree/resource_dir/lib/linux/clang_rt.crtbegin-ve.o
 
b/clang/test/Driver/Inputs/basic_ve_tree/resource_dir/lib/linux/clang_rt.crtbegin-ve.o
new file mode 100644
index ..e69de29bb2d1

diff  --git 
a/clang/test/Driver/Inputs/basic_ve_tree/resource_dir/lib/linux/clang_rt.crtend-ve.o
 
b/clang/test/Driver/Inputs/basic_ve_tree/resource_dir/lib/linux/clang_rt.crtend-ve.o
new file mode 100644
index ..e69de29bb2d1

diff  --git 
a/clang/test/Driver/Inputs/basic_ve_tree/resource_dir/lib/linux/libclang_rt.builtins-ve.a
 
b/clang/test/Driver/Inputs/basic_ve_tree/resource_dir/lib/linux/libclang_rt.builtins-ve.a
new file mode 100644
index ..e69de29bb2d1

diff  --git a/clang/test/Driver/ve-toolchain.c 
b/clang/test/Driver/ve-toolchain.c
index 0ca3c84373f3..ac925e470770 100644
--- a/clang/test/Driver/ve-toolchain.c
+++ b/clang/test/Driver/ve-toolchain.c
@@ -7,83 +7,93 @@
 // RUN: %clang -### -g -target ve %s 2>&1 | FileCheck -check-prefix=DWARF_VER 
%s
 // DWARF_VER: "-dwarf-version=4"
 
-///-
-/// Checking dynamic-linker
-
-// RUN: %clang -### -target ve %s 2>&1 | FileCheck -check-prefix=DYNLINKER %s
-// DYNLINKER: nld{{.*}} "-dynamic-linker" "/opt/nec/ve/lib/ld-linux-ve.so.1"
-
-///-
-/// Checking VE specific option
-
-// RUN: %clang -### -target ve %s 2>&1 | FileCheck -check-prefix=VENLDOPT %s
-// VENLDOPT: nld{{.*}} "-z" "max-page-size=0x400"
-
 
///-
 /// Checking include-path
 
-// RUN: %clang -### -target ve %s 2>&1 | FileCheck -check-prefix=DEFINC %s
+// RUN: %clang -### -target ve --sysroot %S/Inputs/basic_ve_tree %s \
+// RUN: -resource-dir=%S/Input/basic_ve_tree/resource_dir \
+// RUN: 2>&1 | FileCheck -check-prefix=DEFINC %s
 // DEFINC: clang{{.*}} "-cc1"
-// DEFINC: "-nostdsysteminc"
-// DEFINC: "-internal-isystem" "{{.*}}/lib/clang/{{[0-9.]*}}/include"
-// DEFINC: "-internal-isystem" "/opt/nec/ve/include"
-
-// RUN: %clang -### -target ve %s -nostdlibinc 2>&1 | \
-// RUN:FileCheck -check-prefix=NOSTDLIBINC %s
+// DEFINC-SAME: "-nostdsysteminc"
+// DEFINC-SAME: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
+// DEFINC-SAME: "-isysroot" "[[SYSROOT:[^"]+]]"
+// DEFINC-SAME: "-internal-isystem" "[[RESOURCE_DIR]]/include"
+// DEFINC-SAME: "-internal-isystem" "[[SYSROOT]]/opt/nec/ve/include"
+
+// RUN: %clang -### -target ve --sysroot %S/Inputs/basic_ve_tree %s \
+// RUN: -resource-dir=%S/Input/basic_ve_tree/resource_dir \
+// RUN: -nostdlibinc 2>&1 | FileCheck -check-prefix=NOSTDLIBINC %s
 // NOSTDLIBINC: clang{{.*}} "-cc1"
-// NOSTDLIBINC: "-internal-isystem" "{{.*}}/lib/clang/{{[0-9.]*}}/include"
-// NOSTDLIBINC-NOT: "-internal-isystem" "/opt/nec/ve/include"
-
-// RUN: %clang -### -target ve %s -nobuiltininc 2>&1 | \
-// RUN:FileCheck 

[clang] cd5855a - [VE] Remove -faddrsig and -fnoaddrsig tests

2020-12-10 Thread Kazushi Marukawa via cfe-commits

Author: Kazushi (Jam) Marukawa
Date: 2020-12-11T08:25:38+09:00
New Revision: cd5855ac3ba7a91b2a4a7c97b2723c95038dacbe

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

LOG: [VE] Remove -faddrsig and -fnoaddrsig tests

Remove explicitly declared -faddrsig and -fnoaddrsig option tests
since those are already tested in addrsig.c.  We test only the implicit
behavior of VE driver.

This is suggested in https://reviews.llvm.org/D92386.  Thanks.

Reviewed By: MaskRay

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

Added: 


Modified: 
clang/test/Driver/ve-toolchain.c
clang/test/Driver/ve-toolchain.cpp

Removed: 




diff  --git a/clang/test/Driver/ve-toolchain.c 
b/clang/test/Driver/ve-toolchain.c
index 261b3efcc4f0..0ca3c84373f3 100644
--- a/clang/test/Driver/ve-toolchain.c
+++ b/clang/test/Driver/ve-toolchain.c
@@ -67,16 +67,6 @@
 // DEFADDESIG: clang{{.*}} "-cc1"
 // DEFADDESIG-NOT: "-faddrsig"
 
-// RUN: %clang -### -target ve %s -faddrsig 2>&1 | \
-// RUN: FileCheck -check-prefix=ADDRSIG %s
-// ADDRSIG: clang{{.*}} "-cc1"
-// ADDRSIG: "-faddrsig"
-
-// RUN: %clang -### -target ve %s -fno-addrsig 2>&1 | \
-// RUN: FileCheck -check-prefix=NOADDRSIG %s
-// NOADDRSIG: clang{{.*}} "-cc1"
-// NOADDRSIG-NOT: "-faddrsig"
-
 
///-
 /// Checking exceptions
 

diff  --git a/clang/test/Driver/ve-toolchain.cpp 
b/clang/test/Driver/ve-toolchain.cpp
index 6243b4c3f386..36a23aa87f98 100644
--- a/clang/test/Driver/ve-toolchain.cpp
+++ b/clang/test/Driver/ve-toolchain.cpp
@@ -85,16 +85,6 @@
 // DEFADDESIG: clang{{.*}} "-cc1"
 // DEFADDESIG-NOT: "-faddrsig"
 
-// RUN: %clangxx -### -target ve %s -faddrsig 2>&1 | \
-// RUN: FileCheck -check-prefix=ADDRSIG %s
-// ADDRSIG: clang{{.*}} "-cc1"
-// ADDRSIG: "-faddrsig"
-
-// RUN: %clangxx -### -target ve %s -fno-addrsig 2>&1 | \
-// RUN: FileCheck -check-prefix=NOADDRSIG %s
-// NOADDRSIG: clang{{.*}} "-cc1"
-// NOADDRSIG-NOT: "-faddrsig"
-
 
///-
 /// Checking exceptions
 



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


[clang] 7d30df7 - [VE] Add standard include path and library path for C++

2020-12-03 Thread Kazushi Marukawa via cfe-commits

Author: Kazushi (Jam) Marukawa
Date: 2020-12-03T22:22:56+09:00
New Revision: 7d30df7b59973a42a93c86cb501bd3d0fbb07404

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

LOG: [VE] Add standard include path and library path for C++

We have a plan to add libcxx and libcxxabi for VE.  In order to do so,
we need to compile cxx source code with bootstarapped header files.
This patch adds such expected path to make clang++ work, at least
not crash at the startup.  Add regression test for that, also.

Reviewed By: simoll

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

Added: 
clang/test/Driver/ve-toolchain.cpp

Modified: 
clang/lib/Driver/ToolChains/VEToolchain.cpp

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/VEToolchain.cpp 
b/clang/lib/Driver/ToolChains/VEToolchain.cpp
index 6ea405c0269c..e28f340f9aad 100644
--- a/clang/lib/Driver/ToolChains/VEToolchain.cpp
+++ b/clang/lib/Driver/ToolChains/VEToolchain.cpp
@@ -102,14 +102,37 @@ void VEToolChain::addClangTargetOptions(const ArgList 
,
 
 void VEToolChain::AddClangCXXStdlibIncludeArgs(const ArgList ,
ArgStringList ) const {
-  // TODO upstream VE libc++ patches
-  llvm_unreachable("The VE target has no C++ stdlib for Clang yet");
+  if (DriverArgs.hasArg(clang::driver::options::OPT_nostdinc) ||
+  DriverArgs.hasArg(options::OPT_nostdlibinc) ||
+  DriverArgs.hasArg(options::OPT_nostdincxx))
+return;
+  if (const char *cl_include_dir = getenv("NCC_CPLUS_INCLUDE_PATH")) {
+SmallVector Dirs;
+const char EnvPathSeparatorStr[] = {llvm::sys::EnvPathSeparator, '\0'};
+StringRef(cl_include_dir).split(Dirs, StringRef(EnvPathSeparatorStr));
+ArrayRef DirVec(Dirs);
+addSystemIncludes(DriverArgs, CC1Args, DirVec);
+  } else {
+SmallString<128> P(getDriver().ResourceDir);
+llvm::sys::path::append(P, "include/c++/v1");
+addSystemInclude(DriverArgs, CC1Args, P);
+  }
 }
 
 void VEToolChain::AddCXXStdlibLibArgs(const ArgList ,
   ArgStringList ) const {
-  // TODO upstream VE libc++ patches
-  llvm_unreachable("The VE target has no C++ stdlib for Clang yet");
+  assert((GetCXXStdlibType(Args) == ToolChain::CST_Libcxx) &&
+ "Only -lc++ (aka libxx) is supported in this toolchain.");
+
+  tools::addArchSpecificRPath(*this, Args, CmdArgs);
+
+  CmdArgs.push_back("-lc++");
+  CmdArgs.push_back("-lc++abi");
+  CmdArgs.push_back("-lunwind");
+  // libc++ requires -lpthread under glibc environment
+  CmdArgs.push_back("-lpthread");
+  // libunwind requires -ldl under glibc environment
+  CmdArgs.push_back("-ldl");
 }
 
 llvm::ExceptionHandling

diff  --git a/clang/test/Driver/ve-toolchain.cpp 
b/clang/test/Driver/ve-toolchain.cpp
new file mode 100644
index ..e056c04456ae
--- /dev/null
+++ b/clang/test/Driver/ve-toolchain.cpp
@@ -0,0 +1,132 @@
+/// Check the behavior of toolchain for NEC Aurora VE
+/// REQUIRES: ve-registered-target
+
+///-
+/// Checking dwarf-version
+
+// RUN: %clangxx -### -g -target ve %s 2>&1 | FileCheck 
-check-prefix=DWARF_VER %s
+// DWARF_VER: "-dwarf-version=4"
+
+///-
+/// Checking dynamic-linker
+
+// RUN: %clangxx -### -target ve %s 2>&1 | FileCheck -check-prefix=DYNLINKER %s
+// DYNLINKER: nld{{.*}} "-dynamic-linker" "/opt/nec/ve/lib/ld-linux-ve.so.1"
+
+///-
+/// Checking VE specific option
+
+// RUN: %clangxx -### -target ve %s 2>&1 | FileCheck -check-prefix=VENLDOPT %s
+// VENLDOPT: nld{{.*}} "-z" "max-page-size=0x400"
+
+///-
+/// Checking include-path
+
+// RUN: %clangxx -### -target ve %s 2>&1 | FileCheck -check-prefix=DEFINC %s
+// DEFINC: clang{{.*}} "-cc1"
+// DEFINC: "-nostdsysteminc"
+// DEFINC: "-internal-isystem" "{{.*}}/lib/clang/{{[0-9.]*}}/include/c++/v1"
+// DEFINC: "-internal-isystem" "{{.*}}/lib/clang/{{[0-9.]*}}/include"
+// DEFINC: "-internal-isystem" "/opt/nec/ve/include"
+
+// RUN: %clangxx -### -target ve %s -nostdlibinc 2>&1 | \
+// RUN:FileCheck -check-prefix=NOSTDLIBINC %s
+// NOSTDLIBINC: clang{{.*}} "-cc1"
+// NOSTDLIBINC-NOT: "-internal-isystem" 
"{{.*}}/lib/clang/{{[0-9.]*}}/include/c++/v1"
+// NOSTDLIBINC: "-internal-isystem" "{{.*}}/lib/clang/{{[0-9.]*}}/include"
+// NOSTDLIBINC-NOT: "-internal-isystem" "/opt/nec/ve/include"
+
+// RUN: %clangxx -### -target ve %s -nobuiltininc 2>&1 | \
+// RUN:FileCheck -check-prefix=NOBUILTININC %s
+// NOBUILTININC: clang{{.*}} "-cc1"
+// NOBUILTININC: "-nobuiltininc"
+// NOBUILTININC: 

[clang] 33eac0f - [VE] Specify vector alignments

2020-11-30 Thread Kazushi Marukawa via cfe-commits

Author: Kazushi (Jam) Marukawa
Date: 2020-11-30T22:09:21+09:00
New Revision: 33eac0f2830ee3f362ec0207a3d0e5f0861de8f1

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

LOG: [VE] Specify vector alignments

Specify alignments for all vector types.  Update a regression test also.

Reviewed By: simoll

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

Added: 


Modified: 
clang/lib/Basic/Targets/VE.h
clang/test/CodeGen/target-data.c
llvm/lib/Target/VE/VETargetMachine.cpp

Removed: 




diff  --git a/clang/lib/Basic/Targets/VE.h b/clang/lib/Basic/Targets/VE.h
index b8143747a38d..2d9c74ac5247 100644
--- a/clang/lib/Basic/Targets/VE.h
+++ b/clang/lib/Basic/Targets/VE.h
@@ -45,7 +45,9 @@ class LLVM_LIBRARY_VISIBILITY VETargetInfo : public 
TargetInfo {
 WCharType = UnsignedInt;
 WIntType = UnsignedInt;
 UseZeroLengthBitfieldAlignment = true;
-resetDataLayout("e-m:e-i64:64-n32:64-S128");
+resetDataLayout(
+"e-m:e-i64:64-n32:64-S128-v64:64:64-v128:64:64-v256:64:64-v512:64:64-"
+"v1024:64:64-v2048:64:64-v4096:64:64-v8192:64:64-v16384:64:64");
   }
 
   void getTargetDefines(const LangOptions ,

diff  --git a/clang/test/CodeGen/target-data.c 
b/clang/test/CodeGen/target-data.c
index 82a0a867526b..1d7ed500340c 100644
--- a/clang/test/CodeGen/target-data.c
+++ b/clang/test/CodeGen/target-data.c
@@ -281,4 +281,4 @@
 
 // RUN: %clang_cc1 -triple ve -o - -emit-llvm %s | \
 // RUN: FileCheck %s -check-prefix=VE
-// VE: target datalayout = "e-m:e-i64:64-n32:64-S128"
+// VE: target datalayout = 
"e-m:e-i64:64-n32:64-S128-v64:64:64-v128:64:64-v256:64:64-v512:64:64-v1024:64:64-v2048:64:64-v4096:64:64-v8192:64:64-v16384:64:64"

diff  --git a/llvm/lib/Target/VE/VETargetMachine.cpp 
b/llvm/lib/Target/VE/VETargetMachine.cpp
index 12c4f4628811..1077abc54141 100644
--- a/llvm/lib/Target/VE/VETargetMachine.cpp
+++ b/llvm/lib/Target/VE/VETargetMachine.cpp
@@ -44,6 +44,19 @@ static std::string computeDataLayout(const Triple ) {
   // Stack alignment is 128 bits
   Ret += "-S128";
 
+  // Vector alignments are 64 bits
+  // Need to define all of them.  Otherwise, each alignment becomes
+  // the size of each data by default.
+  Ret += "-v64:64:64"; // for v2f32
+  Ret += "-v128:64:64";
+  Ret += "-v256:64:64";
+  Ret += "-v512:64:64";
+  Ret += "-v1024:64:64";
+  Ret += "-v2048:64:64";
+  Ret += "-v4096:64:64";
+  Ret += "-v8192:64:64";
+  Ret += "-v16384:64:64"; // for v256f64
+
   return Ret;
 }
 



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


[clang] 9c504ec - [VE] Disable -fsigaddr option for VE

2020-11-12 Thread Kazushi Marukawa via cfe-commits

Author: Kazushi (Jam) Marukawa
Date: 2020-11-13T06:22:12+09:00
New Revision: 9c504ec06da636832d03e98581eade3d8f81eb24

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

LOG: [VE] Disable -fsigaddr option for VE

VE needs to support integrated assembler and "nas".  This "nas"
doesn't recognize ".sigaddr" pseudo mnemonics, so need to disable
it.  This patch disable it on VE by default.  Also add a regression
test for that.

Reviewed By: simoll

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

Added: 


Modified: 
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/Driver/ve-toolchain.c

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index 1db47088c959..c8d58f0a5b9a 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6365,11 +6365,10 @@ void Clang::ConstructJob(Compilation , const 
JobAction ,
   if (Args.hasFlag(options::OPT_faddrsig, options::OPT_fno_addrsig,
(TC.getTriple().isOSBinFormatELF() ||
 TC.getTriple().isOSBinFormatCOFF()) &&
-  !TC.getTriple().isPS4() &&
-  !TC.getTriple().isOSNetBSD() &&
-  !Distro(D.getVFS(), TC.getTriple()).IsGentoo() &&
-  !TC.getTriple().isAndroid() &&
-   TC.useIntegratedAs()))
+   !TC.getTriple().isPS4() && !TC.getTriple().isVE() &&
+   !TC.getTriple().isOSNetBSD() &&
+   !Distro(D.getVFS(), TC.getTriple()).IsGentoo() &&
+   !TC.getTriple().isAndroid() && TC.useIntegratedAs()))
 CmdArgs.push_back("-faddrsig");
 
   if (Arg *A = Args.getLastArg(options::OPT_fsymbol_partition_EQ)) {

diff  --git a/clang/test/Driver/ve-toolchain.c 
b/clang/test/Driver/ve-toolchain.c
index 3e1600cb8034..261b3efcc4f0 100644
--- a/clang/test/Driver/ve-toolchain.c
+++ b/clang/test/Driver/ve-toolchain.c
@@ -60,6 +60,23 @@
 // NOTINITARRAY: clang{{.*}} "-cc1"
 // NOTINITARRAY: "-fno-use-init-array"
 
+///-
+/// Checking -faddrsig
+
+// RUN: %clang -### -target ve %s 2>&1 | FileCheck -check-prefix=DEFADDESIG %s
+// DEFADDESIG: clang{{.*}} "-cc1"
+// DEFADDESIG-NOT: "-faddrsig"
+
+// RUN: %clang -### -target ve %s -faddrsig 2>&1 | \
+// RUN: FileCheck -check-prefix=ADDRSIG %s
+// ADDRSIG: clang{{.*}} "-cc1"
+// ADDRSIG: "-faddrsig"
+
+// RUN: %clang -### -target ve %s -fno-addrsig 2>&1 | \
+// RUN: FileCheck -check-prefix=NOADDRSIG %s
+// NOADDRSIG: clang{{.*}} "-cc1"
+// NOADDRSIG-NOT: "-faddrsig"
+
 
///-
 /// Checking exceptions
 



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


[clang] 6e0ae20 - [VE] Support vector register in inline asm

2020-11-11 Thread Kazushi Marukawa via cfe-commits

Author: Kazushi (Jam) Marukawa
Date: 2020-11-12T06:18:35+09:00
New Revision: 6e0ae20f3b98b7bb5a44ced22c3da42a8fe5dbc8

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

LOG: [VE] Support vector register in inline asm

Support a vector register constraint in inline asm of clang.
Add a regression test also.

Reviewed By: simoll

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

Added: 
clang/test/CodeGen/VE/ve-inline-asm.c

Modified: 
clang/lib/Basic/Targets/VE.h

Removed: 




diff  --git a/clang/lib/Basic/Targets/VE.h b/clang/lib/Basic/Targets/VE.h
index f863a0af0acb6..b8143747a38dd 100644
--- a/clang/lib/Basic/Targets/VE.h
+++ b/clang/lib/Basic/Targets/VE.h
@@ -160,6 +160,13 @@ class LLVM_LIBRARY_VISIBILITY VETargetInfo : public 
TargetInfo {
 
   bool validateAsmConstraint(const char *,
  TargetInfo::ConstraintInfo ) const override {
+switch (*Name) {
+default:
+  return false;
+case 'v':
+  Info.setAllowsRegister();
+  return true;
+}
 return false;
   }
 

diff  --git a/clang/test/CodeGen/VE/ve-inline-asm.c 
b/clang/test/CodeGen/VE/ve-inline-asm.c
new file mode 100644
index 0..b3ee14407c9b5
--- /dev/null
+++ b/clang/test/CodeGen/VE/ve-inline-asm.c
@@ -0,0 +1,23 @@
+// REQUIRES: ve-registered-target
+// RUN: %clang_cc1 -triple ve-linux-gnu -emit-llvm -o - %s | FileCheck %s
+
+void r(long v) {
+  long b;
+  asm("lea %0, 256(%1)"
+  : "=r"(b)
+  : "r"(v));
+  // CHECK: %1 = call i64 asm "lea $0, 256($1)", "=r,r"(i64 %0)
+}
+
+void v(char *ptr, char *ptr2) {
+  typedef double __vr __attribute__((__vector_size__(2048)));
+  __vr a;
+  asm("vld %0, 8, %1"
+  : "=v"(a)
+  : "r"(ptr));
+  asm("vst %0, 8, %1"
+  :
+  : "v"(a), "r"(ptr2));
+  // CHECK: %1 = call <256 x double> asm "vld $0, 8, $1", "=v,r"(i8* %0)
+  // CHECK: call void asm sideeffect "vst $0, 8, $1", "v,r"(<256 x double> %2, 
i8* %3)
+}



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


[clang] b5ac372 - [VE] Change to use integrated assembly by defualt

2020-10-29 Thread Kazushi Marukawa via cfe-commits

Author: Kazushi (Jam) Marukawa
Date: 2020-10-30T00:16:04+09:00
New Revision: b5ac3721c8a497ebf33a9d0cc0d300564b0cefe1

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

LOG: [VE] Change to use integrated assembly by defualt

We've implemented integrated assembler.  Now, we change to use
integrated assembler by default.  Update a regression test also.

Reviewed By: simoll

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

Added: 


Modified: 
clang/lib/Driver/ToolChains/VEToolchain.h
clang/test/Driver/ve-toolchain.c

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/VEToolchain.h 
b/clang/lib/Driver/ToolChains/VEToolchain.h
index 59069c0a7595..b330331ca84e 100644
--- a/clang/lib/Driver/ToolChains/VEToolchain.h
+++ b/clang/lib/Driver/ToolChains/VEToolchain.h
@@ -26,6 +26,7 @@ class LLVM_LIBRARY_VISIBILITY VEToolChain : public Linux {
   Tool *buildLinker() const override;
 
 public:
+  bool IsIntegratedAssemblerDefault() const override { return true; }
   bool isPICDefault() const override;
   bool isPIEDefault() const override;
   bool isPICDefaultForced() const override;

diff  --git a/clang/test/Driver/ve-toolchain.c 
b/clang/test/Driver/ve-toolchain.c
index 7b93797ee597..3e1600cb8034 100644
--- a/clang/test/Driver/ve-toolchain.c
+++ b/clang/test/Driver/ve-toolchain.c
@@ -71,12 +71,12 @@
 /// Passing -fintegrated-as
 
 // RUN: %clang -### -target ve -x assembler %s 2>&1 | \
-// RUN:FileCheck -check-prefix=NAS_LINK %s
-// RUN: %clang -### -target ve -fintegrated-as -x assembler %s 2>&1 | \
 // RUN:FileCheck -check-prefix=AS_LINK %s
-
-// NAS_LINK: nas{{.*}}
-// NAS_LINK: nld{{.*}}
+// RUN: %clang -### -target ve -fno-integrated-as -x assembler %s 2>&1 | \
+// RUN:FileCheck -check-prefix=NAS_LINK %s
 
 // AS_LINK: clang{{.*}} "-cc1as"
 // AS_LINK: nld{{.*}}
+
+// NAS_LINK: nas{{.*}}
+// NAS_LINK: nld{{.*}}



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


[clang] 3ac1eb6 - [VE] Remove obsoleted getVEAsmModeForCPU function

2020-08-07 Thread Kazushi Marukawa via cfe-commits

Author: Kazushi (Jam) Marukawa
Date: 2020-08-07T18:20:34+09:00
New Revision: 3ac1eb6358b172f54788def4125f80ddd9170d8e

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

LOG: [VE] Remove obsoleted getVEAsmModeForCPU function

Reviewed By: simoll

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

Added: 


Modified: 
clang/lib/Driver/ToolChains/Arch/VE.cpp
clang/lib/Driver/ToolChains/Arch/VE.h

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/Arch/VE.cpp 
b/clang/lib/Driver/ToolChains/Arch/VE.cpp
index fa10e4810f1c..9dfd37c2106d 100644
--- a/clang/lib/Driver/ToolChains/Arch/VE.cpp
+++ b/clang/lib/Driver/ToolChains/Arch/VE.cpp
@@ -18,9 +18,5 @@ using namespace clang::driver::tools;
 using namespace clang;
 using namespace llvm::opt;
 
-const char *ve::getVEAsmModeForCPU(StringRef Name, const llvm::Triple ) 
{
-  return "";
-}
-
 void ve::getVETargetFeatures(const Driver , const ArgList ,
  std::vector ) {}

diff  --git a/clang/lib/Driver/ToolChains/Arch/VE.h 
b/clang/lib/Driver/ToolChains/Arch/VE.h
index 713e3e7d042f..531433534914 100644
--- a/clang/lib/Driver/ToolChains/Arch/VE.h
+++ b/clang/lib/Driver/ToolChains/Arch/VE.h
@@ -22,8 +22,6 @@ namespace ve {
 
 void getVETargetFeatures(const Driver , const llvm::opt::ArgList ,
  std::vector );
-const char *getVEAsmModeForCPU(llvm::StringRef Name,
-   const llvm::Triple );
 
 } // end namespace ve
 } // namespace tools



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


[clang] 045e79e - [VE] Extend integer arguments and return values smaller than 64 bits

2020-08-03 Thread Kazushi Marukawa via cfe-commits

Author: Kazushi (Jam) Marukawa
Date: 2020-08-04T08:07:05+09:00
New Revision: 045e79e77c252f2c73c640e820e977ef52836d50

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

LOG: [VE] Extend integer arguments and return values smaller than 64 bits

In order to follow NEC Aurora SX VE ABI correctly, change to sign/zero
extend integer arguments and return values smaller than 64 bits in clang.
Also update regression test.

Reviewed By: simoll

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

Added: 


Modified: 
clang/lib/CodeGen/TargetInfo.cpp
clang/test/CodeGen/ve-abi.c

Removed: 




diff  --git a/clang/lib/CodeGen/TargetInfo.cpp 
b/clang/lib/CodeGen/TargetInfo.cpp
index f31d432eb3171..e011cfa811678 100644
--- a/clang/lib/CodeGen/TargetInfo.cpp
+++ b/clang/lib/CodeGen/TargetInfo.cpp
@@ -10743,21 +10743,24 @@ class VEABIInfo : public DefaultABIInfo {
 } // end anonymous namespace
 
 ABIArgInfo VEABIInfo::classifyReturnType(QualType Ty) const {
-  if (Ty->isAnyComplexType()) {
+  if (Ty->isAnyComplexType())
 return ABIArgInfo::getDirect();
-  }
+  uint64_t Size = getContext().getTypeSize(Ty);
+  if (Size < 64 && Ty->isIntegerType())
+return ABIArgInfo::getExtend(Ty);
   return DefaultABIInfo::classifyReturnType(Ty);
 }
 
 ABIArgInfo VEABIInfo::classifyArgumentType(QualType Ty) const {
-  if (Ty->isAnyComplexType()) {
+  if (Ty->isAnyComplexType())
 return ABIArgInfo::getDirect();
-  }
+  uint64_t Size = getContext().getTypeSize(Ty);
+  if (Size < 64 && Ty->isIntegerType())
+return ABIArgInfo::getExtend(Ty);
   return DefaultABIInfo::classifyArgumentType(Ty);
 }
 
 void VEABIInfo::computeInfo(CGFunctionInfo ) const {
-
   FI.getReturnInfo() = classifyReturnType(FI.getReturnType());
   for (auto  : FI.arguments())
 Arg.info = classifyArgumentType(Arg.type);

diff  --git a/clang/test/CodeGen/ve-abi.c b/clang/test/CodeGen/ve-abi.c
index aa35095d5dea0..1c230cb616a38 100644
--- a/clang/test/CodeGen/ve-abi.c
+++ b/clang/test/CodeGen/ve-abi.c
@@ -1,14 +1,96 @@
+/// Check that ABI is correctly implemented.
+///
+///   1. Check that all integer arguments and return values less than 64 bits
+///  are sign/zero extended.
+///   2. Check that all complex arguments and return values are placed in
+///  registers if it is possible.  Not treat it as aggregate.
+///   3. Check that a function declared without argument type declarations is
+///  treated as VARARGS (in order to place arguments in both registers and
+///  memory locations in the back end)
+
 // RUN: %clang_cc1 -triple ve-linux-gnu -emit-llvm %s -o - | FileCheck %s
 
-// CHECK-LABEL: define { float, float } @p(float %a.coerce0, float %a.coerce1, 
float %b.coerce0, float %b.coerce1) #0 {
-float __complex__ p(float __complex__ a, float __complex__ b) {
+// CHECK-LABEL: define signext i8 @fun_si8(i8 signext %a, i8 signext %b) #0 {
+char fun_si8(char a, char b) {
+  return a;
+}
+
+// CHECK-LABEL: define zeroext i8 @fun_zi8(i8 zeroext %a, i8 zeroext %b) #0 {
+unsigned char fun_zi8(unsigned char a, unsigned char b) {
+  return a;
+}
+
+// CHECK-LABEL: define signext i16 @fun_si16(i16 signext %a, i16 signext %b) 
#0 {
+short fun_si16(short a, short b) {
+  return a;
+}
+
+// CHECK-LABEL: define zeroext i16 @fun_zi16(i16 zeroext %a, i16 zeroext %b) 
#0 {
+unsigned short fun_zi16(unsigned short a, unsigned short b) {
+  return a;
+}
+
+// CHECK-LABEL: define signext i32 @fun_si32(i32 signext %a, i32 signext %b) 
#0 {
+int fun_si32(int a, int b) {
+  return a;
+}
+
+// CHECK-LABEL: define zeroext i32 @fun_zi32(i32 zeroext %a, i32 zeroext %b) 
#0 {
+unsigned int fun_zi32(unsigned int a, unsigned int b) {
+  return a;
+}
+
+// CHECK-LABEL: define i64 @fun_si64(i64 %a, i64 %b) #0 {
+long fun_si64(long a, long b) {
+  return a;
+}
+
+// CHECK-LABEL: define i64 @fun_zi64(i64 %a, i64 %b) #0 {
+unsigned long fun_zi64(unsigned long a, unsigned long b) {
+  return a;
+}
+
+// CHECK-LABEL: define i128 @fun_si128(i128 %a, i128 %b) #0 {
+__int128 fun_si128(__int128 a, __int128 b) {
+}
+
+// CHECK-LABEL: define i128 @fun_zi128(i128 %a, i128 %b) #0 {
+unsigned __int128 fun_zi128(unsigned __int128 a, unsigned __int128 b) {
+  return a;
+}
+
+// CHECK-LABEL: define float @fun_float(float %a, float %b) #0 {
+float fun_float(float a, float b) {
+  return a;
+}
+
+// CHECK-LABEL: define double @fun_double(double %a, double %b) #0 {
+double fun_double(double a, double b) {
+  return a;
+}
+
+// CHECK-LABEL: define fp128 @fun_quad(fp128 %a, fp128 %b) #0 {
+long double fun_quad(long double a, long double b) {
+  return a;
+}
+
+// CHECK-LABEL: define { float, float } @fun_fcomplex(float %a.coerce0, float 
%a.coerce1, float %b.coerce0, float %b.coerce1) #0 {
+float __complex__ fun_fcomplex(float __complex__ a, float 

[clang] df3bda0 - [VE] Correct stack alignment

2020-07-06 Thread Kazushi Marukawa via cfe-commits

Author: Kazushi (Jam) Marukawa
Date: 2020-07-06T17:25:29+09:00
New Revision: df3bda047d5abe9190bdd0422270328140556bd4

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

LOG: [VE] Correct stack alignment

Summary:
Change stack alignment from 64 bits to 128 bits to follow ABI correctly.
And add a regression test for datalayout.

Reviewers: simoll, k-ishizaka

Reviewed By: simoll

Subscribers: hiraditya, cfe-commits, llvm-commits

Tags: #llvm, #ve, #clang

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

Added: 


Modified: 
clang/lib/Basic/Targets/VE.h
clang/test/CodeGen/target-data.c
llvm/lib/Target/VE/VETargetMachine.cpp

Removed: 




diff  --git a/clang/lib/Basic/Targets/VE.h b/clang/lib/Basic/Targets/VE.h
index 7e50e7daeb90..f863a0af0acb 100644
--- a/clang/lib/Basic/Targets/VE.h
+++ b/clang/lib/Basic/Targets/VE.h
@@ -45,7 +45,7 @@ class LLVM_LIBRARY_VISIBILITY VETargetInfo : public 
TargetInfo {
 WCharType = UnsignedInt;
 WIntType = UnsignedInt;
 UseZeroLengthBitfieldAlignment = true;
-resetDataLayout("e-m:e-i64:64-n32:64-S64");
+resetDataLayout("e-m:e-i64:64-n32:64-S128");
   }
 
   void getTargetDefines(const LangOptions ,

diff  --git a/clang/test/CodeGen/target-data.c 
b/clang/test/CodeGen/target-data.c
index e619843f4bdb..8c740119cd1b 100644
--- a/clang/test/CodeGen/target-data.c
+++ b/clang/test/CodeGen/target-data.c
@@ -250,3 +250,7 @@
 // RUN: %clang_cc1 -triple bpfeb -o - -emit-llvm %s | \
 // RUN: FileCheck %s -check-prefix=BPFEB
 // BPFEB: target datalayout = "E-m:e-p:64:64-i64:64-i128:128-n32:64-S128"
+
+// RUN: %clang_cc1 -triple ve -o - -emit-llvm %s | \
+// RUN: FileCheck %s -check-prefix=VE
+// VE: target datalayout = "e-m:e-i64:64-n32:64-S128"

diff  --git a/llvm/lib/Target/VE/VETargetMachine.cpp 
b/llvm/lib/Target/VE/VETargetMachine.cpp
index a0c8ae0c82d7..08b55eebbc98 100644
--- a/llvm/lib/Target/VE/VETargetMachine.cpp
+++ b/llvm/lib/Target/VE/VETargetMachine.cpp
@@ -41,8 +41,8 @@ static std::string computeDataLayout(const Triple ) {
   // VE supports 32 bit and 64 bits integer on registers
   Ret += "-n32:64";
 
-  // Stack alignment is 64 bits
-  Ret += "-S64";
+  // Stack alignment is 128 bits
+  Ret += "-S128";
 
   return Ret;
 }



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


[clang] 804d968 - [VE] Rename VE toolchain source files

2020-07-02 Thread Kazushi Marukawa via cfe-commits

Author: Kazushi (Jam) Marukawa
Date: 2020-07-02T18:45:16+09:00
New Revision: 804d9687443e1132157a9bb3696cb5327ae0558c

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

LOG: [VE] Rename VE toolchain source files

Summary:
Rename VE.cpp and VE.h to VEToolchain.cpp and VEToolchain.h respectively
in order to avoid link warning message.  Linker warns that VE.cpp.o and
Arch/VE.cpp.o have the same name.

Reviewers: simoll, k-ishizaka

Reviewed By: simoll

Subscribers: mgorny, cfe-commits

Tags: #llvm, #ve, #clang

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

Added: 
clang/lib/Driver/ToolChains/VEToolchain.cpp
clang/lib/Driver/ToolChains/VEToolchain.h

Modified: 
clang/lib/Driver/CMakeLists.txt
clang/lib/Driver/Driver.cpp

Removed: 
clang/lib/Driver/ToolChains/VE.cpp
clang/lib/Driver/ToolChains/VE.h



diff  --git a/clang/lib/Driver/CMakeLists.txt b/clang/lib/Driver/CMakeLists.txt
index b13789f8b2a8..9463ca5c109d 100644
--- a/clang/lib/Driver/CMakeLists.txt
+++ b/clang/lib/Driver/CMakeLists.txt
@@ -68,7 +68,7 @@ add_clang_library(clangDriver
   ToolChains/RISCVToolchain.cpp
   ToolChains/Solaris.cpp
   ToolChains/TCE.cpp
-  ToolChains/VE.cpp
+  ToolChains/VEToolchain.cpp
   ToolChains/WebAssembly.cpp
   ToolChains/XCore.cpp
   ToolChains/PPCLinux.cpp

diff  --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 8daa6af795ef..596e694760d0 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -43,7 +43,7 @@
 #include "ToolChains/RISCVToolchain.h"
 #include "ToolChains/Solaris.h"
 #include "ToolChains/TCE.h"
-#include "ToolChains/VE.h"
+#include "ToolChains/VEToolchain.h"
 #include "ToolChains/WebAssembly.h"
 #include "ToolChains/XCore.h"
 #include "clang/Basic/Version.h"

diff  --git a/clang/lib/Driver/ToolChains/VE.cpp 
b/clang/lib/Driver/ToolChains/VEToolchain.cpp
similarity index 99%
rename from clang/lib/Driver/ToolChains/VE.cpp
rename to clang/lib/Driver/ToolChains/VEToolchain.cpp
index ae4e5fedf6b4..6ea405c0269c 100644
--- a/clang/lib/Driver/ToolChains/VE.cpp
+++ b/clang/lib/Driver/ToolChains/VEToolchain.cpp
@@ -6,7 +6,7 @@
 //
 
//===--===//
 
-#include "VE.h"
+#include "VEToolchain.h"
 #include "CommonArgs.h"
 #include "clang/Driver/Compilation.h"
 #include "clang/Driver/Driver.h"

diff  --git a/clang/lib/Driver/ToolChains/VE.h 
b/clang/lib/Driver/ToolChains/VEToolchain.h
similarity index 100%
rename from clang/lib/Driver/ToolChains/VE.h
rename to clang/lib/Driver/ToolChains/VEToolchain.h



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


[clang] 6036bf5 - [VE] Add clang tests for VE

2020-06-24 Thread Kazushi Marukawa via cfe-commits

Author: Kazushi (Jam) Marukawa
Date: 2020-06-25T12:03:19+09:00
New Revision: 6036bf53090e03537f7d06a8daecda84a72a9bc9

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

LOG: [VE] Add clang tests for VE

Summary:
Add a preprocessor test to check VE predefinitions.  Add a driver test
to check VE toolchain behavior.

Reviewers: simoll, k-ishizaka

Reviewed By: simoll

Subscribers: krytarowski, jfb, ormris, cfe-commits

Tags: #llvm, #ve, #clang

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

Added: 
clang/test/Driver/ve-toolchain.c
clang/test/Preprocessor/init-ve.c

Modified: 


Removed: 




diff  --git a/clang/test/Driver/ve-toolchain.c 
b/clang/test/Driver/ve-toolchain.c
new file mode 100644
index ..7b93797ee597
--- /dev/null
+++ b/clang/test/Driver/ve-toolchain.c
@@ -0,0 +1,82 @@
+/// Check the behavior of toolchain for NEC Aurora VE
+/// REQUIRES: ve-registered-target
+
+///-
+/// Checking dwarf-version
+
+// RUN: %clang -### -g -target ve %s 2>&1 | FileCheck -check-prefix=DWARF_VER 
%s
+// DWARF_VER: "-dwarf-version=4"
+
+///-
+/// Checking dynamic-linker
+
+// RUN: %clang -### -target ve %s 2>&1 | FileCheck -check-prefix=DYNLINKER %s
+// DYNLINKER: nld{{.*}} "-dynamic-linker" "/opt/nec/ve/lib/ld-linux-ve.so.1"
+
+///-
+/// Checking VE specific option
+
+// RUN: %clang -### -target ve %s 2>&1 | FileCheck -check-prefix=VENLDOPT %s
+// VENLDOPT: nld{{.*}} "-z" "max-page-size=0x400"
+
+///-
+/// Checking include-path
+
+// RUN: %clang -### -target ve %s 2>&1 | FileCheck -check-prefix=DEFINC %s
+// DEFINC: clang{{.*}} "-cc1"
+// DEFINC: "-nostdsysteminc"
+// DEFINC: "-internal-isystem" "{{.*}}/lib/clang/{{[0-9.]*}}/include"
+// DEFINC: "-internal-isystem" "/opt/nec/ve/include"
+
+// RUN: %clang -### -target ve %s -nostdlibinc 2>&1 | \
+// RUN:FileCheck -check-prefix=NOSTDLIBINC %s
+// NOSTDLIBINC: clang{{.*}} "-cc1"
+// NOSTDLIBINC: "-internal-isystem" "{{.*}}/lib/clang/{{[0-9.]*}}/include"
+// NOSTDLIBINC-NOT: "-internal-isystem" "/opt/nec/ve/include"
+
+// RUN: %clang -### -target ve %s -nobuiltininc 2>&1 | \
+// RUN:FileCheck -check-prefix=NOBUILTININC %s
+// NOBUILTININC: clang{{.*}} "-cc1"
+// NOBUILTININC: "-nobuiltininc"
+// NOBUILTININC-NOT: "-internal-isystem" "{{.*}}/lib/clang/{{[0-9.]*}}/include"
+// NOBUILTININC: "-internal-isystem" "/opt/nec/ve/include"
+
+// RUN: %clang -### -target ve %s -nostdinc 2>&1 | \
+// RUN:FileCheck -check-prefix=NOSTDINC %s
+// NOSTDINC: clang{{.*}} "-cc1"
+// NOSTDINC: "-nobuiltininc"
+// NOSTDINC-NOT: "-internal-isystem" "{{.*}}/lib/clang/{{[0-9.]*}}/include"
+// NOSTDINC-NOT: "-internal-isystem" "/opt/nec/ve/include"
+
+///-
+/// Checking -fuse-init-array
+
+// RUN: %clang -### -target ve %s 2>&1 | FileCheck -check-prefix=DEFINITARRAY 
%s
+// DEFINITARRAY: clang{{.*}} "-cc1"
+// DEFINITARRAY-NOT: "-fuse-init-array"
+
+// RUN: %clang -### -target ve %s -fno-use-init-array 2>&1 | \
+// RUN: FileCheck -check-prefix=NOTINITARRAY %s
+// NOTINITARRAY: clang{{.*}} "-cc1"
+// NOTINITARRAY: "-fno-use-init-array"
+
+///-
+/// Checking exceptions
+
+// RUN: %clang -### -target ve %s 2>&1 | FileCheck -check-prefix=DEFEXCEPTION 
%s
+// DEFEXCEPTION: clang{{.*}} "-cc1"
+// DEFEXCEPTION: "-fsjlj-exceptions"
+
+///-
+/// Passing -fintegrated-as
+
+// RUN: %clang -### -target ve -x assembler %s 2>&1 | \
+// RUN:FileCheck -check-prefix=NAS_LINK %s
+// RUN: %clang -### -target ve -fintegrated-as -x assembler %s 2>&1 | \
+// RUN:FileCheck -check-prefix=AS_LINK %s
+
+// NAS_LINK: nas{{.*}}
+// NAS_LINK: nld{{.*}}
+
+// AS_LINK: clang{{.*}} "-cc1as"
+// AS_LINK: nld{{.*}}

diff  --git a/clang/test/Preprocessor/init-ve.c 
b/clang/test/Preprocessor/init-ve.c
new file mode 100644
index ..4686315f4ea0
--- /dev/null
+++ b/clang/test/Preprocessor/init-ve.c
@@ -0,0 +1,274 @@
+/// Check predefinitions for NEC Aurora VE
+/// REQUIRES: ve-registered-target
+
+// RUN: %clang_cc1 -E -dM -triple=ve < /dev/null | \
+// RUN: FileCheck -match-full-lines -check-prefix VE %s
+// RUN: %clang_cc1 -x c++ -E -dM -triple=ve < /dev/null | \
+// RUN: FileCheck -match-full-lines -check-prefix VE -check-prefix VE-CXX 
%s
+//
+// VE:#define _LP64 1
+// VE:#define __BIGGEST_ALIGNMENT__ 8
+//