From patchwork Tue Jul 10 01:11:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Malcolm X-Patchwork-Id: 941764 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-481252-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="wJh2YfYu"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41PjjC4cC1z9s0W for ; Tue, 10 Jul 2018 10:28:15 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:in-reply-to:references; q=dns; s= default; b=Cgh+ZZbhFHKVsdQflNaPW4f8LXD0XD4NHlxbMA4sF80PJ18pTTzTk EBFt0XpsXrQxFVPQM1Oobw3xyjIKQ9nkaxvfCG8rSa/OtWxLDU1qO+P5JG4mhcax /YpjbXod3lw62toBdkNFxViBT1VNjPrkXQzz96v5Lwl3zY/5XOHBTU= 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:from :to:cc:subject:date:message-id:in-reply-to:references; s= default; bh=1pSlEOaRHP2Brf2BdxRENLL4df4=; b=wJh2YfYutlRvG0+PYKE0 cTLmiCy6naZOBfYY4/yAWT3ohCr6XBs9fATxjlod5GagJlb6SXjYOF04W2h+tkp8 bVDvcZRFXypDrgm5U7pepxOQM4FJ+IYfhmOqkT83RdmWysNWSHMTFATRj9x0uCqp Z6llW629kNU9G2P3b2gi07U= Received: (qmail 85917 invoked by alias); 10 Jul 2018 00:27:36 -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 85806 invoked by uid 89); 10 Jul 2018 00:27:35 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=gea, vect_int X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 10 Jul 2018 00:27:34 +0000 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 21E1287620; Tue, 10 Jul 2018 00:27:33 +0000 (UTC) Received: from c64.redhat.com (ovpn-112-31.phx2.redhat.com [10.3.112.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id BBB86600C9; Tue, 10 Jul 2018 00:27:31 +0000 (UTC) From: David Malcolm To: Richard Biener Cc: gcc-patches@gcc.gnu.org, Richard Sandiford , David Malcolm Subject: [PATCH 3/5] Add some test coverage Date: Mon, 9 Jul 2018 21:11:34 -0400 Message-Id: <1531185096-17113-4-git-send-email-dmalcolm@redhat.com> In-Reply-To: <1531185096-17113-1-git-send-email-dmalcolm@redhat.com> References: <1531185096-17113-1-git-send-email-dmalcolm@redhat.com> X-IsSubscribed: yes In particular, note how this allows us to highlight specific loops in testcases (via dg-remark), and to highlight the specific lines that cause problems to the vectorizer (via dg-message). gcc/testsuite/ChangeLog: * gcc.dg/vect/vect-alias-check-4.c: Add -fremarks to options. Add dg-remark and dg-message directives to the cover the expected vectorization failure reports. * gcc.dg/vect/vect-remarks-1.c: New test. --- gcc/testsuite/gcc.dg/vect/vect-alias-check-4.c | 11 +++++++---- gcc/testsuite/gcc.dg/vect/vect-remarks-1.c | 18 ++++++++++++++++++ 2 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/vect/vect-remarks-1.c diff --git a/gcc/testsuite/gcc.dg/vect/vect-alias-check-4.c b/gcc/testsuite/gcc.dg/vect/vect-alias-check-4.c index 1e5fc27..b08b4b4 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-alias-check-4.c +++ b/gcc/testsuite/gcc.dg/vect/vect-alias-check-4.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-require-effective-target vect_int } */ -/* { dg-additional-options "--param vect-max-version-for-alias-checks=0" } */ +/* { dg-additional-options "--param vect-max-version-for-alias-checks=0 -fremarks" } */ #define N 16 @@ -14,22 +14,25 @@ union u { struct s2 f; struct s3 g; }; void f1 (int a[][N], int b[][N]) { - for (int i = 0; i < N; ++i) + for (int i = 0; i < N; ++i) /* { dg-remark "couldn't vectorize loop" } */ a[0][i] += b[0][i]; + /* { dg-message "will not create alias checks, as --param vect-max-version-for-alias-checks == 0" "" { target *-*-* } .-2 } */ } void f2 (union u *a, union u *b) { - for (int i = 0; i < N; ++i) + for (int i = 0; i < N; ++i) /* { dg-remark "couldn't vectorize loop" } */ a->f.b.a[i] += b->g.e.a[i]; + /* { dg-message "will not create alias checks, as --param vect-max-version-for-alias-checks == 0" "" { target *-*-* } .-2 } */ } void f3 (struct s1 *a, struct s1 *b) { - for (int i = 0; i < N - 1; ++i) + for (int i = 0; i < N - 1; ++i) /* { dg-remark "couldn't vectorize loop" } */ a->a[i + 1] += b->a[i]; + /* { dg-message "possible dependence between data-refs" "" { target *-*-* } .-2 } */ } /* { dg-final { scan-tree-dump-not "LOOP VECTORIZED" "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-remarks-1.c b/gcc/testsuite/gcc.dg/vect/vect-remarks-1.c new file mode 100644 index 0000000..5006742 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-remarks-1.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-fremarks -O3" } */ + +extern void accumulate (int x, int *a); + +int test_1 (int arr[], int n) +{ + int sum = 0; + for (int i = 0; i < n; ++i) /* { dg-remark "couldn't vectorize loop" } */ + accumulate (arr[i], &sum); /* { dg-message "statement clobbers memory: 'accumulate .*'" } */ + return sum; +} + +void test_2 (int *dst, int *src_a, int *src_b, int n) +{ + for (int i = 0; i < n; i++) /* { dg-remark "loop vectorized" } */ + dst[i] = src_a[i] + src_b[i]; +}