Re: branch prediction not correctly applied to an if statement in an inline with multiple conditoins

2024-11-30 Thread Richard Biener via Gcc
> Am 30.11.2024 um 08:19 schrieb Mateusz Guzik via Gcc : > > Tested with gcc 14.2 and the Linux kernel compiling for amd64. This is > at Linux next-20241127. This was already the case on gcc 13 (no idea > about earlier versions), I tested 14 to see if the problem is gone. > > In the particula

branch prediction not correctly applied to an if statement in an inline with multiple conditoins

2024-11-29 Thread Mateusz Guzik via Gcc
Tested with gcc 14.2 and the Linux kernel compiling for amd64. This is at Linux next-20241127. This was already the case on gcc 13 (no idea about earlier versions), I tested 14 to see if the problem is gone. In the particular case I ran into a prediction concerning the return value of __access_ok

Re: Use branch prediction from .gcda files

2024-11-21 Thread Richard Biener via Gcc
On Thu, Nov 21, 2024 at 1:32 PM Kamil Belter wrote: > > On Tue, Nov 19, 2024 at 12:58 PM Richard Biener > wrote: > > > > On Tue, Nov 19, 2024 at 11:56 AM Kamil Belter via Gcc > > wrote: > > > > > > Hello, > > > > > > I wou

Re: Use branch prediction from .gcda files

2024-11-21 Thread Kamil Belter via Gcc
On Tue, Nov 19, 2024 at 12:58 PM Richard Biener wrote: > > On Tue, Nov 19, 2024 at 11:56 AM Kamil Belter via Gcc wrote: > > > > Hello, > > > > I would like to set branch prediction based on .gcda files (I know I > > could have it automatically with -fprofi

Re: Use branch prediction from .gcda files

2024-11-20 Thread Richard Biener via Gcc
On Tue, Nov 19, 2024 at 11:56 AM Kamil Belter via Gcc wrote: > > Hello, > > I would like to set branch prediction based on .gcda files (I know I > could have it automatically with -fprofile-use, but with my specific > use case I can't do it). > > I've tried to

Use branch prediction from .gcda files

2024-11-19 Thread Kamil Belter via Gcc
Hello, I would like to set branch prediction based on .gcda files (I know I could have it automatically with -fprofile-use, but with my specific use case I can't do it). I've tried to use gcov-dump but I can't find any spec how to interpret this output. I've also tried to us

Re: Why did Intel change his static branch prediction mechanism over these years?

2018-08-15 Thread Florian Weimer
have strong factual basis saying such words, I can quite accept the CPU manufacturer's ignoring branch prediction hints for some reasons, but not this, We just removed a __builtin_except from the dynamic linker that indicated the wrong way for more than a decade, maybe even two decades

Re: Why did Intel change his static branch prediction mechanism over these years?

2018-08-15 Thread 2016 quekong
ld you explain a little more for this sentence, or give me some keywords for google ? >>> programmers tend to misuse __builtin_expect .. I believe you must have strong factual basis saying such words, I can quite accept the CPU manufacturer's ignoring branch prediction hints

Re: Why did Intel change his static branch prediction mechanism over these years?

2018-08-15 Thread Florian Weimer
On 08/14/2018 03:36 PM, 2016 quekong wrote: And Intel seems don't want to talk about it any more, because the latest material I found within Intel Document was written about ten years ago. Since branch prediction is nowadays a security feature, I doubt you will see detailed p

Why did Intel change his static branch prediction mechanism over these years?

2018-08-14 Thread 2016 quekong
( I don't know if it's allowed to ask such question, if not, please remind me. ) I know Intel implemented several static branch prediction mechanisms these years: * 80486 age: Always-not-take * Pentium4 age: Backwards Taken/Forwards Not-Taken * PM, Core2: Didn't use st

Re: Branch prediction

2013-05-30 Thread Andrew Haley
On 05/30/2013 03:03 PM, Raphael Clifford wrote: > Thank you for this. My question was about something more specific > however. I am interested specifically in branch prediction. For > example one could add __builtin_expect or the compiler can use the > information it finds in its pro

Re: Branch prediction

2013-05-30 Thread Raphael Clifford
Thank you for this. My question was about something more specific however. I am interested specifically in branch prediction. For example one could add __builtin_expect or the compiler can use the information it finds in its profiling. How is this information used by gcc to provide optimised

Re: Branch prediction

2013-05-30 Thread Jan Hubicka
> Is there any documentation for what gcc does with branch prediction > information it gets from profiling? I am interested in this for > modern Pentium processors where you can no longer give hints. The profile feedback drives optimizations (i.e. decision what to optimize for speed and

Branch prediction

2013-05-30 Thread Raphael Clifford
Is there any documentation for what gcc does with branch prediction information it gets from profiling? I am interested in this for modern Pentium processors where you can no longer give hints. Specifically I am interested in whether there are in fact any optimisations that work reliably from