Re: [PATCH] c: Add __builtin_stdc_bit_{width,floor,ceil} builtins

2023-11-23 Thread Jakub Jelinek
On Thu, Nov 23, 2023 at 12:09:05AM +, Joseph Myers wrote: > OK with tests added for unsigned _BitInt(1). Specifically, unsigned > _BitInt(1) is a bit of a degenerate case for stdc_bit_ceil (always > returning 1 after evaluating the argument's side effects); I think the > code that builds of

Re: [PATCH] c: Add __builtin_stdc_bit_{width,floor,ceil} builtins

2023-11-22 Thread Joseph Myers
On Mon, 20 Nov 2023, Jakub Jelinek wrote: > On Mon, Nov 20, 2023 at 04:03:07PM +0100, Jakub Jelinek wrote: > > > Note that stdc_bit_ceil now has defined behavior (return 0) on overflow: > > > CD2 comment FR-135 was accepted for the DIS at the June WG14 meeting. > > > This affects both the docum

Re: [PATCH] c: Add __builtin_stdc_bit_{width,floor,ceil} builtins

2023-11-21 Thread Joseph Myers
On Mon, 20 Nov 2023, Jakub Jelinek wrote: > > Note that stdc_bit_ceil now has defined behavior (return 0) on overflow: > > CD2 comment FR-135 was accepted for the DIS at the June WG14 meeting. > > This affects both the documentation and the implementation, as they need > > to avoid an undefine

Re: [PATCH] c: Add __builtin_stdc_bit_{width,floor,ceil} builtins

2023-11-21 Thread Jakub Jelinek
On Mon, Nov 20, 2023 at 04:29:47PM +0100, Jakub Jelinek wrote: > On Mon, Nov 20, 2023 at 04:03:07PM +0100, Jakub Jelinek wrote: > > > Note that stdc_bit_ceil now has defined behavior (return 0) on overflow: > > > CD2 comment FR-135 was accepted for the DIS at the June WG14 meeting. > > > This af

Re: [PATCH] c: Add __builtin_stdc_bit_{width,floor,ceil} builtins

2023-11-21 Thread Jakub Jelinek
On Mon, Nov 20, 2023 at 04:03:07PM +0100, Jakub Jelinek wrote: > > Note that stdc_bit_ceil now has defined behavior (return 0) on overflow: > > CD2 comment FR-135 was accepted for the DIS at the June WG14 meeting. > > This affects both the documentation and the implementation, as they need > >

Re: [PATCH] c: Add __builtin_stdc_bit_{width,floor,ceil} builtins

2023-11-21 Thread Jakub Jelinek
On Mon, Nov 20, 2023 at 02:55:33PM +, Joseph Myers wrote: > On Sat, 18 Nov 2023, Jakub Jelinek wrote: > > > +@defbuiltin{@var{type} __builtin_stdc_bit_ceil (@var{type} @var{arg})} > > +The @code{__builtin_stdc_bit_ceil} function is available only > > +in C. It is type-generic, the argument ca

Re: [PATCH] c: Add __builtin_stdc_bit_{width,floor,ceil} builtins

2023-11-21 Thread Jakub Jelinek
On Mon, Nov 20, 2023 at 02:55:33PM +, Joseph Myers wrote: > On Sat, 18 Nov 2023, Jakub Jelinek wrote: > > > +@defbuiltin{@var{type} __builtin_stdc_bit_ceil (@var{type} @var{arg})} > > +The @code{__builtin_stdc_bit_ceil} function is available only > > +in C. It is type-generic, the argument ca

Re: [PATCH] c: Add __builtin_stdc_bit_{width,floor,ceil} builtins

2023-11-20 Thread Joseph Myers
On Sat, 18 Nov 2023, Jakub Jelinek wrote: > +@defbuiltin{@var{type} __builtin_stdc_bit_ceil (@var{type} @var{arg})} > +The @code{__builtin_stdc_bit_ceil} function is available only > +in C. It is type-generic, the argument can be any unsigned integer > +(standard, extended or bit-precise). No in

[PATCH] c: Add __builtin_stdc_bit_{width,floor,ceil} builtins

2023-11-18 Thread Jakub Jelinek
Hi! For these 3 type-generic macros I'm out of ideas how to satisfy all the requirements (no use of ({ ... }), not expanding argument multiple times, not evaluating side-effects multiple times using some small building blocks, so the following patch introduces 3 new C only builtins which can be us