[FFmpeg-devel] [PATCH] x86: replace explicit REP_RETs with RETs

Lynne dev at lynne.ee
Wed Feb 1 03:37:49 EET 2023

>From x86inc:
> On AMD cpus <=K10, an ordinary ret is slow if it immediately follows either
> a branch or a branch target. So switch to a 2-byte form of ret in that case.
> We can automatically detect "follows a branch", but not a branch target.
> (SSSE3 is a sufficient condition to know that your cpu doesn't have this problem.)

x86inc can automatically determine whether to use REP_RET rather than
REP in most of these cases, so impact is minimal. Additionally, a few
REP_RETs were used unnecessary, despite the return being nowhere near a

The only CPUs affected were AMD K10s, made between 2007 and 2011, 16
years ago and 12 years ago, respectively.

In the future, everyone involved with x86inc should consider dropping
REP_RETs altogether.

Patch attached.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-x86-replace-explicit-REP_RETs-with-RETs.patch
Type: text/x-diff
Size: 62684 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20230201/6bf6001a/attachment.patch>

More information about the ffmpeg-devel mailing list