https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114528
Bug ID: 114528 Summary: (0xFFFFFFFF0001FFFFULL - 0x00123000) constant forming could be done in 2 instructions Product: gcc Version: 14.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: pinskia at gcc dot gnu.org Target Milestone: --- Target: aarch64 Take: ``` long long f() { return 0xFFFFFFFF0001FFFF;// - 0x00123000; } long long g(long long a) { return a - 0x00123000; } long long x() { return 0xFFFFFFFF0001FFFF - 0x00123000; } long long x1() { return g(f()); } ``` As you can see x and x1 produces 3 instructions forming the constant but GCC should be able to do it in 2 as shown via `g` and `f` are one instruction each. Noticed from reading the LLVM issue https://github.com/llvm/llvm-project/issues/87028 .