summaryrefslogtreecommitdiffstats
path: root/clang/lib/Headers/altivec.h
Commit message (Collapse)AuthorAgeFilesLines
* This patch adds support for the vector quadword add/sub instructions introducedKit Barton2015-05-251-2/+176
| | | | | | | | | | | | | | | | | | | | | | | in POWER8. These are the Clang-related changes for http://reviews.llvm.org/D9081 vadduqm vaddeuqm vaddcuq vaddecuq vsubuqm vsubeuqm vsubcuq vsubecuq All builtins are added in altivec.h, and guarded with the POWER8_VECTOR and powerpc64 macros. http://reviews.llvm.org/D9903 llvm-svn: 238145
* [PPC64] Add vector pack/unpack support from ISA 2.07Bill Schmidt2015-05-161-0/+242
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for the following new instructions in the Power ISA 2.07: vpksdss vpksdus vpkudus vpkudum vupkhsw vupklsw These instructions are available through the vec_packs, vec_packsu, vec_unpackh, and vec_unpackl built-in interfaces. These are lane-sensitive instructions, so the built-ins have different implementations for big- and little-endian, and the instructions must be marked as killing the vector swap optimization for now. The first three instructions perform saturating pack operations. The fourth performs a modulo pack operation, which means it can be represented with a vector shuffle, and conversely the appropriate vector shuffles may cause this instruction to be generated. The other instructions are only generated via built-in support for now. I noticed during patch preparation that the macro __VSX__ was not previously predefined when the power8-vector or direct-move features are requested. This is an error, and I've corrected that here as well. Appropriate tests have been added. There is a companion patch to llvm for the rest of this support. llvm-svn: 237500
* Add builtins for the 64-bit vector integer arithmetic instructions added in ↵Kit Barton2015-03-111-0/+773
| | | | | | | | | | POWER8. These are the Clang-related changes for the instructions added to LLVM in http://reviews.llvm.org/D7959. Phabricator review: http://reviews.llvm.org/D8041 llvm-svn: 231931
* Add Clang support for PPC cryptography builtinsNemanja Ivanovic2015-03-041-0/+127
| | | | | | Review: http://reviews.llvm.org/D7951 llvm-svn: 231291
* Headers: Don't use attribute keywords which aren't reservedDavid Majnemer2015-02-041-14/+14
| | | | | | Instead of using 'unavailable', use '__unavailable__' llvm-svn: 228087
* Make sure that vec_perm is listed as a static function in altivec.h.Eric Christopher2014-12-101-18/+18
| | | | llvm-svn: 223871
* [PowerPC] Enable vec_perm for long long and double vector types for VSXBill Schmidt2014-11-141-0/+67
| | | | | | | | | | VSX makes the "vector long long" and "vector double" types available. This patch enables the vec_perm interface for these types. The same builtin is generated regardless of the specified type, so no additional work or testing is needed in the back end. Tests are added to ensure this builtin is generated by the front end. llvm-svn: 221988
* [PowerPC] Add VSX builtins for vec_divBill Schmidt2014-11-141-0/+15
| | | | | | | | | | | | This patch adds builtin support for xvdivdp and xvdivsp, along with a new test case. The builtins are accessed using vec_div in altivec.h. Builtins are listed (mostly) alphabetically there, so inserting these changed the line numbers for deprecation warnings tested in test/Headers/altivec-intrin.c. There is a companion patch for LLVM. llvm-svn: 221984
* [PowerPC] Add vec_vsx_ld and vec_vsx_st intrinsicsBill Schmidt2014-11-121-0/+85
| | | | | | | | | | | | | | | | | | This patch enables the vec_vsx_ld and vec_vsx_st intrinsics for PowerPC, which provide programmer access to the lxvd2x, lxvw4x, stxvd2x, and stxvw4x instructions. New code in altivec.h defines these in terms of new builtins, which are themselves defined in BuiltinsPPC.def. The builtins are converted to LLVM intrinsics in CGBuiltin.cpp. Additional code is added to builtins-ppc-vsx.c to verify the correct generation of the intrinsics. Note that I moved the other VSX builtins so all VSX builtins will be alphabetical in their own section in BuiltinsPPC.def. There is a companion patch for LLVM. llvm-svn: 221768
* [PowerPC] Initial VSX intrinsic support, with min/max for vector doubleBill Schmidt2014-10-311-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now that we have initial support for VSX, we can begin adding intrinsics for programmer access to VSX instructions. This patch performs the necessary enablement in the front end, and tests it by implementing intrinsics for minimum and maximum using the vector double data type. The main change in the front end is to no longer disallow "vector" and "double" in the same declaration (lib/Sema/DeclSpec.cpp), but "vector" and "long double" must still be disallowed. The new intrinsics are accessed via vec_max and vec_min with changes in lib/Headers/altivec.h. Note that for v4f32, we already access corresponding VMX builtins, but with VSX enabled we should use the forms that allow all 64 vector registers. The new built-ins are defined in include/clang/Basic/BuiltinsPPC.def. I've added a new test in test/CodeGen/builtins-ppc-vsx.c that is similar to, but much smaller than, builtins-ppc-altivec.c. This allows us to test VSX IR generation without duplicating CHECK lines for the existing bazillion Altivec tests. Since vector double is now legal when VSX is available, I've modified the error message, and changed where we test for it and for vector long double, since the target machine isn't visible in the old place. This serendipitously removed a not-pertinent warning about 'long' being deprecated when used with 'vector', when "vector long double" is encountered and we just want to issue an error. The existing tests test/Parser/altivec.c and test/Parser/cxx-altivec.cpp have been updated accordingly, and I've added test/Parser/vsx.c to verify that "vector double" is now legitimate with VSX enabled. There is a companion patch for LLVM. llvm-svn: 220989
* [PATCH][Power] Fix (and deprecate) vec_lvsl and vec_lvsr for little endianBill Schmidt2014-10-061-0/+182
| | | | | | | | | | | | | | | | | | | | | The use of the vec_lvsl and vec_lvsr interfaces are discouraged for little endian targets since Power8 hardware is a minimum requirement, and Power8 provides reasonable performance for unaligned vector loads and stores. Up till now we have not provided "correct" (i.e., big- endian-compatible) code generation for these interfaces, as to do so produces poorly performing code. However, this has become the source of too many questions. With this patch, LLVM will now produce compatible code for these interfaces, but will also produce a deprecation warning message for PPC64LE when one of them is used. This should make the porting direction clearer to programmers. A similar patch has recently been committed to GCC. This patch includes a test for the warning message. There is a companion patch that adds two unit tests to projects/test-suite. llvm-svn: 219137
* [PPC64LE] Fix wrong IR for vec_sld and vec_vsldoiBill Schmidt2014-08-041-108/+4
| | | | | | | | | | | | | | | | | | | | My original LE implementation of the vsldoi instruction, with its altivec.h interfaces vec_sld and vec_vsldoi, produces incorrect shufflevector operations in the LLVM IR. Correct code is generated because the back end handles the incorrect shufflevector in a consistent manner. This patch and a companion patch for LLVM correct this problem by removing the fixup from altivec.h and the corresponding fixup from the PowerPC back end. Several test cases are also modified to reflect the now-correct LLVM IR. The vec_sums and vec_vsumsws interfaces in altivec.h are also fixed, because they used vec_perm calls intended to be recognized as vsldoi instructions. These vec_perm calls are now replaced with code that more clearly shows the intent of the transformation. llvm-svn: 214801
* [PPC64LE] Run some existing Altivec tests on powerpc64le as wellBill Schmidt2014-06-131-1/+1
| | | | | | | | | | | There are several Altivec tests that formerly ran only on big-endian targets (and in some cases only on 32-bit targets). It is useful to verify these on little-endian targets as well. While testing these, I discovered a typo in <altivec.h>. This is also fixed by this patch. llvm-svn: 210928
* [PPC64LE] Fix vec_sld and vec_vsldoi for little endianBill Schmidt2014-06-111-0/+96
| | | | | | | | | | | | The vec_sld and vec_vsldoi interfaces perform a left-shift on vector arguments for both big and little endian. However, because they rely on the vec_perm interface which is endian-dependent, the permutation vector needs to be reversed for LE to get the proper shift direction. I've added some extra testing for these interfaces for LE in the builtins-ppc-altivec.c. llvm-svn: 210657
* [PPC64LE] Implement little-endian semantics for vec_sumsBill Schmidt2014-06-091-0/+26
| | | | | | | | | | | | | | | | | | The PowerPC vsumsws instruction, accessed via vec_sums, is defined architecturally with a big-endian bias, in that the second input vector and the result always reference big-endian element 3 (little-endian element 0). For ease of porting, the programmer wants elements 3 in both cases. To provide this semantics, for little endian we generate a permute for the second input vector prior to the vsumsws instruction, and generate a permute for the result vector following the vsumsws instruction. The correctness of this code is tested by the new sums.c test added in a previous patch, as well as the modifications to builtins-ppc-altivec.c in the present patch. llvm-svn: 210449
* [PPC64LE] Implement little-endian semantics for vec_unpack[hl]Bill Schmidt2014-06-071-4/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The PowerPC vector-unpack-high and vector-unpack-low instructions are defined architecturally with a big-endian bias, in that the vector element numbering is assumed to be "left to right" regardless of whether the processor is in big-endian or little-endian mode. This effectively reverses the meaning of "high" and "low." Such a definition is unnatural for little-endian code generation. To facilitate ease of porting, the vec_unpackh and vec_unpackl interfaces are designed to use natural element ordering, so that elements are numbered according to little-endian design principles when code is generated for a little-endian target. The desired semantics can be achieved by using the opposite instruction for little-endian mode. That is, when a call to vec_unpackh appears in the code, a vector-unpack-low is generated, and when a call to vec_unpackl appears in the code, a vector-unpack-high is generated. The correctness of this code is tested by the new unpack.c test added in a previous patch, as well as the modifications to builtins-ppc-altivec.c in the present patch. Note that these interfaces were originally incorrectly implemented when they take a vector pixel argument. This patch corrects this implementation for both big- and little-endian code generation. llvm-svn: 210391
* [PPC64LE] Update builtins-ppc-altivec.c for PPC64 and PPC64LEBill Schmidt2014-06-061-0/+26
| | | | | | | | | | | | | | | | | The Altivec builtin test case test/CodeGen/builtins-ppc-altivec.c has always been executed only for 32-bit PowerPC. These tests are equally valid for 64-bit PowerPC. This patch updates the test to be run for three targets: powerpc-unknown-unknown, powerpc64-unknown-unknown, and powerpc64le-unknown-unknown. The expected code generation changes for some of the Altivec builtins for little endian, so this patch adds new CHECK-LE variants to the test for the powerpc64le target. These tests satisfy the testing requirements for some previous patches committed over the last couple of days for lib/Headers/altivec.h: r210279 for vec_perm, r210337 for vec_mul[eo], and r210340 for vec_pack. llvm-svn: 210384
* [PPC64LE] Implement little-endian semantics for vec_pack familyBill Schmidt2014-06-061-0/+147
| | | | | | | | | | | | | | | | | | | | | | | | | The PowerPC vector-pack instructions are defined architecturally with a big-endian bias, in that the vector element numbering is assumed to be "left to right" regardless of whether the processor is in big-endian or little-endian mode. This definition is unnatural for little-endian code generation. To facilitate ease of porting, the vec_pack and related interfaces are designed to use natural element ordering, so that elements are numbered according to little-endian design principles when code is generated for a little-endian target. The vec_pack calls are implemented as calls to vec_perm, specifying selection of the odd-numbered vector elements. For little endian, this means the odd-numbered elements counting from the right end of the register. Since the underlying instructions count from the left end, we must instead select the even-numbered vector elements for little endian to achieve the desired semantics. The correctness of this code is tested by the new pack.c test added in a previous patch. I plan to later make the existing ppc32 Altivec compile-time tests work for ppc64 and ppc64le as well. llvm-svn: 210340
* [PPC64LE] Implement little-endian semantics for vec_mul[eo]Bill Schmidt2014-06-061-0/+67
| | | | | | | | | | | | | | | | | | | | | | | The PowerPC vector-multiply-even and vector-multiply-odd instructions are defined architecturally with a big-endian bias, in that the vector element numbering is assumed to be "left to right" regardless of whether the processor is in big-endian or little-endian mode. This definition is unnatural for little-endian code generation. To facilitate ease of porting, the vec_mule and vec_mulo interfacs are designed to use natural element ordering, so that elements are numbered according to little-endian design principles when code is generated for a little-endian target. The desired semantics can be achieved by using the opposite instruction for little-endian mode. That is, when a call to vec_mule appears in the code, a vector-multiply-odd is generated, and when a call to vec_mulo appears in the code, a vector-multiply-even is generated. The correctness of this code is tested by the new mult-even-odd.c test added in a previous patch. I plan to later make the existing ppc32 Altivec compile-time tests work for ppc64 and ppc64le as well. llvm-svn: 210337
* [PPC64LE] Implement little-endian semantics for vec_permBill Schmidt2014-06-051-21/+109
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The PowerPC vperm (vector permute) instruction is defined architecturally with a big-endian bias, in that the two input vectors are assumed to be concatenated "left to right" and the elements of the combined input vector are assumed to be numbered from "left to right" (i.e., with element 0 referencing the high-order element). This definition is unnatural for little-endian code generation. To facilitate ease of porting, the vec_perm interface is designed to use natural element ordering, so that elements are numbered according to little-endian design principles when code is generated for a little-endian target. The desired semantics can be achieved with the vperm instruction provided that the two input vector registers are reversed, and the permute control vector is complemented. The complementing is performed using an xor with a vector containing all one bits. Only the rightmost 5 bits of each element of the permute control vector are relevant, so it would be possible to complement the vector with respect to a <16xi8> vector containing all 31s. However, when the permute control vector is not a constant, using 255 instead has the advantage that the vec_xor can be recognized during code generation as a vnor instruction. (Power8 introduces a vnand instruction which could alternatively be generated.) The correctness of this code is tested by the new perm.c test added in a previous patch. I plan to later make the existing ppc32 Altivec compile-time tests work for ppc64 and ppc64le as well. llvm-svn: 210279
* PR15480: fixed second parameter types of vec_lde, vec_lvebx, vec_lvehx, and ↵Anton Yartsev2013-03-101-14/+14
| | | | | | vec_lvewx according to AltiVec Programming Interface Manual llvm-svn: 176789
* PR14964: intrinsic headers using non-reserved identifiersDavid Blaikie2013-01-161-3925/+3925
| | | | | | | | | | | | | | | | Several of the intrinsic headers were using plain non-reserved identifiers. C++11 17.6.4.3.2 [global.names] p1 reservers names containing a double begining with an underscore followed by an uppercase letter for any use. I think I got them all, but open to being corrected. For the most part I didn't bother updating function-like macro parameter names because I don't believe they're subject to any such collission - though some function-like macros already follow this convention (I didn't update them in part because the churn was more significant as several function-like macros use the double underscore prefixed version of the same name as a parameter in their implementation) llvm-svn: 172666
* Add "static" to some functions in altivec.c where it was missing.Ulrich Weigand2012-10-311-13/+13
| | | | llvm-svn: 167148
* Optimized IR for vec_splatAnton Yartsev2010-12-011-16/+32
| | | | llvm-svn: 120610
* turned pointers into pointers to const in function parameters in all ↵Anton Yartsev2010-11-161-175/+175
| | | | | | functions/builtins accepting pointers to a const-qualified type according to PIM and "Language Extensions for CBEA" llvm-svn: 119376
* support for AltiVec extensions from the Cell architectureAnton Yartsev2010-10-141-0/+1402
| | | | llvm-svn: 116478
* formatted everything to fit within 80 columnsAnton Yartsev2010-09-181-274/+522
| | | | llvm-svn: 114249
* support for predicates with bool/pixel argumentsAnton Yartsev2010-08-191-0/+1164
| | | | llvm-svn: 111515
* support for the rest of AltiVec functions with bool/pixel arguments and ↵Anton Yartsev2010-08-191-84/+2186
| | | | | | return values (except predicates) llvm-svn: 111511
* support for vec_perm and all dependent functions (vec_mergeh, vec_mergel, ↵Anton Yartsev2010-08-191-25/+321
| | | | | | vec_pack, vec_sld, vec_splat) with bool/pixel arguments and return values llvm-svn: 111509
* support for vec_add, vec_adds, vec_and, vec_andc with bool argumentsAnton Yartsev2010-08-161-6/+710
| | | | llvm-svn: 111141
* first test commitAnton Yartsev2010-08-121-8/+8
| | | | llvm-svn: 110941
* More AltiVec support.Anton Korobeynikov2010-06-191-438/+4879
| | | | | | Patch by Anton Yartsev! llvm-svn: 106387
* improve altivec c++ support by adding casts, patch byChris Lattner2010-04-141-198/+49
| | | | | | Anton Yartsev! llvm-svn: 101281
* implement altivec.h and a bunch of support code, patch by Anton Yartsev!Chris Lattner2010-04-141-0/+1632
llvm-svn: 101215
OpenPOWER on IntegriCloud