summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/torture/pr63419.C
blob: 6d4c0745d4114c767b2803e6f9e551e05bcac8eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
// { dg-do compile }
// { dg-additional-options "-Wno-psabi" }
// Ignore warning on some powerpc-linux configurations.
// { dg-prune-output "non-standard ABI extension" }

typedef float __m128 __attribute__ ((__vector_size__ (16)));
const int a = 0;
enum
{
  ReadOnlyAccessors
};
template <typename> struct traits;
struct A
{
  enum
  {
    value = 1
  };
};
template <typename> struct EigenBase;
template <typename> class J;
template <typename, int = A::value> class DenseCoeffsBase;
template <typename, int, int, int = 0, int = 0, int = 0> class K;
template <typename> class N;
template <typename, typename> class CwiseUnaryOp;
template <typename> class L;
template <typename> class P;
template <typename> struct B;
template <typename> struct C;
template <typename Derived> struct dense_xpr_base
{
  typedef N<Derived> type;
};
template <typename Packet> void padd (Packet);
template <> struct C<float>
{
  typedef __m128 type;
};
struct D
{
  void
  packetOp (C<float>::type)
  {
    __m128 b = { m_other };
    padd (b);
  }
  float m_other;
};
template <typename Derived>
class DenseCoeffsBase<Derived, ReadOnlyAccessors> : public EigenBase<Derived>
{
public:
  typedef typename C<typename traits<Derived>::Scalar>::type PacketScalar;
};
template <typename Derived>
class DenseCoeffsBase<Derived>
    : public DenseCoeffsBase<Derived, ReadOnlyAccessors>
{
public:
  template <typename OtherDerived, int, int LoadMode>
  void
  copyPacket (typename traits<Derived>::Index, J<OtherDerived> p2)
  {
    p2.derived ().template packet<LoadMode> (0);
  }
};
template <typename Derived> class J : public DenseCoeffsBase<Derived>
{
public:
  using DenseCoeffsBase<Derived>::derived;
  template <typename OtherDerived>
  Derived &lazyAssign (const J<OtherDerived> &);
};
template <typename Derived> class N : public J<Derived>
{
public:
  template <typename OtherDerived>
  typename B<OtherDerived>::Type operator*(N<OtherDerived>);
  L<Derived> array ();
};
template <typename Derived> struct EigenBase
{
  Derived
  derived () const
  {
    return *static_cast<const Derived *> (this);
  }
};
template <typename Derived1, typename Derived2> struct F
{
  static void
  run (Derived1 p1, Derived2 p2)
  {
    enum
    {
      srcAlignment
    };
    for (;;)
      p1.template copyPacket<Derived2, 0, srcAlignment> (0, p2);
  }
};
template <typename Derived>
template <typename OtherDerived>
Derived &
J<Derived>::lazyAssign (const J<OtherDerived> &p1)
{
  F<Derived, OtherDerived>::run (derived (), p1.derived ());
}
template <typename Derived, typename OtherDerived> struct G
{
  static Derived
  run (Derived p1, OtherDerived p2)
  {
    p1.lazyAssign (p2);
  }
};
class H
{
public:
  H (int, int, int);
};
template <typename Derived> class M : public dense_xpr_base<Derived>::type
{
public:
  typedef typename traits<Derived>::Index Index;
  H m_storage;
  M (Index, Index, Index) : m_storage (0, 0, 0) {}
  template <typename OtherDerived>
  void
  _set_noalias (J<OtherDerived> p1)
  {
    G<Derived, OtherDerived>::run (this->derived (), p1.derived ());
  }
};
template <typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows,
          int _MaxCols>
struct traits<K<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> >
{
  typedef _Scalar Scalar;
  typedef int StorageKind;
  typedef int Index;
};
template <typename, int _Rows, int _Cols, int, int, int>
class K : public M<K<float, _Rows, _Cols> >
{
public:
  typedef M<K> Base;
  typedef K Nested;
  template <typename T0, typename T1> K (T0, T1);
  template <typename OtherDerived> K (N<OtherDerived> p1) : Base (0, 0, 0)
  {
    Base::_set_noalias (p1);
  }
};
template <typename UnaryOp, typename XprType>
struct traits<CwiseUnaryOp<UnaryOp, XprType> > : traits<XprType>
{
};
template <typename, typename, typename> class I;
template <typename, typename XprType>
class CwiseUnaryOp
    : public I<D, XprType, typename traits<XprType>::StorageKind>
{
public:
  D
  functor ()
  {
    return m_functor;
  }
  typename XprType::Nested nestedExpression ();
  D m_functor;
};
template <typename UnaryOp, typename XprType>
class I<UnaryOp, XprType, int>
    : public dense_xpr_base<CwiseUnaryOp<UnaryOp, XprType> >::type
{
public:
  typedef CwiseUnaryOp<UnaryOp, XprType> Derived;
  typedef typename dense_xpr_base<CwiseUnaryOp<UnaryOp, XprType> >::type Base;
  typedef Derived Nested;
  using Base::derived;
  template <int LoadMode> void packet (typename traits<Derived>::Index)
  {
    derived ().functor ().packetOp (
        derived ().nestedExpression ().template packet<LoadMode> (0));
  }
};
template <typename> struct B
{
  typedef P<CwiseUnaryOp<D, L<K<float, 0, 1> > > > Type;
};
template <typename Derived> class O : public J<Derived>
{
public:
  P<Derived> matrix ();
};
template <typename ExpressionType>
struct traits<L<ExpressionType> > : traits<typename ExpressionType::Nested>
{
};
template <typename ExpressionType> class L : public O<L<ExpressionType> >
{
public:
  typedef L Nested;
  template <int>
  typename O<L>::PacketScalar packet (typename traits<L>::Index);
};
template <typename ExpressionType>
struct traits<P<ExpressionType> > : traits<typename ExpressionType::Nested>
{
};
template <typename ExpressionType> class P : public N<P<ExpressionType> >
{
public:
  N<P> Base;
  template <int LoadMode> void packet (typename traits<P>::Index)
  {
    m_expression.template packet<LoadMode> (0);
  }
  ExpressionType m_expression;
};
int
main ()
{
  K<float, 0, a> m (0, 0);
  K<float, 0, 1> c (0, 0);
  c = m.array ().matrix () * m;
}