Landing: c0fd049ae753

Project / Subsystem

gcc / i386

Date

2026-05-18

Author

Jakub Jelinek

Commit

c0fd049ae75349dc273de868fd3b3e8935115418

Source

github

Perf win

Yes

Breaking

No

All attributes

project
gcc
subsystem
i386
patch_id
commit_hash
c0fd049ae75349dc273de868fd3b3e8935115418
source_type
github
headline
i386: Implement bitreverse<mode>2 optab for GFNI
tldr
GCC now uses the GFNI instruction set to accelerate bit reversal operations on x86 when compiling with `-mgfni` and `-msse2`.
author
Jakub Jelinek
outcome
committed
performance_win
true
breaking_change
false
series_id
series_parts
[]
tags
  • i386
  • gfni
  • optimization
  • bit manipulation
discussion_id_link
bugzilla_pr
date
2026-05-18T00:00:00.000Z

This commit enables the use of the GFNI instruction set for bit reversal operations on x86 when compiling with -mgfni and -msse2. It implements the bitreverse<mode>2 optab by using the gf2p8affineqb instruction with a special constant that reverses bits in each byte. For modes wider than QImode, a byteswap is also performed. This improves the performance of __builtin_bitreverse when targeting modern x86 processors.