Re: types in GIMPLE IR

2023-06-29 Thread Andrew Pinski via Gcc
On Thu, Jun 29, 2023 at 12:10 PM Krister Walfridsson via Gcc wrote: > > On Thu, 29 Jun 2023, Richard Biener wrote: > > > IIRC we have some simplification rules that turn bit operations into > > arithmetics. Arithmetic is allowed if it keeps the values inside > > [-1,0] for signed bools or [0, 1]

Re: types in GIMPLE IR

2023-06-29 Thread Krister Walfridsson via Gcc
On Thu, 29 Jun 2023, Richard Biener wrote: IIRC we have some simplification rules that turn bit operations into arithmetics. Arithmetic is allowed if it keeps the values inside [-1,0] for signed bools or [0, 1] for unsigned bools. I have now verified that all cases seems to be just one

Re: types in GIMPLE IR

2023-06-29 Thread Richard Biener via Gcc
On Thu, Jun 29, 2023 at 2:06 PM Krister Walfridsson wrote: > > On Thu, 29 Jun 2023, Richard Biener wrote: > > > The thing with signed bools is that the two relevant values are -1 (true) > > and 0 (false), those are used for vector bool components where we also > > need them to be of wider type

Re: types in GIMPLE IR

2023-06-29 Thread Michael Matz via Gcc
Hello, On Thu, 29 Jun 2023, Krister Walfridsson wrote: > > The thing with signed bools is that the two relevant values are -1 (true) > > and 0 (false), those are used for vector bool components where we also > > need them to be of wider type (32bits in this case). > > My main confusion comes

Re: types in GIMPLE IR

2023-06-29 Thread Krister Walfridsson via Gcc
On Thu, 29 Jun 2023, Richard Biener wrote: The thing with signed bools is that the two relevant values are -1 (true) and 0 (false), those are used for vector bool components where we also need them to be of wider type (32bits in this case). My main confusion comes from seeing IR doing

Re: types in GIMPLE IR

2023-06-29 Thread Richard Biener via Gcc
On Wed, Jun 28, 2023 at 5:47 PM Michael Matz via Gcc wrote: > > Hello, > > On Wed, 28 Jun 2023, Krister Walfridsson via Gcc wrote: > > > Type safety > > --- > > Some transformations treat 1-bit types as a synonym of _Bool and mix the > > types > > in expressions, such as: > > > >_2;

Re: types in GIMPLE IR

2023-06-28 Thread Michael Matz via Gcc
Hello, On Wed, 28 Jun 2023, Krister Walfridsson via Gcc wrote: > Type safety > --- > Some transformations treat 1-bit types as a synonym of _Bool and mix the types > in expressions, such as: > >_2; > _Bool _3; > _Bool _4; > ... > _4 = _2 ^ _3; > > and similarly mixing _Bool

types in GIMPLE IR

2023-06-28 Thread Krister Walfridsson via Gcc
I have some random questions concerning types in the GIMPLE IR that I would appreciate some clarification on. Type safety --- Some transformations treat 1-bit types as a synonym of _Bool and mix the types in expressions, such as: _2; _Bool _3; _Bool _4; ... _4 = _2 ^ _3