PR testsuite/85326
[official-gcc.git] / gcc / testsuite / g++.dg / other / sve_tls_2.C
blobed4689353ae75da5256047e1ce6ad46d912ca3d4
1 /* { dg-do compile { target aarch64*-*-* } } */
2 /* { dg-require-effective-target tls } */
3 /* { dg-options "-O2 -march=armv8.2-a+sve -fPIC -msve-vector-bits=256" } */
5 #include <stdint.h>
7 typedef int8_t v32qi __attribute__((vector_size (32)));
9 extern __thread int z;
11 void
12 foo (v32qi *a, int *b)
14   v32qi x = a[0], y = a[1];
15   asm volatile ("" :: "w" ((v32qi) { -1, 0, 0, -1, -1, -1, 0, 0,
16                                      -1, -1, -1, -1, 0, 0, 0, 0,
17                                      -1, -1, -1, -1, -1, -1, -1, -1,
18                                      0, 0, 0, 0, 0, 0, 0, 0 } ? x : y)
19                 : "memory");
20   if (*b)
21     {
22       x = a[2], y = a[3];
23       asm volatile ("" :: "w" ((v32qi) { -1, 0, 0, -1, -1, -1, 0, 0,
24                                          -1, -1, -1, -1, 0, 0, 0, 0,
25                                          -1, -1, -1, -1, -1, -1, -1, -1,
26                                          0, 0, 0, 0, 0, 0, 0, 0 } ? x : y),
27                     "r" (z));
28     }
31 /* { dg-final { scan-assembler-times {\tldr\tp[0-9]} 2 } } */