https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107316

            Bug ID: 107316
           Summary: [aarch64] Init big const value should be improved
                    compare to llvm
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zhongyunde at huawei dot com
  Target Milestone: ---

test case: https://godbolt.org/z/ahreYnahE
```
int main (int argc, char** argv)
{
  if (lshift_1 (0xaaaa5555aaaa5555ull) != 0ll)
    abort();

  return 0;
}
```
* gcc use 4 instructions
```
        mov     x0, 21845
        movk    x0, 0xaaaa, lsl 16
        movk    x0, 0x5555, lsl 32
        movk    x0, 0xaaaa, lsl 48
```

* while llvm use 3 instructions:
```
        mov     x0, #6148914691236517205
        movk    x0, #43690, lsl #16
        movk    x0, #43690, lsl #48
```

Reply via email to