Debian Codegraph @

gcc/testsuite/g++.target/i386/pr90424-1.C

raw
1 /* { dg-do compile { target c++11 } } */
2 /* { dg-options "-O2 -msse2 -fdump-tree-optimized" } */
3
4 template <class T>
5 using V [[gnu::vector_size(16)]] = T;
6
7 template <class T, unsigned M = sizeof(V<T>)>
8 V<T> load(const void *p) {
9 using W = V<T>;
10 W r;
11 __builtin_memcpy(&r, p, M);
12 return r;
13 }
14
15 // movq or movsd
16 template V<char> load<char, 8>(const void *); // bad
17 template V<short> load<short, 8>(const void *); // bad
18 template V<int> load<int, 8>(const void *); // bad
19 template V<long> load<long, 8>(const void *); // good
20 // the following is disabled because V2SF isn't a supported mode
21 // template V<float> load<float, 8>(const void *); // bad
22 template V<double> load<double, 8>(const void *); // good (movsd?)
23
24 // movd or movss
25 template V<char> load<char, 4>(const void *); // bad
26 template V<short> load<short, 4>(const void *); // bad
27 template V<int> load<int, 4>(const void *); // good
28 template V<float> load<float, 4>(const void *); // good
29
30 /* We should end up with one load and one insert for each function. */
31 /* { dg-final { scan-tree-dump-times "BIT_INSERT_EXPR" 9 "optimized" } } */
32 /* { dg-final { scan-tree-dump-times "MEM" 9 "optimized" } } */