This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH, i386]: Fix PR 52932 - _mm256_permutevar8x32_ps and _mm256_permutevar8x32_ps


Hello!

Attached patch fixes issues around AVX2 vpermps and vpermd instructions.

1. Changes second argument of _mm256_permutevar8x32_ps to __m256i type
and consequently changes second argument of
__builtin_ia32_permvarsf256 argument to __v8si type.
2. Changes avx2_permvarv2sf pattern to accept v8si mask operand as its
2nd operand
3. Changes avx2_permvarv2si pattern in similar way, so it accepts mask
as its 2nd operand
4. Macroizes avx2_permvarv2sf and permvarv2si patterns
5. Mechanically updates all calls to these two expanders
6. Fixes testcases accordingly

2012-04-12  Uros Bizjak  <ubizjak@gmail.com>

	PR target/52932
	* config/i386/avx2intrin.h (_mm256_permutevar8x32_ps): Change second
	argument type to __m256i.  Update call to __builtin_ia32_permvarsf256.
	* config/i386/sse.md (UNSPEC_VPERMVAR): New.
	(UNSPEC_VPERMSI, UNSPEC_VPERMSF): Remove.
	(avx2_permvarv8sf, avx2_permvarv8si): Switch operands 1 and 2.
	(avx2_permvar<mode>): Macroize insn from avx2_permvarv8sf and
	avx2_permvarv8si using VI4F_256 mode iterator.
	* config/i386/i386.c (bdesc_args) <__builtin_ia32_permvarsf256>:
	Update builtin type to V8SF_FTYPE_V8SF_V8SI.
	(ix86_expand_vec_perm): Update calls to gen_avx2_permvarv8si and
	gen_avx2_permvarv8sf.
	(expand_vec_perm_pshufb): Ditto.

testsuite/ChangeLog:

2012-04-12  Uros Bizjak  <ubizjak@gmail.com>

	PR target/52932
	* gcc.target/i386/avx2-vpermps-1.c (avx2_test): Use __m256i type for
	second function argument.
	* gcc.target/i386/avx2-vpermps-2.c (init_permps): Update declaration.
	(calc_permps): Update declaration.  Calculate result correctly.
	(avx2_test): Change src2 type to union256i_d.
	* gcc.target/i386/avx2-vpermd-2.c (calc_permd): Calculate result
	correctly.

Patch was tested on x86_64-pc-linux-gnu {,-m32}. Earlier version of
the patch (without mechanical changes) was also tested on AVX2 target
by Kirill.

Patch was committed to mainline SVN, will be committed to 4.7.1 in a few days.

Uros.

Attachment: p.diff.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]