TUESDAY, NOVEMBER 3, 2026
i386
Fix REX2 register check for CS-prefixed indirect calls
Corrects register check for indirect calls with CS prefix to properly support r16-r31 thunks.
This commit fixes a bug in the i386 indirect call mechanism where the REX2 register check was performed twice. By correcting this to use REX2_INT_REGNO_P, the compiler now properly supports the -mindirect-branch-cs-prefix option for calls through registers r16-r31.
In Details
The ix86_output_indirect_branch_via_reg function in i386.cc incorrectly used REX_INT_REGNO_P when it should have used REX2_INT_REGNO_P. This affects the generation of CS-prefixed indirect branches when the target register is in the r16-r31 range, which are encoded using REX.W and REX2 prefixes.