From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25146 invoked by alias); 13 May 2016 21:29:43 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 25132 invoked by uid 89); 13 May 2016 21:29:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.8 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: gate.crashing.org Received: from gate.crashing.org (HELO gate.crashing.org) (63.228.1.57) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Fri, 13 May 2016 21:29:32 +0000 Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.13.8) with ESMTP id u4DLTSvA001625; Fri, 13 May 2016 16:29:28 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id u4DLTRDi001624; Fri, 13 May 2016 16:29:27 -0500 Date: Fri, 13 May 2016 21:29:00 -0000 From: Segher Boessenkool To: Kelvin Nilsen Cc: gcc-patches@gcc.gnu.org, Segher Boessenkool Subject: Re: [PATCH v3, rs6000] Add built-in support for new Power9 darn (deliver a random number) instruction Message-ID: <20160513212927.GA32708@gate.crashing.org> References: <5733ACBA.5020408@linux.vnet.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5733ACBA.5020408@linux.vnet.ibm.com> User-Agent: Mutt/1.4.2.3i X-IsSubscribed: yes X-SW-Source: 2016-05/txt/msg01053.txt.bz2 On Wed, May 11, 2016 at 04:05:46PM -0600, Kelvin Nilsen wrote: > I have bootstrapped and tested this patch against the trunk and against > the gcc-6-branch on both powerpc64le-unknown-linux-gnu and > powerpc64-unknown-linux-gnu with no regressions. Is this ok for trunk > and for backporting to GCC 6 after a few days of burn-in time on the > trunk? > 2016-05-11 Kelvin Nilsen > > * gcc.target/powerpc/darn-0.c: New test. > * gcc.target/powerpc/darn-1.c: New test. > * gcc.target/powerpc/darn-2.c: New test. > 2016-05-11 Kelvin Nilsen > > * config/rs6000/altivec.md (UNSPEC_DARN): New unspec constant. > (UNSPEC_DARN_32): New unspec constant. > (UNSPEC_DARN_RAW): New unspec constant. > (darn_32): New instruction. > (darn_raw): New instruction. > (darn): New instruction. > * config/rs6000/rs6000-builtin.def (RS6000_BUILTIN_0): Add > support and documentation for this macro. > (BU_P9_MISC_1): New macro definition. > (BU_P9_64BIT_MISC_0): New macro definition. > (BU_P9_MISC_0): New macro definition. > (darn_32): New builtin definition. > (darn_raw): New builtin definition. > (darn): New builtin definition. > * config/rs6000/rs6000.c: Add #define RS6000_BUILTIN_0 and #undef > RS6000_BUILTIN_0 directives to surround each occurrence of > #include "rs6000-builtin.def". > (rs6000_builtin_mask_calculate): Add in the RS6000_BTM_MODULO and > RS6000_BTM_64BIT flags to the returned mask, depending on > configuration. > (def_builtin): Correct an error in the assignments made to the > debugging variable attr_string. > (rs6000_expand_builtin): Add support for no-operand built-in > functions. > (builtin_function_type): Remove fatal_error assertion that is no > longer valid. > (rs6000_common_init_builtins): Add support for no-operand built-in > functions. > * config/rs6000/rs6000.h (RS6000_BTM_MODULO): New macro > definition. > (RS6000_BTM_PURE): Enhance comment to clarify intent of this flag > definition. > (RS6000_BTM_64BIT): New macro definition. > * doc/extend.texi: Document __builtin_darn (void), > __builtin_darn_raw (void), and __builtin_darn_32 (void) built-in > functions. > +(define_insn "darn_32" > + [(set (match_operand:SI 0 "register_operand" "=r") > + (unspec:SI [(const_int 0)] UNSPEC_DARN_32))] > + "TARGET_MODULO" > + { > + return "darn %0,0"; > + } > + [(set_attr "type" "integer")]) Don't indent the {}; but in simple cases like this, you don't need a C block, just the string: +(define_insn "darn_32" + [(set (match_operand:SI 0 "register_operand" "=r") + (unspec:SI [(const_int 0)] UNSPEC_DARN_32))] + "TARGET_MODULO" + "darn %0,0" + [(set_attr "type" "integer")]) > + if (rs6000_overloaded_builtin_p (d->code)) > + { > + if (! (type = opaque_ftype_opaque)) > + { > + opaque_ftype_opaque > + = build_function_type_list (opaque_V4SI_type_node, NULL_TREE); > + type = opaque_ftype_opaque; > + } No space after !; no space at end of line. It's easier to read if you put the assignment as a separate statement before the if. Or write is as + if (!opaque_ftype_opaque) + opaque_ftype_opaque + = build_function_type_list (opaque_V4SI_type_node, NULL_TREE); + type = opaque_ftype_opaque; Okay with those changes, thanks! Segher