Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AArch64][SVE] can improve SIMD immediate generation #122422

Open
k-arrows opened this issue Jan 10, 2025 · 1 comment
Open

[AArch64][SVE] can improve SIMD immediate generation #122422

k-arrows opened this issue Jan 10, 2025 · 1 comment
Labels
backend:AArch64 missed-optimization SVE ARM Scalable Vector Extensions

Comments

@k-arrows
Copy link

Test case:

#include <arm_neon.h>

typedef short v8hi __attribute__((vector_size(16)));
typedef int v4si __attribute__((vector_size(16)));
typedef long v2di __attribute__((vector_size(16)));

v4si t1 ()
{
  return (v4si) { 0xffc, 0xffc, 0xffc, 0xffc };
}

v8hi t2 ()
{
  return (v8hi) { 510, 510, 510, 510, 510, 510, 510, 510 };
}

v2di t3 ()
{
  return (v2di) { 1, 1 };
}

When generating Advanced SIMD code, if SVE is available on target CPU, SVE move immediate can be used.
https://godbolt.org/z/9vhc6Mx1j

The same applies for SVE bitmask immediate.

Reference(GCC patches):
[AArch64: Improve SIMD immediate generation (1/3)]
[AArch64: Improve SIMD immediate generation (2/3)]
[AArch64: Add support for SIMD xor immediate (3/3)]

@llvmbot
Copy link
Member

llvmbot commented Jan 10, 2025

@llvm/issue-subscribers-backend-aarch64

Author: None (k-arrows)

Test case: ```c #include <arm_neon.h>

typedef short v8hi attribute((vector_size(16)));
typedef int v4si attribute((vector_size(16)));
typedef long v2di attribute((vector_size(16)));

v4si t1 ()
{
return (v4si) { 0xffc, 0xffc, 0xffc, 0xffc };
}

v8hi t2 ()
{
return (v8hi) { 510, 510, 510, 510, 510, 510, 510, 510 };
}

v2di t3 ()
{
return (v2di) { 1, 1 };
}


When generating Advanced SIMD code, if SVE is available on target CPU, SVE move immediate can be used.
https://godbolt.org/z/9vhc6Mx1j

The same applies for SVE bitmask immediate.

Reference(GCC patches): 
[AArch64: Improve SIMD immediate generation (1/3)]
[AArch64: Improve SIMD immediate generation (2/3)]
[AArch64: Add support for SIMD xor immediate (3/3)]
</details>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:AArch64 missed-optimization SVE ARM Scalable Vector Extensions
Projects
None yet
Development

No branches or pull requests

3 participants