From patchwork Mon Sep 29 21:53:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Schmidt X-Patchwork-Id: 394647 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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 21F9A1400B5 for ; Tue, 30 Sep 2014 07:54:11 +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 :message-id:subject:from:to:cc:date:content-type:mime-version :content-transfer-encoding; q=dns; s=default; b=N+iP1UhMYVrwmqLQ BnZ78GQlsKvwC/U82ve190l/AkLI23x7s+qrENoJu9Nj5dVNQ8iUDt5oiyAv6KqP Fw1QV/72MGi2L1KoTsFmSS+2UkIPjz50uKEK9HZ+QAFn8J3I1x/41iQK16LUYp9N cNC0X95D10xCaaMFdq8e2vq5F0k= 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 :message-id:subject:from:to:cc:date:content-type:mime-version :content-transfer-encoding; s=default; bh=cYboIl2KJpKEtr/CZJIFYg YT2/k=; b=uakeaJF5R0rZ34lBZPAm5zhGhlkmeNVkjIifV0z4ltueC2PCj/ex1y axI+vohbqbjDEiS4bZIeUNiagpVInMYm6nviQZO+uqo2P1rtJhpmO6LOvnr0zZw2 m72k4uYEgR4ws/2SVh+Z9jZ8Z+pSJG4JStOYUdlhJNtR2155YzAc4= Received: (qmail 8760 invoked by alias); 29 Sep 2014 21:54:05 -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 8750 invoked by uid 89); 29 Sep 2014 21:54:04 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.9 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: e8.ny.us.ibm.com Received: from e8.ny.us.ibm.com (HELO e8.ny.us.ibm.com) (32.97.182.138) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Mon, 29 Sep 2014 21:54:02 +0000 Received: from /spool/local by e8.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 29 Sep 2014 17:54:01 -0400 Received: from d01dlp03.pok.ibm.com (9.56.250.168) by e8.ny.us.ibm.com (192.168.1.108) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 29 Sep 2014 17:53:59 -0400 Received: from b01cxnp23034.gho.pok.ibm.com (b01cxnp23034.gho.pok.ibm.com [9.57.198.29]) by d01dlp03.pok.ibm.com (Postfix) with ESMTP id 7B873C9002E for ; Mon, 29 Sep 2014 17:42:43 -0400 (EDT) Received: from d01av01.pok.ibm.com (d01av01.pok.ibm.com [9.56.224.215]) by b01cxnp23034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id s8TLrxDw2621862 for ; Mon, 29 Sep 2014 21:53:59 GMT Received: from d01av01.pok.ibm.com (localhost [127.0.0.1]) by d01av01.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s8TLrxrJ008331 for ; Mon, 29 Sep 2014 17:53:59 -0400 Received: from [9.80.9.80] ([9.80.9.80]) by d01av01.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id s8TLrwwZ008302; Mon, 29 Sep 2014 17:53:58 -0400 Message-ID: <1412027638.2986.30.camel@gnopaine> Subject: [PATCH, rs6000] Warn for deprecated use of vec_lvsl and vec_lvsr for little endian From: Bill Schmidt To: gcc-patches@gcc.gnu.org Cc: dje.gcc@gmail.com Date: Mon, 29 Sep 2014 16:53:58 -0500 Mime-Version: 1.0 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14092921-0320-0000-0000-0000009E07D1 X-IsSubscribed: yes Hi, The vec_lvsl and vec_lvsr interfaces are deprecated for little endian in the ELFv2 ABI document. At the moment, these interfaces will produce incorrect code, and the only indication a programmer has of this is that his or her code does not function correctly. This patch adds a warning message to inform the little endian programmer of the deprecated usage. The patch described in https://gcc.gnu.org/ml/gcc-patches/2014-09/msg02580.html is a prerequisite for this patch, as otherwise the deprecation message causes bootstrap failure due to -Werror in the later stages. I feel the deprecation message is needed because, in a future patch, we plan to make vec_lvsl and vec_lvsr work so that BE code will run on LE without requiring code modifications. However, code modifications are still desirable because the LE code, while correct, will be pretty poor. The deprecation message will encourage programmers to rewrite their code that makes use of vec_lvsl/lvsr. I've added a new test to demonstrate the message, and updated a number of tests to use -Wno-deprecated so the new message doesn't disturb them. Bootstrapped and tested on powerpc64le-unknown-linux-gnu with no regressions. Is this ok for trunk? Thanks, Bill [gcc] 2014-09-29 Bill Schmidt * config/rs6000/rs6000-c.c (altivec_resolve_overloaded_builtin): Issue a warning message when vec_lvsl or vec_lvsr is used with a little endian target. [gcc/testsuite] 2014-09-29 Bill Schmidt * g++.dg/ext/altivec-2.C: Compile with -Wno-deprecated to avoid failing with the new warning message. * gcc.dg/vmx/3c-01a.c: Likewise. * gcc.dg/vmx/ops-long-1.c: Likewise. * gcc.dg/vmx/ops.c: Likewise. * gcc.target/powerpc/altivec-20.c: Likewise. * gcc.target/powerpc/altivec-6.c: Likewise. * gcc.target/powerpc/altivec-vec-merge.c: Likewise. * gcc.target/powerpc/vsx-builtin-8.c: Likewise. * gcc.target/powerpc/warn-lvsl-lvsr.c: New test. Index: gcc/config/rs6000/rs6000-c.c =================================================================== --- gcc/config/rs6000/rs6000-c.c (revision 215691) +++ gcc/config/rs6000/rs6000-c.c (working copy) @@ -4326,6 +4326,14 @@ altivec_resolve_overloaded_builtin (location_t loc if (TARGET_DEBUG_BUILTIN) fprintf (stderr, "altivec_resolve_overloaded_builtin, code = %4d, %s\n", (int)fcode, IDENTIFIER_POINTER (DECL_NAME (fndecl))); + + /* vec_lvsl and vec_lvsr are deprecated for use with LE element order. */ + if (fcode == ALTIVEC_BUILTIN_VEC_LVSL && !VECTOR_ELT_ORDER_BIG) + warning (OPT_Wdeprecated, "vec_lvsl is deprecated for little endian; use \ +assignment for unaligned loads and stores"); + else if (fcode == ALTIVEC_BUILTIN_VEC_LVSR && !VECTOR_ELT_ORDER_BIG) + warning (OPT_Wdeprecated, "vec_lvsr is deprecated for little endian; use \ +assignment for unaligned loads and stores"); /* For now treat vec_splats and vec_promote as the same. */ if (fcode == ALTIVEC_BUILTIN_VEC_SPLATS Index: gcc/testsuite/g++.dg/ext/altivec-2.C =================================================================== --- gcc/testsuite/g++.dg/ext/altivec-2.C (revision 215691) +++ gcc/testsuite/g++.dg/ext/altivec-2.C (working copy) @@ -1,6 +1,6 @@ /* { dg-do compile { target powerpc*-*-* } } */ /* { dg-require-effective-target powerpc_altivec_ok } */ -/* { dg-options "-maltivec -Wall -Wno-unused-but-set-variable" } */ +/* { dg-options "-maltivec -Wall -Wno-unused-but-set-variable -Wno-deprecated" } */ /* This test checks if AltiVec builtins accept const-qualified arguments. */ Index: gcc/testsuite/gcc.dg/vmx/3c-01a.c =================================================================== --- gcc/testsuite/gcc.dg/vmx/3c-01a.c (revision 215691) +++ gcc/testsuite/gcc.dg/vmx/3c-01a.c (working copy) @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-options "-Wno-deprecated" } */ #include typedef const volatile unsigned int _1; typedef const unsigned int _2; Index: gcc/testsuite/gcc.dg/vmx/ops-long-1.c =================================================================== --- gcc/testsuite/gcc.dg/vmx/ops-long-1.c (revision 215691) +++ gcc/testsuite/gcc.dg/vmx/ops-long-1.c (working copy) @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-options "-Wno-deprecated" } */ /* Checks from the original ops.c that pass pointers to long or unsigned long for operations that support that in released versions Index: gcc/testsuite/gcc.dg/vmx/ops.c =================================================================== --- gcc/testsuite/gcc.dg/vmx/ops.c (revision 215691) +++ gcc/testsuite/gcc.dg/vmx/ops.c (working copy) @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-options "-Wno-deprecated" } */ #include #include extern char * *var_char_ptr; Index: gcc/testsuite/gcc.target/powerpc/altivec-20.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/altivec-20.c (revision 215691) +++ gcc/testsuite/gcc.target/powerpc/altivec-20.c (working copy) @@ -1,5 +1,5 @@ /* { dg-do compile { target powerpc_altivec_ok } } */ -/* { dg-options "-maltivec -mcpu=G5 -O2" } */ +/* { dg-options "-maltivec -mcpu=G5 -O2 -Wno-deprecated" } */ #include Index: gcc/testsuite/gcc.target/powerpc/altivec-6.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/altivec-6.c (revision 215691) +++ gcc/testsuite/gcc.target/powerpc/altivec-6.c (working copy) @@ -1,6 +1,6 @@ /* { dg-do compile { target powerpc*-*-* } } */ /* { dg-require-effective-target powerpc_altivec_ok } */ -/* { dg-options "-maltivec -O0 -Wall" } */ +/* { dg-options "-maltivec -O0 -Wall -Wno-deprecated" } */ #include Index: gcc/testsuite/gcc.target/powerpc/altivec-vec-merge.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/altivec-vec-merge.c (revision 215691) +++ gcc/testsuite/gcc.target/powerpc/altivec-vec-merge.c (working copy) @@ -1,7 +1,7 @@ /* { dg-do run { target { powerpc*-*-* && vmx_hw } } } */ /* { dg-do compile { target { powerpc*-*-* && { ! vmx_hw } } } } */ /* { dg-require-effective-target powerpc_altivec_ok } */ -/* { dg-options "-maltivec -O2" } */ +/* { dg-options "-maltivec -O2 -Wno-deprecated" } */ #include Index: gcc/testsuite/gcc.target/powerpc/vsx-builtin-8.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/vsx-builtin-8.c (revision 215691) +++ gcc/testsuite/gcc.target/powerpc/vsx-builtin-8.c (working copy) @@ -1,7 +1,7 @@ /* { dg-do compile { target { powerpc*-*-* } } } */ /* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ /* { dg-require-effective-target powerpc_vsx_ok } */ -/* { dg-options "-O3 -mcpu=power7" } */ +/* { dg-options "-O3 -mcpu=power7 -Wno-deprecated" } */ /* Test the various load/store varients. */ Index: gcc/testsuite/gcc.target/powerpc/warn-lvsl-lvsr.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/warn-lvsl-lvsr.c (revision 0) +++ gcc/testsuite/gcc.target/powerpc/warn-lvsl-lvsr.c (working copy) @@ -0,0 +1,14 @@ +/* Test for deprecation messages on use of lvsl and lvsr for little endian. */ + +/* { dg-do compile { target { powerpc64le-*-* } } } */ +/* { dg-options "-O0 -Wdeprecated" } */ + +#include + +float f[20]; + +void foo () +{ + vector unsigned char a = vec_lvsl (4, f); /* { dg-error "vec_lvsl is deprecated for little endian; use assignment for unaligned loads and stores" } */ + vector unsigned char b = vec_lvsr (8, f); /* { dg-error "vec_lvsr is deprecated for little endian; use assignment for unaligned loads and stores" } */ +}