https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118252
Bug ID: 118252 Summary: i386 should implement CASE_VECTOR_SHORTEN_MODE Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: andi-gcc at firstfloor dot org Target Milestone: --- Inspired by https://github.com/komrad36/CRC When generating a jump table for switch gcc always uses .long for PIC or .quad for non PIC. This both wastes code size and dcache foot print. The offset jump sequence is slightly longer, but shortening the table makes more than up for it. First it should probably always use .long to save dcache, but if the switch code fits into 16k or 8k it should use .word or .byte. gcc already has an optimization pass for this as part of jump shortening. But it requires implementing the CASE_VECTOR_SHORTEN_MODE target macro which is used by some other targets, but not x86.