Re: [PATCH] Improved RTL expansion of field assignments into promoted registers.

2024-01-02 Thread Jeff Law
On 12/28/23 12:35, Roger Sayle wrote: Hi Jeff, Thanks for the speedy review. On 12/28/23 07:59, Roger Sayle wrote: This patch fixes PR rtl-optmization/104914 by tweaking/improving the way that fields are written into a pseudo register that needs to be kept sign extended. Well, I think

Re: [PATCH] Improved RTL expansion of field assignments into promoted registers.

2024-01-02 Thread Jeff Law
On 12/30/23 21:34, YunQiang Su wrote: Right. But that's the whole point behind avoiding the narrowing subreg and forcing use of a truncate operation. So basically the question becomes is there a way to modify those bits in a way that GCC doesn't know that it needs to to truncate/extend?

Re: [PATCH] Improved RTL expansion of field assignments into promoted registers.

2023-12-30 Thread YunQiang Su
> Right. But that's the whole point behind avoiding the narrowing subreg > and forcing use of a truncate operation. > > So basically the question becomes is there a way to modify those bits in > a way that GCC doesn't know that it needs to to truncate/extend? > I guess that this code may cause

Re: [PATCH] Improved RTL expansion of field assignments into promoted registers.

2023-12-29 Thread Jeff Law
On 12/28/23 19:07, YunQiang Su wrote: In general, I agree with this change. When gcc12 on RV64, more than one `sext.w` will be produced with our test. (Note, use -O1). There are two things that help here. The first is that the most significant bit never appears in the middle of a field,

Re: [PATCH] Improved RTL expansion of field assignments into promoted registers.

2023-12-28 Thread YunQiang Su
In general, I agree with this change. When gcc12 on RV64, more than one `sext.w` will be produced with our test. (Note, use -O1). > > There are two things that help here. The first is that the most significant > bit never appears in the middle of a field, so we don't have to worry about >

Re: [PATCH] Improved RTL expansion of field assignments into promoted registers.

2023-12-28 Thread YunQiang Su
Jeff Law 于2023年12月29日周五 02:23写道: > > > > On 12/28/23 07:59, Roger Sayle wrote: > > > > This patch fixes PR rtl-optmization/104914 by tweaking/improving the way > > that fields are written into a pseudo register that needs to be kept sign > > extended. > Well, I think "fixes" is a bit of a

RE: [PATCH] Improved RTL expansion of field assignments into promoted registers.

2023-12-28 Thread Roger Sayle
Hi Jeff, Thanks for the speedy review. > On 12/28/23 07:59, Roger Sayle wrote: > > This patch fixes PR rtl-optmization/104914 by tweaking/improving the > > way that fields are written into a pseudo register that needs to be > > kept sign extended. > Well, I think "fixes" is a bit of a stretch.

Re: [PATCH] Improved RTL expansion of field assignments into promoted registers.

2023-12-28 Thread Jeff Law
On 12/28/23 07:59, Roger Sayle wrote: This patch fixes PR rtl-optmization/104914 by tweaking/improving the way that fields are written into a pseudo register that needs to be kept sign extended. Well, I think "fixes" is a bit of a stretch. We're avoiding the issue by changing the early RTL

[PATCH] Improved RTL expansion of field assignments into promoted registers.

2023-12-28 Thread Roger Sayle
This patch fixes PR rtl-optmization/104914 by tweaking/improving the way that fields are written into a pseudo register that needs to be kept sign extended. The motivating example from the bugzilla PR is: extern void ext(int); void foo(const unsigned char *buf) { int val; ((unsigned