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]

Re: Fix PR target/42881 (vec_init_dupl miscompiles)


On Wed, Jan 27, 2010 at 9:30 AM, Michael Matz <matz@suse.de> wrote:
> Hi,
>
> ix86_expand_vector_init_duplicate sometimes tries to force an operand into
> registers, after the instuction using the operand is already emitted,
> resulting in the above PR. ?This is the obvious fix for it. ?Okay for
> trunk if regstrapping on x86_64-linux passes?
>
>
> Ciao,
> Michael.
> --
> ? ? ? ?PR target/42881
> ? ? ? ?* config/i386/i386.c (ix86_expand_vector_init_duplicate):
> ? ? ? ?Wrap force_reg into a sequence, emit it before user.
>
> testsuite/
> ? ? ? ?* gcc.target/i386/pr42881.c: New test.
>
> Index: config/i386/i386.c
> ===================================================================
> --- config/i386/i386.c ?(revision 156295)
> +++ config/i386/i386.c ?(working copy)
> @@ -26644,8 +26644,16 @@ ix86_expand_vector_init_duplicate (bool
> ? ? ? ?insn = emit_insn (gen_rtx_SET (VOIDmode, target, dup));
> ? ? ? ?if (recog_memoized (insn) < 0)
> ? ? ? ? ?{
> + ? ? ? ? ? rtx seq;
> ? ? ? ? ? ?/* If that fails, force VAL into a register. ?*/
> +
> + ? ? ? ? ? start_sequence ();
> ? ? ? ? ? ?XEXP (dup, 0) = force_reg (GET_MODE_INNER (mode), val);
> + ? ? ? ? ? seq = get_insns ();
> + ? ? ? ? ? end_sequence ();
> + ? ? ? ? ? if (seq)
> + ? ? ? ? ? ? emit_insn_before (seq, insn);
> +
> ? ? ? ? ? ?ok = recog_memoized (insn) >= 0;
> ? ? ? ? ? ?gcc_assert (ok);
> ? ? ? ? ?}
> Index: testsuite/gcc.target/i386/pr42881.c
> ===================================================================
> --- testsuite/gcc.target/i386/pr42881.c (revision 0)
> +++ testsuite/gcc.target/i386/pr42881.c (revision 0)
> @@ -0,0 +1,14 @@
> +/* PR target/42881 */
> +/* { dg-do run } */
> +/* { dg-options "-O0 -msse" } */
> +#include "sse-check.h"
> +#include <xmmintrin.h>
> +static void
> +sse_test (void)
> +{
> + ?double a[2];
> + ?__m128d x = _mm_set1_pd(3);
> + ?_mm_storeu_pd(a,x);
> + ?if (a[0] != 3.0 || a[1] != 3.0)
> + ? ?__builtin_abort ();
> +}
>

You need -msse2 for __m128d. You don't need to include  <xmmintrin.h>
since  "sse-check.h" does it if -msse2 iss used.


-- 
H.J.


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