annotate gcc/testsuite/g++.dg/torture/pr63419.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 // { dg-do compile }
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
2 // { dg-additional-options "-Wno-psabi -Wno-return-type" }
111
kono
parents:
diff changeset
3 // Ignore warning on some powerpc-linux configurations.
kono
parents:
diff changeset
4 // { dg-prune-output "non-standard ABI extension" }
kono
parents:
diff changeset
5
kono
parents:
diff changeset
6 typedef float __m128 __attribute__ ((__vector_size__ (16)));
kono
parents:
diff changeset
7 const int a = 0;
kono
parents:
diff changeset
8 enum
kono
parents:
diff changeset
9 {
kono
parents:
diff changeset
10 ReadOnlyAccessors
kono
parents:
diff changeset
11 };
kono
parents:
diff changeset
12 template <typename> struct traits;
kono
parents:
diff changeset
13 struct A
kono
parents:
diff changeset
14 {
kono
parents:
diff changeset
15 enum
kono
parents:
diff changeset
16 {
kono
parents:
diff changeset
17 value = 1
kono
parents:
diff changeset
18 };
kono
parents:
diff changeset
19 };
kono
parents:
diff changeset
20 template <typename> struct EigenBase;
kono
parents:
diff changeset
21 template <typename> class J;
kono
parents:
diff changeset
22 template <typename, int = A::value> class DenseCoeffsBase;
kono
parents:
diff changeset
23 template <typename, int, int, int = 0, int = 0, int = 0> class K;
kono
parents:
diff changeset
24 template <typename> class N;
kono
parents:
diff changeset
25 template <typename, typename> class CwiseUnaryOp;
kono
parents:
diff changeset
26 template <typename> class L;
kono
parents:
diff changeset
27 template <typename> class P;
kono
parents:
diff changeset
28 template <typename> struct B;
kono
parents:
diff changeset
29 template <typename> struct C;
kono
parents:
diff changeset
30 template <typename Derived> struct dense_xpr_base
kono
parents:
diff changeset
31 {
kono
parents:
diff changeset
32 typedef N<Derived> type;
kono
parents:
diff changeset
33 };
kono
parents:
diff changeset
34 template <typename Packet> void padd (Packet);
kono
parents:
diff changeset
35 template <> struct C<float>
kono
parents:
diff changeset
36 {
kono
parents:
diff changeset
37 typedef __m128 type;
kono
parents:
diff changeset
38 };
kono
parents:
diff changeset
39 struct D
kono
parents:
diff changeset
40 {
kono
parents:
diff changeset
41 void
kono
parents:
diff changeset
42 packetOp (C<float>::type)
kono
parents:
diff changeset
43 {
kono
parents:
diff changeset
44 __m128 b = { m_other };
kono
parents:
diff changeset
45 padd (b);
kono
parents:
diff changeset
46 }
kono
parents:
diff changeset
47 float m_other;
kono
parents:
diff changeset
48 };
kono
parents:
diff changeset
49 template <typename Derived>
kono
parents:
diff changeset
50 class DenseCoeffsBase<Derived, ReadOnlyAccessors> : public EigenBase<Derived>
kono
parents:
diff changeset
51 {
kono
parents:
diff changeset
52 public:
kono
parents:
diff changeset
53 typedef typename C<typename traits<Derived>::Scalar>::type PacketScalar;
kono
parents:
diff changeset
54 };
kono
parents:
diff changeset
55 template <typename Derived>
kono
parents:
diff changeset
56 class DenseCoeffsBase<Derived>
kono
parents:
diff changeset
57 : public DenseCoeffsBase<Derived, ReadOnlyAccessors>
kono
parents:
diff changeset
58 {
kono
parents:
diff changeset
59 public:
kono
parents:
diff changeset
60 template <typename OtherDerived, int, int LoadMode>
kono
parents:
diff changeset
61 void
kono
parents:
diff changeset
62 copyPacket (typename traits<Derived>::Index, J<OtherDerived> p2)
kono
parents:
diff changeset
63 {
kono
parents:
diff changeset
64 p2.derived ().template packet<LoadMode> (0);
kono
parents:
diff changeset
65 }
kono
parents:
diff changeset
66 };
kono
parents:
diff changeset
67 template <typename Derived> class J : public DenseCoeffsBase<Derived>
kono
parents:
diff changeset
68 {
kono
parents:
diff changeset
69 public:
kono
parents:
diff changeset
70 using DenseCoeffsBase<Derived>::derived;
kono
parents:
diff changeset
71 template <typename OtherDerived>
kono
parents:
diff changeset
72 Derived &lazyAssign (const J<OtherDerived> &);
kono
parents:
diff changeset
73 };
kono
parents:
diff changeset
74 template <typename Derived> class N : public J<Derived>
kono
parents:
diff changeset
75 {
kono
parents:
diff changeset
76 public:
kono
parents:
diff changeset
77 template <typename OtherDerived>
kono
parents:
diff changeset
78 typename B<OtherDerived>::Type operator*(N<OtherDerived>);
kono
parents:
diff changeset
79 L<Derived> array ();
kono
parents:
diff changeset
80 };
kono
parents:
diff changeset
81 template <typename Derived> struct EigenBase
kono
parents:
diff changeset
82 {
kono
parents:
diff changeset
83 Derived
kono
parents:
diff changeset
84 derived () const
kono
parents:
diff changeset
85 {
kono
parents:
diff changeset
86 return *static_cast<const Derived *> (this);
kono
parents:
diff changeset
87 }
kono
parents:
diff changeset
88 };
kono
parents:
diff changeset
89 template <typename Derived1, typename Derived2> struct F
kono
parents:
diff changeset
90 {
kono
parents:
diff changeset
91 static void
kono
parents:
diff changeset
92 run (Derived1 p1, Derived2 p2)
kono
parents:
diff changeset
93 {
kono
parents:
diff changeset
94 enum
kono
parents:
diff changeset
95 {
kono
parents:
diff changeset
96 srcAlignment
kono
parents:
diff changeset
97 };
kono
parents:
diff changeset
98 for (;;)
kono
parents:
diff changeset
99 p1.template copyPacket<Derived2, 0, srcAlignment> (0, p2);
kono
parents:
diff changeset
100 }
kono
parents:
diff changeset
101 };
kono
parents:
diff changeset
102 template <typename Derived>
kono
parents:
diff changeset
103 template <typename OtherDerived>
kono
parents:
diff changeset
104 Derived &
kono
parents:
diff changeset
105 J<Derived>::lazyAssign (const J<OtherDerived> &p1)
kono
parents:
diff changeset
106 {
kono
parents:
diff changeset
107 F<Derived, OtherDerived>::run (derived (), p1.derived ());
kono
parents:
diff changeset
108 }
kono
parents:
diff changeset
109 template <typename Derived, typename OtherDerived> struct G
kono
parents:
diff changeset
110 {
kono
parents:
diff changeset
111 static Derived
kono
parents:
diff changeset
112 run (Derived p1, OtherDerived p2)
kono
parents:
diff changeset
113 {
kono
parents:
diff changeset
114 p1.lazyAssign (p2);
kono
parents:
diff changeset
115 }
kono
parents:
diff changeset
116 };
kono
parents:
diff changeset
117 class H
kono
parents:
diff changeset
118 {
kono
parents:
diff changeset
119 public:
kono
parents:
diff changeset
120 H (int, int, int);
kono
parents:
diff changeset
121 };
kono
parents:
diff changeset
122 template <typename Derived> class M : public dense_xpr_base<Derived>::type
kono
parents:
diff changeset
123 {
kono
parents:
diff changeset
124 public:
kono
parents:
diff changeset
125 typedef typename traits<Derived>::Index Index;
kono
parents:
diff changeset
126 H m_storage;
kono
parents:
diff changeset
127 M (Index, Index, Index) : m_storage (0, 0, 0) {}
kono
parents:
diff changeset
128 template <typename OtherDerived>
kono
parents:
diff changeset
129 void
kono
parents:
diff changeset
130 _set_noalias (J<OtherDerived> p1)
kono
parents:
diff changeset
131 {
kono
parents:
diff changeset
132 G<Derived, OtherDerived>::run (this->derived (), p1.derived ());
kono
parents:
diff changeset
133 }
kono
parents:
diff changeset
134 };
kono
parents:
diff changeset
135 template <typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows,
kono
parents:
diff changeset
136 int _MaxCols>
kono
parents:
diff changeset
137 struct traits<K<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> >
kono
parents:
diff changeset
138 {
kono
parents:
diff changeset
139 typedef _Scalar Scalar;
kono
parents:
diff changeset
140 typedef int StorageKind;
kono
parents:
diff changeset
141 typedef int Index;
kono
parents:
diff changeset
142 };
kono
parents:
diff changeset
143 template <typename, int _Rows, int _Cols, int, int, int>
kono
parents:
diff changeset
144 class K : public M<K<float, _Rows, _Cols> >
kono
parents:
diff changeset
145 {
kono
parents:
diff changeset
146 public:
kono
parents:
diff changeset
147 typedef M<K> Base;
kono
parents:
diff changeset
148 typedef K Nested;
kono
parents:
diff changeset
149 template <typename T0, typename T1> K (T0, T1);
kono
parents:
diff changeset
150 template <typename OtherDerived> K (N<OtherDerived> p1) : Base (0, 0, 0)
kono
parents:
diff changeset
151 {
kono
parents:
diff changeset
152 Base::_set_noalias (p1);
kono
parents:
diff changeset
153 }
kono
parents:
diff changeset
154 };
kono
parents:
diff changeset
155 template <typename UnaryOp, typename XprType>
kono
parents:
diff changeset
156 struct traits<CwiseUnaryOp<UnaryOp, XprType> > : traits<XprType>
kono
parents:
diff changeset
157 {
kono
parents:
diff changeset
158 };
kono
parents:
diff changeset
159 template <typename, typename, typename> class I;
kono
parents:
diff changeset
160 template <typename, typename XprType>
kono
parents:
diff changeset
161 class CwiseUnaryOp
kono
parents:
diff changeset
162 : public I<D, XprType, typename traits<XprType>::StorageKind>
kono
parents:
diff changeset
163 {
kono
parents:
diff changeset
164 public:
kono
parents:
diff changeset
165 D
kono
parents:
diff changeset
166 functor ()
kono
parents:
diff changeset
167 {
kono
parents:
diff changeset
168 return m_functor;
kono
parents:
diff changeset
169 }
kono
parents:
diff changeset
170 typename XprType::Nested nestedExpression ();
kono
parents:
diff changeset
171 D m_functor;
kono
parents:
diff changeset
172 };
kono
parents:
diff changeset
173 template <typename UnaryOp, typename XprType>
kono
parents:
diff changeset
174 class I<UnaryOp, XprType, int>
kono
parents:
diff changeset
175 : public dense_xpr_base<CwiseUnaryOp<UnaryOp, XprType> >::type
kono
parents:
diff changeset
176 {
kono
parents:
diff changeset
177 public:
kono
parents:
diff changeset
178 typedef CwiseUnaryOp<UnaryOp, XprType> Derived;
kono
parents:
diff changeset
179 typedef typename dense_xpr_base<CwiseUnaryOp<UnaryOp, XprType> >::type Base;
kono
parents:
diff changeset
180 typedef Derived Nested;
kono
parents:
diff changeset
181 using Base::derived;
kono
parents:
diff changeset
182 template <int LoadMode> void packet (typename traits<Derived>::Index)
kono
parents:
diff changeset
183 {
kono
parents:
diff changeset
184 derived ().functor ().packetOp (
kono
parents:
diff changeset
185 derived ().nestedExpression ().template packet<LoadMode> (0));
kono
parents:
diff changeset
186 }
kono
parents:
diff changeset
187 };
kono
parents:
diff changeset
188 template <typename> struct B
kono
parents:
diff changeset
189 {
kono
parents:
diff changeset
190 typedef P<CwiseUnaryOp<D, L<K<float, 0, 1> > > > Type;
kono
parents:
diff changeset
191 };
kono
parents:
diff changeset
192 template <typename Derived> class O : public J<Derived>
kono
parents:
diff changeset
193 {
kono
parents:
diff changeset
194 public:
kono
parents:
diff changeset
195 P<Derived> matrix ();
kono
parents:
diff changeset
196 };
kono
parents:
diff changeset
197 template <typename ExpressionType>
kono
parents:
diff changeset
198 struct traits<L<ExpressionType> > : traits<typename ExpressionType::Nested>
kono
parents:
diff changeset
199 {
kono
parents:
diff changeset
200 };
kono
parents:
diff changeset
201 template <typename ExpressionType> class L : public O<L<ExpressionType> >
kono
parents:
diff changeset
202 {
kono
parents:
diff changeset
203 public:
kono
parents:
diff changeset
204 typedef L Nested;
kono
parents:
diff changeset
205 template <int>
kono
parents:
diff changeset
206 typename O<L>::PacketScalar packet (typename traits<L>::Index);
kono
parents:
diff changeset
207 };
kono
parents:
diff changeset
208 template <typename ExpressionType>
kono
parents:
diff changeset
209 struct traits<P<ExpressionType> > : traits<typename ExpressionType::Nested>
kono
parents:
diff changeset
210 {
kono
parents:
diff changeset
211 };
kono
parents:
diff changeset
212 template <typename ExpressionType> class P : public N<P<ExpressionType> >
kono
parents:
diff changeset
213 {
kono
parents:
diff changeset
214 public:
kono
parents:
diff changeset
215 N<P> Base;
kono
parents:
diff changeset
216 template <int LoadMode> void packet (typename traits<P>::Index)
kono
parents:
diff changeset
217 {
kono
parents:
diff changeset
218 m_expression.template packet<LoadMode> (0);
kono
parents:
diff changeset
219 }
kono
parents:
diff changeset
220 ExpressionType m_expression;
kono
parents:
diff changeset
221 };
kono
parents:
diff changeset
222 int
kono
parents:
diff changeset
223 main ()
kono
parents:
diff changeset
224 {
kono
parents:
diff changeset
225 K<float, 0, a> m (0, 0);
kono
parents:
diff changeset
226 K<float, 0, 1> c (0, 0);
kono
parents:
diff changeset
227 c = m.array ().matrix () * m;
kono
parents:
diff changeset
228 }