summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen/builtins-ppc-altivec.c
Commit message (Collapse)AuthorAgeFilesLines
* For PR17164: split -fno-lax-vector-conversion into three differentRichard Smith2019-09-131-3/+3
| | | | | | | | | | | | | | | | | | | | | levels: -- none: no lax vector conversions [new GCC default] -- integer: only conversions between integer vectors [old GCC default] -- all: all conversions between same-size vectors [Clang default] For now, Clang still defaults to "all" mode, but per my proposal on cfe-dev (2019-04-10) the default will be changed to "integer" as soon as that doesn't break lots of testcases. (Eventually I'd like to change the default to "none" to match GCC and general sanity.) Following GCC's behavior, the driver flag -flax-vector-conversions is translated to -flax-vector-conversions=integer. This reinstates r371805, reverted in r371813, with an additional fix for lldb. llvm-svn: 371817
* Fix interaction between r371813 and r371814.Richard Smith2019-09-131-3/+3
| | | | llvm-svn: 371816
* Remove reliance on lax vector conversions from altivec.h and its test.Richard Smith2019-09-131-13/+13
| | | | llvm-svn: 371814
* Improve function / variable disambiguation.Richard Smith2019-05-071-8/+1
| | | | | | | | Keep looking for decl-specifiers after an unknown identifier. Don't issue diagnostics about an error type specifier conflicting with later type specifiers. llvm-svn: 360117
* [PowerPC] Vector load/store builtins overstate alignment of pointersNemanja Ivanovic2018-11-261-42/+42
| | | | | | | | | | | | | A number of builtins in altivec.h load/store vectors from pointers to scalar types. Currently they just cast the pointer to a vector pointer, but expressions like that have the alignment of the target type. Of course, the input pointer did not have that alignment so this triggers UBSan (and rightly so). This resolves https://bugs.llvm.org/show_bug.cgi?id=39704 Differential revision: https://reviews.llvm.org/D54787 llvm-svn: 347556
* [PowerPC] [Clang] [AltiVec] The second parameter of vec_sr function should ↵Zi Xuan Wu2018-11-091-24/+48
| | | | | | | | | | | | | | | | be modulo the number of bits in the element The second parameter of vec_sr function is representing shift bits and it should be modulo the number of bits in the element like what vec_sl does now. This is actually required by the ABI: Each element of the result vector is the result of logically right shifting the corresponding element of ARG1 by the number of bits specified by the value of the corresponding element of ARG2, modulo the number of bits in the element. The bits that are shifted out are replaced by zeros. Differential Revision: https://reviews.llvm.org/D54087 llvm-svn: 346471
* Remove the -faltivec alias option and replace it with -maltivec everywhere.Eric Christopher2017-03-211-3/+3
| | | | | | | | | | | The alias was only ever used on darwin and had some issues there, and isn't used in practice much. Also fixes a problem with -mno-altivec not turning off -maltivec. Also add a diagnostic for faltivec/fno-altivec that directs users to use maltivec options and include the altivec.h file explicitly. llvm-svn: 298449
* [Altivec] Change vec_sl to a << (b % (sizeof(a) * 8))Tim Shen2017-01-201-12/+24
| | | | | | | | | | | | | | | | | For a << b (as original vec_sl does), if b >= sizeof(a) * 8, the behavior is undefined. However, Power instructions do define the behavior, which is equivalent to a << (b % (sizeof(a) * 8)). This patch changes altivec.h to use a << (b % (sizeof(a) * 8)), to ensure the consistent semantic of the instructions. Then it combines the generated multiple instructions back to a single shift. This patch handles left shift only. Right shift, on the other hand, is more complicated, considering arithematic/logical right shift. Differential Revision: https://reviews.llvm.org/D28037 llvm-svn: 292659
* [PPC] support for arithmetic builtins in the FEEhsan Amiri2016-11-241-0/+79
| | | | | | | | | | | | | | | | | | | | (commit again after fixing the buildbot failures) This adds various overloads of the following builtins to altivec.h: vec_neg vec_nabs vec_adde vec_addec vec_sube vec_subec vec_subc Note that for vec_sub builtins on 32 bit integers, the semantics is similar to what ISA describes for instructions like vsubecuq that work on quadwords: the first operand is added to the one's complement of the second operand. (As opposed to two's complement which I expected). llvm-svn: 287872
* [PPC] revert r287795Ehsan Amiri2016-11-231-79/+0
| | | | | | A test that passed locally is failing on one of the build bots. llvm-svn: 287796
* [PPC] support for arithmetic builtins in the FEEhsan Amiri2016-11-231-0/+79
| | | | | | | | | | | | | | | | | | | | (commit again after fixing the buildbot failures) This adds various overloads of the following builtins to altivec.h: vec_neg vec_nabs vec_adde vec_addec vec_sube vec_subec vec_subc Note that for vec_sub builtins on 32 bit integers, the semantics is similar to what ISA describes for instructions like vsubecuq that work on quadwords: the first operand is added to the one's complement of the second operand. (As opposed to two's complement which I expected). llvm-svn: 287795
* [PPC] Reverting r287772Ehsan Amiri2016-11-231-79/+0
| | | | | | Due to buildbot failure, I revert. Will recommit after investigation. llvm-svn: 287775
* [PPC] support for arithmetic builtins in the FEEhsan Amiri2016-11-231-0/+79
| | | | | | | | | | | | | | | | | | | This adds various overloads of the following builtins to altivec.h: vec_neg vec_nabs vec_adde vec_addec vec_sube vec_subec vec_subc Note that for vec_sub builtins on 32 bit integers, the semantics is similar to what ISA describes for instructions like vsubecuq that work on quadwords: the first operand is added to the one's complement of the second operand. (As opposed to two's complement which I expected). llvm-svn: 287772
* [PowerPC] Implement BE VSX load/store builtins - clang portion.Tony Jiang2016-11-151-1/+75
| | | | | | | | | | | | This patch implements all the overloads for vec_xl_be and vec_xst_be. On BE, they behaves exactly the same with vec_xl and vec_xst, therefore they are simply implemented by defining a matching macro. On LE, they are implemented by defining new builtins and intrinsics. For int/float/long long/double, it is just a load (lxvw4x/lxvd2x) or store(stxvw4x/stxvd2x). For char/char/short, we also need some extra shuffling before or after call the builtins to get the desired BE order. For int128, simply call vec_xl or vec_xst. llvm-svn: 286971
* [PowerPC] Add vector conversion builtins to altivec.h - clang portionNemanja Ivanovic2016-11-111-0/+16
| | | | | | | | | This patch corresponds to review: https://reviews.llvm.org/D26308 It adds a number of vector type conversion builtins to altivec.h. llvm-svn: 286627
* [PowerPC] Implement plain VSX load/store builtins.Tony Jiang2016-11-101-0/+67
| | | | | | Implement all the different 24 overloads for vec_xl and vec_xst. llvm-svn: 286455
* [PowerPC] Implement remaining vector comparison builtins.Tony Jiang2016-11-081-0/+24
| | | | | | | | | vector bool char vec_cmpeq (vector bool char, vector bool char); vector bool int vec_cmpeq (vector bool int, vector bool int); vector bool long long vec_cmpeq (vector bool long long, vector bool long lon vector bool short vec_cmpeq (vector bool short, vector bool short); llvm-svn: 286205
* [PowerPC] Implement vector shift builtins - clang portionNemanja Ivanovic2016-11-011-0/+73
| | | | | | | This patch corresponds to review https://reviews.llvm.org/D26092. Committing on behalf of Tony Jiang. llvm-svn: 285694
* [PPC] add vector byte reverse functions to altivec.hNemanja Ivanovic2016-10-271-2/+88
| | | | | | | This patch corresponds to review https://reviews.llvm.org/D25915. Committing on behalf of Sean Fertile. llvm-svn: 285268
* [PPC] Implement vector reverse elements builtins (vec_reve)Nemanja Ivanovic2016-10-261-0/+45
| | | | | | | This patch corresponds to review https://reviews.llvm.org/D25906. Committing on behalf of Tony Jiang. llvm-svn: 285218
* The time when -faltivec (or, on clang only, -maltivec) will magicallyEric Christopher2016-03-241-1/+4
| | | | | | | | | include altivec.h has come and gone. Rationale: This causes modules, rewrite-includes, etc to be sad and people should just include altivec.h in their source. llvm-svn: 264235
* [PPC] FE support for generating VSX [negated] absolute value instructionsKit Barton2016-03-091-5/+21
| | | | | | | | | | Includes new built-in, conversion of built-in to target-independent intrinsic and update in the header file. Tests are also updated. There is a second part in the backend for which I will post a separate code-review. BACKEND PART SHOULD BE COMMITTED FIRST. Phabricator: http://reviews.llvm.org/D17816 llvm-svn: 263051
* Addition of interfaces the FE to conform to Table A-2 of ELF V2 ABI V1.1Nemanja Ivanovic2015-09-291-0/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch corresponds to review: http://reviews.llvm.org/D13190 Implemented the following interfaces to conform to ELF V2 ABI version 1.1. vector signed __int128 vec_adde (vector signed __int128, vector signed __int128, vector signed __int128); vector unsigned __int128 vec_adde (vector unsigned __int128, vector unsigned __int128, vector unsigned __int128); vector signed __int128 vec_addec (vector signed __int128, vector signed __int128, vector signed __int128); vector unsigned __int128 vec_addec (vector unsigned __int128, vector unsigned __int128, vector unsigned __int128); vector signed int vec_addc(vector signed int __a, vector signed int __b); vector bool char vec_cmpge (vector signed char __a, vector signed char __b); vector bool char vec_cmpge (vector unsigned char __a, vector unsigned char __b); vector bool short vec_cmpge (vector signed short __a, vector signed short __b); vector bool short vec_cmpge (vector unsigned short __a, vector unsigned short __b); vector bool int vec_cmpge (vector signed int __a, vector signed int __b); vector bool int vec_cmpge (vector unsigned int __a, vector unsigned int __b); vector bool char vec_cmple (vector signed char __a, vector signed char __b); vector bool char vec_cmple (vector unsigned char __a, vector unsigned char __b); vector bool short vec_cmple (vector signed short __a, vector signed short __b); vector bool short vec_cmple (vector unsigned short __a, vector unsigned short __b); vector bool int vec_cmple (vector signed int __a, vector signed int __b); vector bool int vec_cmple (vector unsigned int __a, vector unsigned int __b); vector double vec_double (vector signed long long __a); vector double vec_double (vector unsigned long long __a); vector bool char vec_eqv(vector bool char __a, vector bool char __b); vector bool short vec_eqv(vector bool short __a, vector bool short __b); vector bool int vec_eqv(vector bool int __a, vector bool int __b); vector bool long long vec_eqv(vector bool long long __a, vector bool long long __b); vector signed short vec_madd(vector signed short __a, vector signed short __b, vector signed short __c); vector signed short vec_madd(vector signed short __a, vector unsigned short __b, vector unsigned short __c); vector signed short vec_madd(vector unsigned short __a, vector signed short __b, vector signed short __c); vector unsigned short vec_madd(vector unsigned short __a, vector unsigned short __b, vector unsigned short __c); vector bool long long vec_mergeh(vector bool long long __a, vector bool long long __b); vector bool long long vec_mergel(vector bool long long __a, vector bool long long __b); vector bool char vec_nand(vector bool char __a, vector bool char __b); vector bool short vec_nand(vector bool short __a, vector bool short __b); vector bool int vec_nand(vector bool int __a, vector bool int __b); vector bool long long vec_nand(vector bool long long __a, vector bool long long __b); vector bool char vec_orc(vector bool char __a, vector bool char __b); vector bool short vec_orc(vector bool short __a, vector bool short __b); vector bool int vec_orc(vector bool int __a, vector bool int __b); vector bool long long vec_orc(vector bool long long __a, vector bool long long __b); vector signed long long vec_sub(vector signed long long __a, vector signed long long __b); vector signed long long vec_sub(vector bool long long __a, vector signed long long __b); vector signed long long vec_sub(vector signed long long __a, vector bool long long __b); vector unsigned long long vec_sub(vector unsigned long long __a, vector unsigned long long __b); vector unsigned long long vec_sub(vector bool long long __a, vector unsigned long long __b); vector unsigned long long vec_sub(vector unsigned long long __V2 ABI V1.1 http://ror float vec_sub(vector float __a, vector float __b); unsigned char vec_extract(vector bool char __a, int __b); signed short vec_extract(vector signed short __a, int __b); unsigned short vec_extract(vector bool short __a, int __b); signed int vec_extract(vector signed int __a, int __b); unsigned int vec_extract(vector bool int __a, int __b); signed long long vec_extract(vector signed long long __a, int __b); unsigned long long vec_extract(vector unsigned long long __a, int __b); unsigned long long vec_extract(vector bool long long __a, int __b); double vec_extract(vector double __a, int __b); vector bool char vec_insert(unsigned char __a, vector bool char __b, int __c); vector signed short vec_insert(signed short __a, vector signed short __b, int __c); vector bool short vec_insert(unsigned short __a, vector bool short __b, int __c); vector signed int vec_insert(signed int __a, vector signed int __b, int __c); vector bool int vec_insert(unsigned int __a, vector bool int __b, int __c); vector signed long long vec_insert(signed long long __a, vector signed long long __b, int __c); vector unsigned long long vec_insert(unsigned long long __a, vector unsigned long long __b, int __c); vector bool long long vec_insert(unsigned long long __a, vector bool long long __b, int __c); vector double vec_insert(double __a, vector double __b, int __c); vector signed long long vec_splats(signed long long __a); vector unsigned long long vec_splats(unsigned long long __a); vector signed __int128 vec_splats(signed __int128 __a); vector unsigned __int128 vec_splats(unsigned __int128 __a); vector double vec_splats(double __a); int vec_all_eq(vector double __a, vector double __b); int vec_all_ge(vector double __a, vector double __b); int vec_all_gt(vector double __a, vector double __b); int vec_all_le(vector double __a, vector double __b); int vec_all_lt(vector double __a, vector double __b); int vec_all_nan(vector double __a); int vec_all_ne(vector double __a, vector double __b); int vec_all_nge(vector double __a, vector double __b); int vec_all_ngt(vector double __a, vector double __b); int vec_any_eq(vector double __a, vector double __b); int vec_any_ge(vector double __a, vector double __b); int vec_any_gt(vector double __a, vector double __b); int vec_any_le(vector double __a, vector double __b); int vec_any_lt(vector double __a, vector double __b); int vec_any_ne(vector double __a, vector double __b); vector unsigned char vec_sbox_be (vector unsigned char); vector unsigned char vec_cipher_be (vector unsigned char, vector unsigned char); vector unsigned char vec_cipherlast_be (vector unsigned char, vector unsigned char); vector unsigned char vec_ncipher_be (vector unsigned char, vector unsigned char); vector unsigned char vec_ncipherlast_be (vector unsigned char, vector unsigned char); vector unsigned int vec_shasigma_be (vector unsigned int, const int, const int); vector unsigned long long vec_shasigma_be (vector unsigned long long, const int, const int); vector unsigned short vec_pmsum_be (vector unsigned char, vector unsigned char); vector unsigned int vec_pmsum_be (vector unsigned short, vector unsigned short); vector unsigned long long vec_pmsum_be (vector unsigned int, vector unsigned int); vector unsigned __int128 vec_pmsum_be (vector unsigned long long, vector unsigned long long); vector unsigned char vec_gb (vector unsigned char); vector unsigned long long vec_bperm (vector unsigned __int128 __a, vector unsigned char __b); Removed the folowing interfaces either because their signatures have changed in version 1.1 of the ABI or because they were implemented for ELF V2 ABI but have actually been deprecated in version 1.1. vector signed char vec_eqv(vector bool char __a, vector signed char __b); vector signed char vec_eqv(vector signed char __a, vector bool char __b); vector unsigned char vec_eqv(vector bool char __a, vector unsigned char __b); vector unsigned char vec_eqv(vector unsigned char __a, vector bool char __b); vector signed short vec_eqv(vector bool short __a, vector signed short __b); vector signed short vec_eqv(vector signed short __a, vector bool short __b); vector unsigned short vec_eqv(vector bool short __a, vector unsigned short __b); vector unsigned short vec_eqv(vector unsigned short __a, vector bool short __b); vector signed int vec_eqv(vector bool int __a, vector signed int __b); vector signed int vec_eqv(vector signed int __a, vector bool int __b); vector unsigned int vec_eqv(vector bool int __a, vector unsigned int __b); vector unsigned int vec_eqv(vector unsigned int __a, vector bool int __b); vector signed long long vec_eqv(vector bool long long __a, vector signed long long __b); vector signed long long vec_eqv(vector signed long long __a, vector bool long long __b); vector unsigned long long vec_eqv(vector bool long long __a, vector unsigned long long __b); vector unsigned long long vec_eqv(vector unsigned long long __a, vector bool long long __b); vector float vec_eqv(vector bool int __a, vector float __b); vector float vec_eqv(vector float __a, vector bool int __b); vector double vec_eqv(vector bool long long __a, vector double __b); vector double vec_eqv(vector double __a, vector bool long long __b); vector unsigned short vec_nand(vector bool short __a, vector unsigned short __b); llvm-svn: 248813
* [PPC64] Update tests for vec_sldBill Schmidt2015-07-151-1/+145
| | | | | | | | | | | Revision 224297 modified the behavior of vec_sld for little endian so that LLVM will generate the correct corresponding vsldoi instruction. I neglected to update the existing tests, which continued to pass because they were not specific enough. This patch adds enough specificity to the tests to make them useful for BE and LE testing of vec_sld. llvm-svn: 242313
* Add missing builtins to altivec.h for ABI compliance (vol. 4)Nemanja Ivanovic2015-07-141-0/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch corresponds to review: http://reviews.llvm.org/D11184 A number of new interfaces for altivec.h (as mandated by the ABI): vector float vec_cpsgn(vector float, vector float) vector double vec_cpsgn(vector double, vector double) vector double vec_or(vector bool long long, vector double) vector double vec_or(vector double, vector bool long long) vector double vec_re(vector double) vector signed char vec_cntlz(vector signed char) vector unsigned char vec_cntlz(vector unsigned char) vector short vec_cntlz(vector short) vector unsigned short vec_cntlz(vector unsigned short) vector int vec_cntlz(vector int) vector unsigned int vec_cntlz(vector unsigned int) vector signed long long vec_cntlz(vector signed long long) vector unsigned long long vec_cntlz(vector unsigned long long) vector signed char vec_nand(vector bool signed char, vector signed char) vector signed char vec_nand(vector signed char, vector bool signed char) vector signed char vec_nand(vector signed char, vector signed char) vector unsigned char vec_nand(vector bool unsigned char, vector unsigned char) vector unsigned char vec_nand(vector unsigned char, vector bool unsigned char) vector unsigned char vec_nand(vector unsigned char, vector unsigned char) vector short vec_nand(vector bool short, vector short) vector short vec_nand(vector short, vector bool short) vector short vec_nand(vector short, vector short) vector unsigned short vec_nand(vector bool unsigned short, vector unsigned short) vector unsigned short vec_nand(vector unsigned short, vector bool unsigned short) vector unsigned short vec_nand(vector unsigned short, vector unsigned short) vector int vec_nand(vector bool int, vector int) vector int vec_nand(vector int, vector bool int) vector int vec_nand(vector int, vector int) vector unsigned int vec_nand(vector bool unsigned int, vector unsigned int) vector unsigned int vec_nand(vector unsigned int, vector bool unsigned int) vector unsigned int vec_nand(vector unsigned int, vector unsigned int) vector signed long long vec_nand(vector bool long long, vector signed long long) vector signed long long vec_nand(vector signed long long, vector bool long long) vector signed long long vec_nand(vector signed long long, vector signed long long) vector unsigned long long vec_nand(vector bool long long, vector unsigned long long) vector unsigned long long vec_nand(vector unsigned long long, vector bool long long) vector unsigned long long vec_nand(vector unsigned long long, vector unsigned long long) vector signed char vec_orc(vector bool signed char, vector signed char) vector signed char vec_orc(vector signed char, vector bool signed char) vector signed char vec_orc(vector signed char, vector signed char) vector unsigned char vec_orc(vector bool unsigned char, vector unsigned char) vector unsigned char vec_orc(vector unsigned char, vector bool unsigned char) vector unsigned char vec_orc(vector unsigned char, vector unsigned char) vector short vec_orc(vector bool short, vector short) vector short vec_orc(vector short, vector bool short) vector short vec_orc(vector short, vector short) vector unsigned short vec_orc(vector bool unsigned short, vector unsigned short) vector unsigned short vec_orc(vector unsigned short, vector bool unsigned short) vector unsigned short vec_orc(vector unsigned short, vector unsigned short) vector int vec_orc(vector bool int, vector int) vector int vec_orc(vector int, vector bool int) vector int vec_orc(vector int, vector int) vector unsigned int vec_orc(vector bool unsigned int, vector unsigned int) vector unsigned int vec_orc(vector unsigned int, vector bool unsigned int) vector unsigned int vec_orc(vector unsigned int, vector unsigned int) vector signed long long vec_orc(vector bool long long, vector signed long long) vector signed long long vec_orc(vector signed long long, vector bool long long) vector signed long long vec_orc(vector signed long long, vector signed long long) vector unsigned long long vec_orc(vector bool long long, vector unsigned long long) vector unsigned long long vec_orc(vector unsigned long long, vector bool long long) vector unsigned long long vec_orc(vector unsigned long long, vector unsigned long long) vector signed char vec_div(vector signed char, vector signed char) vector unsigned char vec_div(vector unsigned char, vector unsigned char) vector signed short vec_div(vector signed short, vector signed short) vector unsigned short vec_div(vector unsigned short, vector unsigned short) vector signed int vec_div(vector signed int, vector signed int) vector unsigned int vec_div(vector unsigned int, vector unsigned int) vector signed long long vec_div(vector signed long long, vector signed long long) vector unsigned long long vec_div(vector unsigned long long, vector unsigned long long) vector unsigned char vec_mul(vector unsigned char, vector unsigned char) vector unsigned int vec_mul(vector unsigned int, vector unsigned int) vector unsigned long long vec_mul(vector unsigned long long, vector unsigned long long) vector unsigned short vec_mul(vector unsigned short, vector unsigned short) vector signed char vec_mul(vector signed char, vector signed char) vector signed int vec_mul(vector signed int, vector signed int) vector signed long long vec_mul(vector signed long long, vector signed long long) vector signed short vec_mul(vector signed short, vector signed short) vector signed long long vec_mergeh(vector signed long long, vector signed long long) vector signed long long vec_mergeh(vector signed long long, vector bool long long) vector signed long long vec_mergeh(vector bool long long, vector signed long long) vector unsigned long long vec_mergeh(vector unsigned long long, vector unsigned long long) vector unsigned long long vec_mergeh(vector unsigned long long, vector bool long long) vector unsigned long long vec_mergeh(vector bool long long, vector unsigned long long) vector double vec_mergeh(vector double, vector double) vector double vec_mergeh(vector double, vector bool long long) vector double vec_mergeh(vector bool long long, vector double) vector signed long long vec_mergel(vector signed long long, vector signed long long) vector signed long long vec_mergel(vector signed long long, vector bool long long) vector signed long long vec_mergel(vector bool long long, vector signed long long) vector unsigned long long vec_mergel(vector unsigned long long, vector unsigned long long) vector unsigned long long vec_mergel(vector unsigned long long, vector bool long long) vector unsigned long long vec_mergel(vector bool long long, vector unsigned long long) vector double vec_mergel(vector double, vector double) vector double vec_mergel(vector double, vector bool long long) vector double vec_mergel(vector bool long long, vector double) vector signed int vec_pack(vector signed long long, vector signed long long) vector unsigned int vec_pack(vector unsigned long long, vector unsigned long long) vector bool int vec_pack(vector bool long long, vector bool long long) llvm-svn: 242171
* Add missing builtins to altivec.h for ABI compliance (vol. 3)Nemanja Ivanovic2015-07-101-12/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch corresponds to review: http://reviews.llvm.org/D10972 Fix for the handling of dependent features that are enabled by default on some CPU's (such as -mvsx, -mpower8-vector). Also provides a number of new interfaces or fixes existing ones in altivec.h. Changed signatures to conform to ABI: vector short vec_perm(vector signed short, vector signed short, vector unsigned char) vector int vec_perm(vector signed int, vector signed int, vector unsigned char) vector long long vec_perm(vector signed long long, vector signed long long, vector unsigned char) vector signed char vec_sld(vector signed char, vector signed char, const int) vector unsigned char vec_sld(vector unsigned char, vector unsigned char, const int) vector bool char vec_sld(vector bool char, vector bool char, const int) vector unsigned short vec_sld(vector unsigned short, vector unsigned short, const int) vector signed short vec_sld(vector signed short, vector signed short, const int) vector signed int vec_sld(vector signed int, vector signed int, const int) vector unsigned int vec_sld(vector unsigned int, vector unsigned int, const int) vector float vec_sld(vector float, vector float, const int) vector signed char vec_splat(vector signed char, const int) vector unsigned char vec_splat(vector unsigned char, const int) vector bool char vec_splat(vector bool char, const int) vector signed short vec_splat(vector signed short, const int) vector unsigned short vec_splat(vector unsigned short, const int) vector bool short vec_splat(vector bool short, const int) vector pixel vec_splat(vector pixel, const int) vector signed int vec_splat(vector signed int, const int) vector unsigned int vec_splat(vector unsigned int, const int) vector bool int vec_splat(vector bool int, const int) vector float vec_splat(vector float, const int) Added a VSX path to: vector float vec_round(vector float) Added interfaces: vector signed char vec_eqv(vector signed char, vector signed char) vector signed char vec_eqv(vector bool char, vector signed char) vector signed char vec_eqv(vector signed char, vector bool char) vector unsigned char vec_eqv(vector unsigned char, vector unsigned char) vector unsigned char vec_eqv(vector bool char, vector unsigned char) vector unsigned char vec_eqv(vector unsigned char, vector bool char) vector signed short vec_eqv(vector signed short, vector signed short) vector signed short vec_eqv(vector bool short, vector signed short) vector signed short vec_eqv(vector signed short, vector bool short) vector unsigned short vec_eqv(vector unsigned short, vector unsigned short) vector unsigned short vec_eqv(vector bool short, vector unsigned short) vector unsigned short vec_eqv(vector unsigned short, vector bool short) vector signed int vec_eqv(vector signed int, vector signed int) vector signed int vec_eqv(vector bool int, vector signed int) vector signed int vec_eqv(vector signed int, vector bool int) vector unsigned int vec_eqv(vector unsigned int, vector unsigned int) vector unsigned int vec_eqv(vector bool int, vector unsigned int) vector unsigned int vec_eqv(vector unsigned int, vector bool int) vector signed long long vec_eqv(vector signed long long, vector signed long long) vector signed long long vec_eqv(vector bool long long, vector signed long long) vector signed long long vec_eqv(vector signed long long, vector bool long long) vector unsigned long long vec_eqv(vector unsigned long long, vector unsigned long long) vector unsigned long long vec_eqv(vector bool long long, vector unsigned long long) vector unsigned long long vec_eqv(vector unsigned long long, vector bool long long) vector float vec_eqv(vector float, vector float) vector float vec_eqv(vector bool int, vector float) vector float vec_eqv(vector float, vector bool int) vector double vec_eqv(vector double, vector double) vector double vec_eqv(vector bool long long, vector double) vector double vec_eqv(vector double, vector bool long long) vector bool long long vec_perm(vector bool long long, vector bool long long, vector unsigned char) vector double vec_round(vector double) vector double vec_splat(vector double, const int) vector bool long long vec_splat(vector bool long long, const int) vector signed long long vec_splat(vector signed long long, const int) vector unsigned long long vec_splat(vector unsigned long long, vector bool int vec_sld(vector bool int, vector bool int, const int) vector bool short vec_sld(vector bool short, vector bool short, const int) llvm-svn: 241904
* [PPC64LE] Fix wrong IR for vec_sld and vec_vsldoiBill Schmidt2014-08-041-34/+0
| | | | | | | | | | | | | | | | | | | | 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
* vcfsx and dss instructions require immediates, variables are not valid.Joerg Sonnenberger2014-08-021-2/+2
| | | | llvm-svn: 214635
* [PPC64LE] Fix vec_sld and vec_vsldoi for little endianBill Schmidt2014-06-111-0/+32
| | | | | | | | | | | | 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/+4
| | | | | | | | | | | | | | | | | | 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-24/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 test for vec_sum2s interfaceBill Schmidt2014-06-071-0/+4
| | | | | | | | Commit r210384 prematurely included changes to the little-endian implementation of the vec_sum2s interface. This patch modifies test/CodeGen/builtins-ppc-altivec.c to test those changes. llvm-svn: 210389
* [PPC64LE] Update builtins-ppc-altivec.c for PPC64 and PPC64LEBill Schmidt2014-06-061-2704/+8281
| | | | | | | | | | | | | | | | | 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
* clang/test: REQUIRES: s/ppc{32|64}-registered-target/powerpc-registered-target/NAKAMURA Takumi2013-12-041-1/+1
| | | | llvm-svn: 196349
* CHECK-LABEL-ify some code gen tests to improve diagnostic experience when ↵Stephen Lin2013-08-151-5/+5
| | | | | | tests fail. llvm-svn: 188447
* 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
* Tests: check for target availability for target-specific tests.Jim Grosbach2012-07-091-0/+1
| | | | | | | | Lots of tests are using an explicit target triple w/o first checking that the target is actually available. Add a REQUIRES clause to a bunch of them. This should hopefully unbreak bots which don't configure w/ all targets enabled. llvm-svn: 159949
* Don't emit nsw flags for vector operations; there's basically no benefit, ↵Eli Friedman2011-05-061-43/+43
| | | | | | and a lot of downside (like PR9850, which is about clang's xmmintrin.h making an unexpected transformation on an expression involving _mm_add_epi32). llvm-svn: 131000
* supported: AltiVec vector initialization with a single literal according to ↵Anton Yartsev2011-03-271-168/+157
| | | | | | PIM section 2.5.1 - after initialization all elements have the value specified by the literal llvm-svn: 128375
* pre/post ++/-- for AltiVec vectors. (with builtins-ppc-altivec.c failure fixed)Anton Yartsev2011-02-071-0/+11
| | | | llvm-svn: 125000
* Revert r124146 for now. It appears to be failing on a few platforms.Eric Christopher2011-01-241-11/+0
| | | | llvm-svn: 124153
* pre/post increase/decrease for AltiVec vectorsAnton Yartsev2011-01-241-0/+11
| | | | llvm-svn: 124146
* comparison of AltiVec vectors now gives bool result (fix for 7533)Anton Yartsev2010-11-181-0/+61
| | | | llvm-svn: 119678
* support for AltiVec extensions from the Cell architectureAnton Yartsev2010-10-141-1/+956
| | | | llvm-svn: 116478
* support for predicates with bool/pixel argumentsAnton Yartsev2010-08-191-0/+193
| | | | llvm-svn: 111515
* support for the rest of AltiVec functions with bool/pixel arguments and ↵Anton Yartsev2010-08-191-49/+509
| | | | | | return values (except predicates) llvm-svn: 111511
* support for vec_perm and all dependent functions (vec_mergeh, vec_mergel, ↵Anton Yartsev2010-08-191-0/+39
| | | | | | 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-15/+182
| | | | llvm-svn: 111141
* Change IR generation for return (in the simple case) to avoid doing sillyChris Lattner2010-06-271-69/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | load/store nonsense in the epilog. For example, for: int foo(int X) { int A[100]; return A[X]; } we used to generate: %arrayidx = getelementptr inbounds [100 x i32]* %A, i32 0, i64 %idxprom ; <i32*> [#uses=1] %tmp1 = load i32* %arrayidx ; <i32> [#uses=1] store i32 %tmp1, i32* %retval %0 = load i32* %retval ; <i32> [#uses=1] ret i32 %0 } which codegen'd to this code: _foo: ## @foo ## BB#0: ## %entry subq $408, %rsp ## imm = 0x198 movl %edi, 400(%rsp) movl 400(%rsp), %edi movslq %edi, %rax movl (%rsp,%rax,4), %edi movl %edi, 404(%rsp) movl 404(%rsp), %eax addq $408, %rsp ## imm = 0x198 ret Now we generate: %arrayidx = getelementptr inbounds [100 x i32]* %A, i32 0, i64 %idxprom ; <i32*> [#uses=1] %tmp1 = load i32* %arrayidx ; <i32> [#uses=1] ret i32 %tmp1 } and: _foo: ## @foo ## BB#0: ## %entry subq $408, %rsp ## imm = 0x198 movl %edi, 404(%rsp) movl 404(%rsp), %edi movslq %edi, %rax movl (%rsp,%rax,4), %eax addq $408, %rsp ## imm = 0x198 ret This actually does matter, cutting out 2000 lines of IR from CGStmt.ll for example. Another interesting effect is that altivec.h functions which are dead now get dce'd by the inliner. Hence all the changes to builtins-ppc-altivec.c to ensure the calls aren't dead. llvm-svn: 106970
* Implement support for -fwrapv, rdar://7221421Chris Lattner2010-06-261-3/+3
| | | | | | | | | | | | As part of this, pull together trapv handling into the same enum. This also add support for NSW multiplies. This also makes PCH disagreement on overflow behavior silent, since it really doesn't matter except for warnings and codegen (no macros get defined etc). llvm-svn: 106956
OpenPOWER on IntegriCloud