From patchwork Wed Dec 2 17:29:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Sidwell X-Patchwork-Id: 551640 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 556FA140322 for ; Thu, 3 Dec 2015 04:29:45 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=opjTYaTR; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=OE7kOXrrj2wuK/GTSqkH4P03Xgf6AoMk/2FwAcAsyKo2u1p24f eAJSmoGKJlrSsO1U8RWYcYkn8Tvs0j0RAVdeklw0v9ISu0XRXv6nfsVGhQehXqsQ FMQlJr5Cx5Ju1eW7jDUM1hn6XXoO/vNNzGEuCUTuNzALBAlCl+fiVT6DU= 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:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=hjaErZeSjnCZlHDkY6yPj+yWqvs=; b=opjTYaTRnaR9661JrDW4 8vz+/ZXUWmsxOTnpzbSJmvcSJRHdkq1RoalyasFWpcuADSmZ+tgrcPsSr0LOmEoY LUBJ4hK1870jPPPRmDLC0fqqSMiLBrtdxlpmGVGBQXVLcMTK1ybY5tXverf6Crfo VR03U/dpTVRJYGXilG+IDP8= Received: (qmail 6677 invoked by alias); 2 Dec 2015 17:29: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 6665 invoked by uid 89); 2 Dec 2015 17:29:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-qk0-f171.google.com Received: from mail-qk0-f171.google.com (HELO mail-qk0-f171.google.com) (209.85.220.171) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 02 Dec 2015 17:29:31 +0000 Received: by qkda6 with SMTP id a6so19105693qkd.3 for ; Wed, 02 Dec 2015 09:29:29 -0800 (PST) X-Received: by 10.55.71.143 with SMTP id u137mr4403259qka.1.1449077368968; Wed, 02 Dec 2015 09:29:28 -0800 (PST) Received: from ?IPv6:2601:181:c000:c497:a2a8:cdff:fe3e:b48? ([2601:181:c000:c497:a2a8:cdff:fe3e:b48]) by smtp.googlemail.com with ESMTPSA id 2sm1591392qgi.42.2015.12.02.09.29.28 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 02 Dec 2015 09:29:28 -0800 (PST) To: GCC Patches From: Nathan Sidwell Subject: [PTX] #define cleanup Message-ID: <565F2A78.60700@acm.org> Date: Wed, 2 Dec 2015 12:29:28 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 I noticed an enum would be cleaner to define the shuffle kinds. nathan 2015-12-02 Nathan Sidwell * config/nvptx/nvptx.c (enum nvptx_shuffle_kind): New. Absorb SHUFFLE defines. (nvptx_gen_shuffle, nvptx_print_operand, nvptx_expand_shuffle): Adjust. Index: config/nvptx/nvptx.c =================================================================== --- config/nvptx/nvptx.c (revision 231191) +++ config/nvptx/nvptx.c (working copy) @@ -70,10 +70,15 @@ /* This file should be included last. */ #include "target-def.h" -#define SHUFFLE_UP 0 -#define SHUFFLE_DOWN 1 -#define SHUFFLE_BFLY 2 -#define SHUFFLE_IDX 3 +/* The kind of shuffe instruction. */ +enum nvptx_shuffle_kind +{ + SHUFFLE_UP, + SHUFFLE_DOWN, + SHUFFLE_BFLY, + SHUFFLE_IDX, + SHUFFLE_MAX +}; /* Record the function decls we've written, and the libfuncs and function decls corresponding to them. */ @@ -1221,7 +1226,7 @@ nvptx_gen_pack (rtx dst, rtx src0, rtx s across the vectors of a single warp. */ static rtx -nvptx_gen_shuffle (rtx dst, rtx src, rtx idx, unsigned kind) +nvptx_gen_shuffle (rtx dst, rtx src, rtx idx, nvptx_shuffle_kind kind) { rtx res; @@ -2019,10 +2024,11 @@ nvptx_print_operand (FILE *file, rtx x, case 'S': { - unsigned kind = UINTVAL (x); + nvptx_shuffle_kind kind = (nvptx_shuffle_kind) UINTVAL (x); + /* Same order as nvptx_shuffle_kind. */ static const char *const kinds[] = - {"up", "down", "bfly", "idx"}; - fprintf (file, ".%s", kinds[kind]); + {".up", ".down", ".bfly", ".idx"}; + fputs (kinds[kind], file); } break; @@ -3990,7 +3996,8 @@ nvptx_expand_shuffle (tree exp, rtx targ if (!REG_P (idx) && GET_CODE (idx) != CONST_INT) idx = copy_to_mode_reg (SImode, idx); - rtx pat = nvptx_gen_shuffle (target, src, idx, INTVAL (op)); + rtx pat = nvptx_gen_shuffle (target, src, idx, + (nvptx_shuffle_kind) INTVAL (op)); if (pat) emit_insn (pat);