Le lauantaina 8. kesäkuuta 2024, 9.23.48 EEST Andreas Rheinhardt a écrit : > Rémi Denis-Courmont: > > Le lauantaina 8. kesäkuuta 2024, 0.26.21 EEST Andreas Rheinhardt a écrit : > >> (Also: IIRC Clang actually parses inline assembler and optimize it; > > > > That sounds sketchy. While FFmpeg only uses inline assembler as intrinsic > > ersatz, other projects can and definitely do use them for weirder stuff. > > That will fail miserably if the compiler modifies the sequence. > > See https://godbolt.org/z/ozeGoWzK7: Clang is smart enough to know that > the x86-inline asm version of av_bswap32 is self-inverse. (It can also > evaluate it for constants at compile-time.)
It seems that they have some heuristics not to touch assembler that they are not sure that they "completely" understand. If you add just a dummy numeric label, the optimisation is not done. My preference would be to use builtin_bswap (as riscv/ does) on all architectures on GCC and Clang, and keep the bespoke C for other compilers and external header inclusion. -- 雷米‧德尼-库尔蒙 http://www.remlab.net/ _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".