Closed
Description
Bugzilla Link | 52141 |
Version | trunk |
OS | Windows NT |
Reporter | LLVM Bugzilla Contributor |
CC | @Arnaud-de-Grandmaison-ARM,@DMG862,@smithp35 |
Extended Description
For complex repeating constants like:
void
foo (unsigned long long *a)
{
a[0] = 0x0140c0da0140c0daULL;
}
aarch64 clang generates
foo(unsigned long long*): // @​foo(unsigned long long*)
mov x8, #​49370
movk x8, #​320, lsl #​16
movk x8, #​49370, lsl #​32
movk x8, #​320, lsl #​48
str x8, [x0]
ret
but for constants where the top half is the same as the bottom half we can construct just one half and use a store pair to duplicate it:
foo(unsigned long long*):
mov w1, 49370
movk w1, 0x140, lsl 16
stp w1, w1, [x0]
ret
See also: https://godbolt.org/z/n3M4qh6sW