From: jakub Date: Wed, 18 Dec 2013 16:50:06 +0000 (+0000) Subject: PR target/59539 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=58fb74ce708e3251b4bb3e91d92d19b480f45259;p=thirdparty%2Fgcc.git PR target/59539 * config/i386/sse.md (_loadu, _loaddqu): New expanders, prefix existing define_insn names with *. * gcc.target/i386/pr59539-1.c: New test. * gcc.target/i386/pr59539-2.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@206090 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 46f1e9b64fce..83e8321f9c25 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2013-12-18 Jakub Jelinek + + PR target/59539 + * config/i386/sse.md + (_loadu, + _loaddqu): New expanders, + prefix existing define_insn names with *. + 2013-12-18 Eric Botcazou * config/arm/arm.c (arm_expand_epilogue_apcs_frame): Fix thinko. diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md index adedf44fc314..2cbbb14ccea4 100644 --- a/gcc/config/i386/sse.md +++ b/gcc/config/i386/sse.md @@ -912,7 +912,28 @@ DONE; }) -(define_insn "_loadu" +(define_expand "_loadu" + [(set (match_operand:VF 0 "register_operand") + (unspec:VF [(match_operand:VF 1 "nonimmediate_operand")] + UNSPEC_LOADU))] + "TARGET_SSE && " +{ + /* For AVX, normal *mov_internal pattern will handle unaligned loads + just fine if misaligned_operand is true, and without the UNSPEC it can + be combined with arithmetic instructions. If misaligned_operand is + false, still emit UNSPEC_LOADU insn to honor user's request for + misaligned load. */ + if (TARGET_AVX + && misaligned_operand (operands[1], mode) + /* FIXME: Revisit after AVX512F merge is completed. */ + && !) + { + emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1])); + DONE; + } +}) + +(define_insn "*_loadu" [(set (match_operand:VF 0 "register_operand" "=v") (unspec:VF [(match_operand:VF 1 "nonimmediate_operand" "vm")] @@ -999,7 +1020,29 @@ (set_attr "prefix" "evex") (set_attr "mode" "")]) -(define_insn "_loaddqu" +(define_expand "_loaddqu" + [(set (match_operand:VI_UNALIGNED_LOADSTORE 0 "register_operand") + (unspec:VI_UNALIGNED_LOADSTORE + [(match_operand:VI_UNALIGNED_LOADSTORE 1 "nonimmediate_operand")] + UNSPEC_LOADU))] + "TARGET_SSE2 && " +{ + /* For AVX, normal *mov_internal pattern will handle unaligned loads + just fine if misaligned_operand is true, and without the UNSPEC it can + be combined with arithmetic instructions. If misaligned_operand is + false, still emit UNSPEC_LOADU insn to honor user's request for + misaligned load. */ + if (TARGET_AVX + && misaligned_operand (operands[1], mode) + /* FIXME: Revisit after AVX512F merge is completed. */ + && !) + { + emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1])); + DONE; + } +}) + +(define_insn "*_loaddqu" [(set (match_operand:VI_UNALIGNED_LOADSTORE 0 "register_operand" "=v") (unspec:VI_UNALIGNED_LOADSTORE [(match_operand:VI_UNALIGNED_LOADSTORE 1 "nonimmediate_operand" "vm")] diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 730ce06a24b3..20a1bc59c4ff 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2013-12-18 Jakub Jelinek + + PR target/59539 + * gcc.target/i386/pr59539-1.c: New test. + * gcc.target/i386/pr59539-2.c: New test. + 2013-12-18 Nick Clifton * gcc.dg/pr32912-2.c: Fix for 16-bit targets. diff --git a/gcc/testsuite/gcc.target/i386/pr59539-1.c b/gcc/testsuite/gcc.target/i386/pr59539-1.c new file mode 100644 index 000000000000..9b34053c4cb5 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr59539-1.c @@ -0,0 +1,16 @@ +/* PR target/59539 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -mavx" } */ + +#include + +int +foo (void *p1, void *p2) +{ + __m128i d1 = _mm_loadu_si128 ((__m128i *) p1); + __m128i d2 = _mm_loadu_si128 ((__m128i *) p2); + __m128i result = _mm_cmpeq_epi16 (d1, d2); + return _mm_movemask_epi8 (result); +} + +/* { dg-final { scan-assembler-times "vmovdqu" 1 } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr59539-2.c b/gcc/testsuite/gcc.target/i386/pr59539-2.c new file mode 100644 index 000000000000..b53b8c407aba --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr59539-2.c @@ -0,0 +1,16 @@ +/* PR target/59539 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -mavx2" } */ + +#include + +int +foo (void *p1, void *p2) +{ + __m256i d1 = _mm256_loadu_si256 ((__m256i *) p1); + __m256i d2 = _mm256_loadu_si256 ((__m256i *) p2); + __m256i result = _mm256_cmpeq_epi16 (d1, d2); + return _mm256_movemask_epi8 (result); +} + +/* { dg-final { scan-assembler-times "vmovdqu" 1 } } */