Merging r243642, r243643, and r243644: ----------------------------------------…

Authored by hansw on Jul 30 2015, 3:47 PM.

Unpublished Commit · Learn More

Repository Importing: This repository is still importing.


Merging r243642, r243643, and r243644: ------------------------------------------------------------------------ r243642 | uweigand | 2015-07-30 07:08:36 -0700 (Thu, 30 Jul 2015) | 29 lines

Add support for System z vector language extensions

The z13 vector facility has an associated language extension,
closely modeled on AltiVec/VSX. The main differences are:

  • vector long, vector float and vector pixel are not supported
  • vector long long and vector double are supported (like VSX)
  • comparison operators return a vector rather than a scalar integer
  • shift operators behave like the OpenCL shift operators
  • vector bool is only supported as argument to certain operators; some operators allow mixing a bool with a non-bool vector

This patch adds clang support for the extension. It is closely modelled
on the AltiVec support. Similarly to the -faltivec option, there's a
new -fzvector option to enable the extensions (as well as an -mzvector
alias for compatibility with GCC). There's also a separate LangOpt.

The extension as implemented here is intended to be compatible with
the -mzvector extension recently implemented by GCC.

Based on a patch by Richard Sandiford.

Differential Revision: http://reviews.llvm.org/D11001

r243643 | uweigand | 2015-07-30 07:10:43 -0700 (Thu, 30 Jul 2015) | 18 lines

[SystemZ] Add support for vecintrin.h vector built-in functions

This patch adds support for the System Z vector built-in functions.
The API-defined header file has the name vecintrin.h.

The user-level functions are defined in the same style as the clang
version of altivec.h, making heavy use of the overloadable and
always_inline attributes. Where possible the functions expand to
generic operations rather than specific built-in functions, in the hope
that that form can be optimised better.

Where a built-in routine is specified to require an immediate integer
argument, the enable_if attribute is used to verify the argument is
in fact constant and in the appropriate range.

Based on a patch by Richard Sandiford.

r243644 | uweigand | 2015-07-30 08:53:58 -0700 (Thu, 30 Jul 2015) | 21 lines

Fix sanitizer fallout from r243642

The memory-sanitizer build bot reported:

5574== WARNING: MemorySanitizer: use-of-uninitialized-value

#0 0x7f03089e15f6 in

clang::SourceLocation, char const*&, unsigned int&, bool&)

This is because the "Ident_pixel" variable was uninitialized
in the getLangOpts().ZVector case, but we'd still call into
clang::Parser::TryAltiVecTokenOutOfLine, which uses the variable.

The simplest fix for this without sprinkling !getLangOpts().ZVector
checks all over the code seems to be to just initialize the variable
to nullptr; this will then do the right thing on ZVector.

Checked in to unbreak the build bots.

llvm-svn: 243699