1 /* { dg-do run } */
2 /* { dg-options "-O2" } */
3
4 /* Test that gcn_expand_scalar_to_vector_address does not clobber VCC.
5 If it does then spills and reloads will be unsafe, leading to unexpected
6 conditional branch behaviour. */
7
8 extern void abort ();
9
10 __attribute__((vector_size(256))) int vec[2] = {{0}, {0}};
11
12 int
main()13 main()
14 {
15 long vcc = 0;
16
17 /* Load a known value into VCC. The memory barrier ensures that the vector
18 load must happen after this point. */
19 asm volatile ("s_mov_b32 vcc_lo, 0x12345689\n\t"
20 "s_mov_b32 vcc_hi, 0xabcdef0"
21 ::: "memory");
22
23 /* Compiler inserts vector load here. */
24
25 /* Consume the abitrary vector, and return the current value of VCC. */
26 asm volatile ("; no-op" : "=cV"(vcc) : "v"(vec[0]), "v"(vec[1]));
27
28 /* The value should match the initialized value. */
29 if (vcc != 0xabcdef012345689)
30 abort ();
31
32 return 0;
33 }
34