public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel.crashing.org>
To: Hans-Peter Nilsson <hp@bitrange.com>
Cc: will schmidt <will_schmidt@vnet.ibm.com>,
	Raoni Fassina Firmino <raoni@linux.ibm.com>,
	gcc-patches@gcc.gnu.org, joseph@codesourcery.com
Subject: Re: [PATCH v2] builtins: rs6000: Add builtins for fegetround, feclearexcept and feraiseexcept [PR94193]
Date: Tue, 27 Oct 2020 14:25:45 -0500	[thread overview]
Message-ID: <20201027192545.GK2672@gate.crashing.org> (raw)
In-Reply-To: <alpine.BSF.2.20.16.2010042129050.94365@arjuna.pair.com>

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

  parent reply	other threads:[~2020-10-27 19:26 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-04 15:52 Raoni Fassina Firmino
2020-09-18 17:32 ` Raoni Fassina Firmino
2020-09-28 12:41   ` Raoni Fassina Firmino
2020-09-28 16:42 ` will schmidt
2020-10-05  1:56   ` Hans-Peter Nilsson
2020-10-05 15:36     ` Segher Boessenkool
2020-10-26 15:23       ` Raoni Fassina Firmino
2020-10-27 19:25     ` Segher Boessenkool [this message]
2020-10-26 16:05   ` Raoni Fassina Firmino
2020-10-26 16:54     ` Segher Boessenkool
2020-09-29 23:38 ` [PATCH v2] builtins: (not just) " Segher Boessenkool
2020-09-30  7:02   ` Richard Biener
2020-09-30 20:12     ` Segher Boessenkool
2020-10-01  6:08       ` Richard Biener
2020-10-01 20:08         ` Segher Boessenkool
2020-10-26 15:19           ` Raoni Fassina Firmino

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201027192545.GK2672@gate.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hp@bitrange.com \
    --cc=joseph@codesourcery.com \
    --cc=raoni@linux.ibm.com \
    --cc=will_schmidt@vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).