1/* This test is part of GDB, the GNU debugger.
2
3   Copyright 2018-2020 Free Software Foundation, Inc.
4
5   This program is free software; you can redistribute it and/or modify
6   it under the terms of the GNU General Public License as published by
7   the Free Software Foundation; either version 3 of the License, or
8   (at your option) any later version.
9
10   This program is distributed in the hope that it will be useful,
11   but WITHOUT ANY WARRANTY; without even the implied warranty of
12   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13   GNU General Public License for more details.
14
15   You should have received a copy of the GNU General Public License
16   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
17
18#include <stdint.h>
19
20int __attribute__ ((nomips16))
21main (void)
22{
23  /* We need to use a complex type to avoid hitting GCC's limit of
24     the number of `asm' operands:
25
26     mips-fpregset-core.f: In function 'main':
27     mips-fpregset-core.f:66:3: error: more than 30 operands in 'asm'
28        asm (
29        ^~~
30
31     and still have complete 32 FGR coverage with FP64 ABIs.  Using
32     a complex type breaks o32 GCC though, so use plain `double' with
33     FP32.  */
34#if _MIPS_FPSET == 32
35  typedef double _Complex float_t;
36#else
37  typedef double float_t;
38#endif
39  union
40    {
41      uint64_t i[32];
42      float_t f[256 / sizeof (float_t)];
43    }
44  u =
45    { .i =
46      {
47	0x0112233445566778, 0x899aabbccddeeff0,
48	0x0213243546576879, 0x8a9bacbdcedfe0f1,
49	0x031425364758697a, 0x8b9cadbecfd0e1f2,
50	0x0415263748596a7b, 0x8c9daebfc0d1e2f3,
51	0x05162738495a6b7c, 0x8d9eafb0c1d2e3f4,
52	0x061728394a5b6c7d, 0x8e9fa0b1c2d3e4f5,
53	0x0718293a4b5c6d7e, 0x8f90a1b2c3d4e5f6,
54	0x08192a3b4c5d6e7f, 0x8091a2b3c4d5e6f7,
55	0x091a2b3c4d5e6f70, 0x8192a3b4c5d6e7f8,
56	0x0a1b2c3d4e5f6071, 0x8293a4b5c6d7e8f9,
57	0x0b1c2d3e4f506172, 0x8394a5b6c7d8e9fa,
58	0x0c1d2e3f40516273, 0x8495a6b7c8d9eafb,
59	0x0d1e2f3041526374, 0x8596a7b8c9daebfc,
60	0x0e1f203142536475, 0x8697a8b9cadbecfd,
61	0x0f10213243546576, 0x8798a9bacbdcedfe,
62	0x0011223344556677, 0x8899aabbccddeeff
63      }
64    };
65
66  asm (
67    ".globl\tbreak_here\n\t"
68    ".aent\tbreak_here\n"
69    "break_here:\n\t"
70    "lb\t$0,0($0)\n"
71    :
72    : [f0] "f" (u.f[0]), [f2] "f" (u.f[1]),
73      [f4] "f" (u.f[2]), [f6] "f" (u.f[3]),
74      [f8] "f" (u.f[4]), [f10] "f" (u.f[5]),
75      [f12] "f" (u.f[6]), [f14] "f" (u.f[7]),
76      [f16] "f" (u.f[8]), [f18] "f" (u.f[9]),
77      [f20] "f" (u.f[10]), [f22] "f" (u.f[11]),
78      [f24] "f" (u.f[12]), [f26] "f" (u.f[13]),
79      [f28] "f" (u.f[14]), [f30] "f" (u.f[15]));
80
81  return 0;
82}
83