From patchwork Wed Aug 10 14:42:56 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 109381 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id A7999B6F8A for ; Thu, 11 Aug 2011 00:43:17 +1000 (EST) Received: (qmail 3401 invoked by alias); 10 Aug 2011 14:43:15 -0000 Received: (qmail 3392 invoked by uid 22791); 10 Aug 2011 14:43:14 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-qy0-f182.google.com (HELO mail-qy0-f182.google.com) (209.85.216.182) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 10 Aug 2011 14:42:57 +0000 Received: by qyk9 with SMTP id 9so679170qyk.20 for ; Wed, 10 Aug 2011 07:42:56 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.231.66 with SMTP id jp2mr2872303qcb.85.1312987376224; Wed, 10 Aug 2011 07:42:56 -0700 (PDT) Received: by 10.229.29.7 with HTTP; Wed, 10 Aug 2011 07:42:56 -0700 (PDT) In-Reply-To: References: <20080329211143.GA5741@lucon.org> Date: Wed, 10 Aug 2011 07:42:56 -0700 Message-ID: Subject: Re: PATCH: PR target/35757: [4.4 Regression] Incorrect contraint on sse4_1_blendp From: "H.J. Lu" To: Richard Guenther Cc: gcc-patches@gcc.gnu.org X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org On Wed, Aug 10, 2011 at 7:12 AM, Richard Guenther wrote: > On Wed, Aug 10, 2011 at 4:04 PM, H.J. Lu wrote: >> On Wed, Aug 10, 2011 at 6:46 AM, Richard Guenther >> wrote: >>> On Sat, Mar 29, 2008 at 10:11 PM, H.J. Lu 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? 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 #include +#include #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++) {