Mercurial > hg > CbC > CbC_gcc
view gcc/testsuite/g++.dg/other/vector-compare.C @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children |
line wrap: on
line source
/* { dg-do compile { target c++11 } } */ /* { dg-options "-Wall -Wno-tautological-compare" } */ // Check that we can compare vector types that really are the same through // typedefs. typedef float v4f __attribute__((vector_size(4*sizeof(float)))); template <class T> void eat (T&&) {} template <class T, int n> struct Vec { typedef T type __attribute__((vector_size(4*sizeof(T)))); template <class U> static void fun (type const& t, U& u) { eat (t > u); } }; long long f (v4f *x, v4f const *y) { return ((*x < *y) | (*x <= *y))[2]; } int main () { v4f x = {0,1,2,3}; Vec<const volatile float,4>::type f = {-1,5,2,3.1}; auto c = (x == f) == (x >= x); eat (c[3]); Vec<const volatile float,4>::fun (f, x); Vec<const volatile float,4>::fun (x, f); Vec<const volatile float,4>::fun (f, f); Vec<const volatile float,4>::fun (x, x); }