Use gather loads for strided accesses
[official-gcc.git] / gcc / testsuite / gcc.target / nvptx / v2si-run.c
blob5821a5a95d6bdd593152ab33843b104b0052c18a
1 /* { dg-do run } */
2 /* { dg-options "-O2" } */
4 #include "v2si.c"
6 void __attribute__((noinline, noclone))
7 init_val ( __v2si *p)
9 char *p2 = (char*)p;
10 p2[0] = 8;
11 p2[1] = 7;
12 p2[2] = 6;
13 p2[3] = 5;
14 p2[4] = 4;
15 p2[5] = 3;
16 p2[6] = 2;
17 p2[7] = 1;
20 int
21 main (void)
24 __v2si val;
25 __v2si val2;
26 __v2si val3;
28 init_val(&val);
30 /* Copy val to val2. */
31 vector_store (&val2, val);
33 /* Copy val2 to val3. */
34 val3 = vector_load (&val2);
36 /* Compare val to val3. */
38 char *p = (char*)&val;
39 char *p2 = (char*)&val3;
41 if (p[0] != p2[0])
42 return 1;
43 if (p[1] != p2[1])
44 return 1;
45 if (p[2] != p2[2])
46 return 1;
47 if (p[3] != p2[3])
48 return 1;
49 if (p[4] != p2[4])
50 return 1;
51 if (p[5] != p2[5])
52 return 1;
53 if (p[6] != p2[6])
54 return 1;
55 if (p[7] != p2[7])
56 return 1;
61 __v2si val4 = vector_const ();
62 char *p = (char*)&val4;
64 if (p[0] != 1)
65 return 1;
66 if (p[1] != 0)
67 return 1;
68 if (p[2] != 0)
69 return 1;
70 if (p[3] != 0)
71 return 1;
72 if (p[4] != 2)
73 return 1;
74 if (p[5] != 0)
75 return 1;
76 if (p[6] != 0)
77 return 1;
78 if (p[7] != 0)
79 return 1;
82 return 0;