From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) by sourceware.org (Postfix) with ESMTP id 7E9633951809 for ; Tue, 27 Oct 2020 19:26:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 7E9633951809 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=segher@kernel.crashing.org Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 09RJPlSC009317; Tue, 27 Oct 2020 14:25:47 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 09RJPjmk009316; Tue, 27 Oct 2020 14:25:45 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Tue, 27 Oct 2020 14:25:45 -0500 From: Segher Boessenkool To: Hans-Peter Nilsson Cc: will schmidt , Raoni Fassina Firmino , gcc-patches@gcc.gnu.org, joseph@codesourcery.com Subject: Re: [PATCH v2] builtins: rs6000: Add builtins for fegetround, feclearexcept and feraiseexcept [PR94193] Message-ID: <20201027192545.GK2672@gate.crashing.org> References: <20200904155230.nyssphhldu47hbve@work-tp> <7f35c652dda1a1dd99a4db64d6d15987ce160169.camel@vnet.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, TXREP, T_SPF_HELO_PERMERROR, T_SPF_PERMERROR autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Oct 2020 19:26:55 -0000 Hi! On Sun, Oct 04, 2020 at 09:56:01PM -0400, Hans-Peter Nilsson wrote: > Please excuse a comment from the gallery: :-) Thanks! > > > + rtx tmp = gen_rtx_CONST_INT (SImode, __builtin_clz (INTVAL (operands[1]))); > > This doesn't appear to be very portable, to any-cxx11-compiler > that doesn't pretend to be gcc-intrinsics-compatible. Yup, thanks for spotting this :-) > PS. No less than four targets fail like that. Meh. $ grep -r __builtin_clz config/ config/tilepro/gen-mul-tables.cc: int prev_pow2 = 1 << (31 - __builtin_clz (abs_multiplier)); config/tilepro/gen-mul-tables.cc: 1LL << (63 - __builtin_clzll (abs_multiplier)); This is a generator program that is not run on normal builds, so arguably not a bug. config/nds32/nds32-md-auxiliary.c: clear_sign_bit_copies = __builtin_clz (remainder); config/arc/arc.c: if ((GMASK_LEN - __builtin_clzll (gmask)) == (i + 1) config/arc/arc.c: if ((GMASK_LEN - __builtin_clzll (gmask)) == i Those seem bugs yes. config/rs6000/bmi2intrin.h: c = __builtin_clzl (m); config/rs6000/bmi2intrin.h: c = __builtin_clzl (m); config/rs6000/bmi2intrin.h: c = __builtin_clzl (m); config/rs6000/ppu_intrinsics.h:#define __cntlzw(v) __builtin_clz(v) config/rs6000/ppu_intrinsics.h:#define __cntlzd(v) __builtin_clzll(v) These are installed headers, only used with the built GCC. No bug. config/i386/i386-builtin.def:BDESC (OPTION_MASK_ISA_LZCNT, 0, CODE_FOR_lzcnt_hi, "__builtin_clzs", IX86_BUILTIN_CLZS, UNKNOWN, (int) UINT16_FTYPE_UINT16) A different thing altogether, my grep was a bit wide :-) But not a bug anyway. config/aarch64/aarch64.c: return val == mask * bitmask_imm_mul[__builtin_clz (bits) - 26]; This seems bad as well, yes. Thanks, Segher