From patchwork Thu Apr 18 10:10:30 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivchenko X-Patchwork-Id: 237599 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]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 705462C01D3 for ; Thu, 18 Apr 2013 20:10:42 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:in-reply-to:references:date:message-id:subject :from:to:content-type; q=dns; s=default; b=pBCiBS4O281NXvyA9I12d epfkzahvrCANXpMtYDzWOzs9yO5XOkPA23FqzL/R4Asj19d6V235rs/EeFUf44E8 3GmANQpYBcRNPNPei2OadsJSAa15T06rMKwuQ+7AiThvKYLxYKOe9t3kaXBb3HG9 cesBCB29HUfI5gvsMVrZ5s= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:in-reply-to:references:date:message-id:subject :from:to:content-type; s=default; bh=ozuE2O2PmiSXSBI15CSG44B6RMw =; b=YppMEWcnl8R1dw6/8EL+S7K1xsVKKVB02QMusdIkUlQUPFv+jOO5wI4rprB j9KTUYWRhuYV9TsLeCxwe5IhJlwmDHGBURrQqKpp636N6IdkpdDe16W8Mf2/wpEI RUHRVC5+KhtzEevh6naiY4cTSAkkLeof6tsTVxPOJ9LPQkZ4= Received: (qmail 14063 invoked by alias); 18 Apr 2013 10:10:34 -0000 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 Received: (qmail 14044 invoked by uid 89); 18 Apr 2013 10:10:33 -0000 X-Spam-SWARE-Status: No, score=-5.1 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, KHOP_RCVD_TRUST, KHOP_THREADED, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, TW_AV, TW_VP autolearn=ham version=3.3.1 Received: from mail-pa0-f47.google.com (HELO mail-pa0-f47.google.com) (209.85.220.47) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 18 Apr 2013 10:10:32 +0000 Received: by mail-pa0-f47.google.com with SMTP id bj3so1483732pad.6 for ; Thu, 18 Apr 2013 03:10:31 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.66.157.195 with SMTP id wo3mr12701408pab.79.1366279831083; Thu, 18 Apr 2013 03:10:31 -0700 (PDT) Received: by 10.68.233.102 with HTTP; Thu, 18 Apr 2013 03:10:30 -0700 (PDT) In-Reply-To: References: Date: Thu, 18 Apr 2013 14:10:30 +0400 Message-ID: Subject: Re: [testsuite, i386] Reimplementing array comparison in avx2-vpop-check.h From: Alexander Ivchenko To: Richard Biener , GCC Patches , Uros Bizjak Yep, that also works. The fix is pretty obvious, but still.. is it OK for trunk? thanks, Alexander 2013/4/11 Richard Biener : > On Thu, Apr 11, 2013 at 1:58 PM, Alexander Ivchenko wrote: >> Hi, >> >> Usually does not include but on bionic it is >> historically included. memcmp() reacts on a volatile argument >> differently, depending on whether is included or not. If it >> is included, then the compiler will generate a warning: >> warning: passing argument 2 of 'memcmp' discards 'volatile' qualifier >> from pointer target type [enabled by default] >> >> In avx2-vpop-check.h we compare two arrays using memcmp(), and since >> one of them is declared as volatile we have test-fails because of that >> warning. The following patch reimplements the comparison using just >> for-loop: >> >> diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog >> index 943be90..9b08eb0 100644 >> --- a/gcc/testsuite/ChangeLog >> +++ b/gcc/testsuite/ChangeLog >> @@ -1,3 +1,7 @@ >> +2013-04-11 Grigoriy Kraynov >> + >> + * gcc.target/i386/avx2-vpop-check.h: memcmp() replaced by for loop. >> + >> 2013-04-11 Paolo Carlini >> >> PR c++/54216 >> diff --git a/gcc/testsuite/gcc.target/i386/avx2-vpop-check.h >> b/gcc/testsuite/gcc.target/i386/avx2-vpop-check.h >> index 143b54da..921ed0b 100644 >> --- a/gcc/testsuite/gcc.target/i386/avx2-vpop-check.h >> +++ b/gcc/testsuite/gcc.target/i386/avx2-vpop-check.h >> @@ -47,7 +47,8 @@ avx2_test (void) >> gen_pop (); >> check_pop (); >> >> - if (memcmp (c, c_ref, SIZE * sizeof (TYPE))) >> - abort(); >> + for (i = 0; i < SIZE; ++i) >> + if (c[i] != c_ref[i]) >> + abort(); >> } >> } >> >> >> is it OK? > > Just cast away the volatileness? memcmp (c, (void *)c_ref, ...)? > > Richard. > >> thanks, >> Alexander diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 64ffe8f..7efc3f1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-04-18 Grigoriy Kraynov + + * gcc.target/i386/avx2-vpop-check.h: volatility is casted away in + memcmp(). + 2013-04-18 Jakub Jelinek PR tree-optimization/56984 diff --git a/gcc/testsuite/gcc.target/i386/avx2-vpop-check.h b/gcc/testsuite/gcc.target/i386/avx2-vpop-check.h index 143b54da..02c879e 100644 --- a/gcc/testsuite/gcc.target/i386/avx2-vpop-check.h +++ b/gcc/testsuite/gcc.target/i386/avx2-vpop-check.h @@ -47,7 +47,7 @@ avx2_test (void) gen_pop (); check_pop (); - if (memcmp (c, c_ref, SIZE * sizeof (TYPE))) + if (memcmp (c, (void *) c_ref, SIZE * sizeof (TYPE))) abort(); } }