comparison gcc/testsuite/g++.dg/cpp0x/constexpr-builtin4.C @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents
children
comparison
equal deleted inserted replaced
131:84e7813d76e9 145:1830386684a0
1 // { dg-do compile { target c++11 } }
2 // { dg-additional-options "-Wno-psabi" }
3
4 typedef int v4si __attribute__((vector_size (4 * sizeof (int))));
5 typedef float v4sf __attribute__((vector_size (4 * sizeof (float))));
6 constexpr v4sf a = __builtin_convertvector (v4si { 1, 2, -3, -4 }, v4sf);
7
8 constexpr v4sf
9 foo (v4si x)
10 {
11 return __builtin_convertvector (x, v4sf);
12 }
13
14 constexpr v4sf b = foo (v4si { 3, 4, -1, -2 });
15
16 static_assert (a[0] == 1.0f && a[1] == 2.0f && a[2] == -3.0f && a[3] == -4.0f, "");
17 static_assert (b[0] == 3.0f && b[1] == 4.0f && b[2] == -1.0f && b[3] == -2.0f, "");