https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118554
Bug ID: 118554 Summary: Allow to specify the size of an inline asm Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: gjl at gcc dot gnu.org Target Milestone: --- Allowing the source code to specify the size of an inline asm would have the following benefits at least: 1) Currently, the asm size may be overly pessimistic (i.e. too big) so that branches that are crossing the asm see a branch offset larger than required. This can result in sub-optimal code. 2) Better cost estimates for inlining decisions etc. 3) When the asm uses macros or pseudo instructions, the size heuristic may be overly optimistic (i.e. too small), which may lead to errors from the assembler when branches crossing the asm cannot span the actual offset. 4) Currently, even the size of an empty asm like __asm("" : "+r" (var)) is too pessimistic. One way to specify the size would be a new attribute like asm_len(size), where size is an expression that must resolve to an integer known at compile time. Using an attribute has the advantage that the code can query whether the feature is available or not.