diff mbox

PATCH: PR target/35757: [4.4 Regression] Incorrect contraint on sse4_1_blendp<ssemodesuffixf2c>

Message ID CAMe9rOox=yduMw5ys9VsB5kOAO2PuoNc0qF7a3g8X5PGAAm73g@mail.gmail.com
State New
Headers show

Commit Message

H.J. Lu Aug. 10, 2011, 2:42 p.m. UTC
On Wed, Aug 10, 2011 at 7:12 AM, Richard Guenther
<richard.guenther@gmail.com> wrote:
> On Wed, Aug 10, 2011 at 4:04 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> On Wed, Aug 10, 2011 at 6:46 AM, Richard Guenther
>> <richard.guenther@gmail.com> wrote:
>>> On Sat, Mar 29, 2008 at 10:11 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>>> This patch restores proper checking the third argument on blendpd and
>>>> and blendps.  It also adds 2 tests, including pblendw.  Tested on
>>>> Linux/Intel64. OK to install?
>>>
>>> The gcc.target/i386/sse4_1-blendps-2.c test randomly fails because
>>> src3 is used uninitialized.
>>>
>>
>> SRC2 may be uninitialized.  But I never saw random failures
>> since it checks if random value in SRC2 is properly blended.
>
> No, src2 is initialized via init_blendps (src1.f, src2.f), src3 is
> uninitialized.
> I see random execute fails on Nehalem.
>
> I suppose we might optimize the uninitialized memory (it's probably
> committed to registers) based on the undefined behavior.
>
> Please avoid this by initializing src3 properly.
>

Here is a patch.  OK for trunk?

Comments

Richard Biener Aug. 10, 2011, 2:45 p.m. UTC | #1
On Wed, Aug 10, 2011 at 4:42 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Wed, Aug 10, 2011 at 7:12 AM, Richard Guenther
> <richard.guenther@gmail.com> wrote:
>> On Wed, Aug 10, 2011 at 4:04 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>> On Wed, Aug 10, 2011 at 6:46 AM, Richard Guenther
>>> <richard.guenther@gmail.com> wrote:
>>>> On Sat, Mar 29, 2008 at 10:11 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>>>> This patch restores proper checking the third argument on blendpd and
>>>>> and blendps.  It also adds 2 tests, including pblendw.  Tested on
>>>>> Linux/Intel64. OK to install?
>>>>
>>>> The gcc.target/i386/sse4_1-blendps-2.c test randomly fails because
>>>> src3 is used uninitialized.
>>>>
>>>
>>> SRC2 may be uninitialized.  But I never saw random failures
>>> since it checks if random value in SRC2 is properly blended.
>>
>> No, src2 is initialized via init_blendps (src1.f, src2.f), src3 is
>> uninitialized.
>> I see random execute fails on Nehalem.
>>
>> I suppose we might optimize the uninitialized memory (it's probably
>> committed to registers) based on the undefined behavior.
>>
>> Please avoid this by initializing src3 properly.
>>
>
> Here is a patch.  OK for trunk?

Ok.

Richard.

>
> --
> H.J.
> ----
> diff --git a/gcc/testsuite/gcc.target/i386/sse4_1-blendps-2.c
> b/gcc/testsuite/gcc.target/i386/sse4_1-blendps-2.c
> index b66bbfd..af56e14 100644
> --- a/gcc/testsuite/gcc.target/i386/sse4_1-blendps-2.c
> +++ b/gcc/testsuite/gcc.target/i386/sse4_1-blendps-2.c
> @@ -6,6 +6,7 @@
>
>  #include <smmintrin.h>
>  #include <string.h>
> +#include <stdlib.h>
>
>  #define NUM 20
>
> @@ -52,11 +53,15 @@ sse4_1_test (void)
>     {
>       __m128 x;
>       float f[4];
> +      int i[4];
>     } src3;
>   int i;
>
>   init_blendps (src1.f, src2.f);
>
> +  for (i = 0; i < 4; i++)
> +    src3.i[i] = (int) random ();
> +
>   /* Check blendps imm8, m128, xmm */
>   for (i = 0; i < NUM; i++)
>     {
>
diff mbox

Patch

diff --git a/gcc/testsuite/gcc.target/i386/sse4_1-blendps-2.c
b/gcc/testsuite/gcc.target/i386/sse4_1-blendps-2.c
index b66bbfd..af56e14 100644
--- a/gcc/testsuite/gcc.target/i386/sse4_1-blendps-2.c
+++ b/gcc/testsuite/gcc.target/i386/sse4_1-blendps-2.c
@@ -6,6 +6,7 @@ 

 #include <smmintrin.h>
 #include <string.h>
+#include <stdlib.h>

 #define NUM 20

@@ -52,11 +53,15 @@  sse4_1_test (void)
     {
       __m128 x;
       float f[4];
+      int i[4];
     } src3;
   int i;

   init_blendps (src1.f, src2.f);

+  for (i = 0; i < 4; i++)
+    src3.i[i] = (int) random ();
+
   /* Check blendps imm8, m128, xmm */
   for (i = 0; i < NUM; i++)
     {