From patchwork Wed Oct 6 09:25:29 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olivier Hainque X-Patchwork-Id: 66900 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 61D89B70AA for ; Wed, 6 Oct 2010 20:25:41 +1100 (EST) Received: (qmail 2697 invoked by alias); 6 Oct 2010 09:25:39 -0000 Received: (qmail 2668 invoked by uid 22791); 6 Oct 2010 09:25:36 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL, BAYES_00, SARE_BAYES_5x7, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (212.99.106.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 06 Oct 2010 09:25:31 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 500C3CB0238; Wed, 6 Oct 2010 11:25:29 +0200 (CEST) Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id tsEsU5Tkwtw9; Wed, 6 Oct 2010 11:25:29 +0200 (CEST) Received: from cardhu.act-europe.fr (cardhu.act-europe.fr [10.10.0.168]) by mel.act-europe.fr (Postfix) with ESMTP id 33774CB01D6; Wed, 6 Oct 2010 11:25:29 +0200 (CEST) Received: by cardhu.act-europe.fr (Postfix, from userid 546) id 2C3511D9; Wed, 6 Oct 2010 11:25:29 +0200 (CEST) Date: Wed, 6 Oct 2010 11:25:29 +0200 From: Olivier Hainque To: gcc-patches@gcc.gnu.org Cc: hainque@adacore.com Subject: fix bootstrap on !altivec powerpc configurations Message-ID: <20101006092529.GA28471@cardhu.act-europe.fr> Mime-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.4.1i 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 Hello, Since a series of changes introduced from http://gcc.gnu.org/ml/gcc-patches/2009-07/txt00039.txt bootstrap is broken for powerpc targets missing altivec support. We noticed trying to build for aix 5.2. The failure comes from errors compiling rs6000_expand_ternop_builtin: if (icode == CODE_FOR_nothing) /* Builtin not supported on this processor. */ return 0; ... switch (icode) { case CODE_FOR_altivec_vsldoi_v4sf: case CODE_FOR_altivec_vsldoi_v4si: case CODE_FOR_altivec_vsldoi_v8hi: ... where the switch statement has multiple "CODE_FOR_nothing" alternatives. The attached patch fixes this by rewriting the switch as a sequence of 'if's. This fixed our build on aix 5.2, and was bootstrapped + reg tested on aix 5.3. OK ? Thanks in avdance, 2010-10-06 Olivier Hainque * config/rs6000/rs6000.c (rs6000_expand_ternop_builtin): Rewrite switch on insn codes as sequence of ifs. --- config/rs6000/rs6000.c (revision 163943) +++ config/rs6000/rs6000.c (working copy) @@ -10830,12 +10830,18 @@ rs6000_expand_ternop_builtin || arg2 == error_mark_node) return const0_rtx; - switch (icode) + /* Check and prepare argument depending on the instruction code. + + Note that a switch statement instead of the sequence of tests + would be incorrect as many of the CODE_FOR values could be + CODE_FOR_nothing and that would yield multiple alternatives + with identical values. We'd never reach here at runtime in + this case. */ + if (icode == CODE_FOR_altivec_vsldoi_v4sf + || icode == CODE_FOR_altivec_vsldoi_v4si + || icode == CODE_FOR_altivec_vsldoi_v8hi + || icode == CODE_FOR_altivec_vsldoi_v16qi) { - case CODE_FOR_altivec_vsldoi_v4sf: - case CODE_FOR_altivec_vsldoi_v4si: - case CODE_FOR_altivec_vsldoi_v8hi: - case CODE_FOR_altivec_vsldoi_v16qi: /* Only allow 4-bit unsigned literals. */ STRIP_NOPS (arg2); if (TREE_CODE (arg2) != INTEGER_CST @@ -10844,16 +10850,16 @@ error ("argument 3 must be a 4-bit unsigned literal"); return const0_rtx; } - break; - - case CODE_FOR_vsx_xxpermdi_v2df: - case CODE_FOR_vsx_xxpermdi_v2di: - case CODE_FOR_vsx_xxsldwi_v16qi: - case CODE_FOR_vsx_xxsldwi_v8hi: - case CODE_FOR_vsx_xxsldwi_v4si: - case CODE_FOR_vsx_xxsldwi_v4sf: - case CODE_FOR_vsx_xxsldwi_v2di: - case CODE_FOR_vsx_xxsldwi_v2df: + } + else if (icode == CODE_FOR_vsx_xxpermdi_v2df + || icode == CODE_FOR_vsx_xxpermdi_v2di + || icode == CODE_FOR_vsx_xxsldwi_v16qi + || icode == CODE_FOR_vsx_xxsldwi_v8hi + || icode == CODE_FOR_vsx_xxsldwi_v4si + || icode == CODE_FOR_vsx_xxsldwi_v4sf + || icode == CODE_FOR_vsx_xxsldwi_v2di + || icode == CODE_FOR_vsx_xxsldwi_v2df) + { /* Only allow 2-bit unsigned literals. */ STRIP_NOPS (arg2); if (TREE_CODE (arg2) != INTEGER_CST @@ -10862,10 +10868,10 @@ error ("argument 3 must be a 2-bit unsigned literal"); return const0_rtx; } - break; - - case CODE_FOR_vsx_set_v2df: - case CODE_FOR_vsx_set_v2di: + } + else if (icode == CODE_FOR_vsx_set_v2df + || icode == CODE_FOR_vsx_set_v2di) + { /* Only allow 1-bit unsigned literals. */ STRIP_NOPS (arg2); if (TREE_CODE (arg2) != INTEGER_CST @@ -10874,10 +10880,6 @@ error ("argument 3 must be a 1-bit unsigned literal"); return const0_rtx; } - break; - - default: - break; } if (target == 0