aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.target/aarch64/vmlsq_laneq.c
blob: dd3fb81198545826f98cdce51ef2124cd24a958c (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

/* { dg-do run } */
/* { dg-options "-O3" } */

#include "arm_neon.h"

extern void abort (void);

void
test1 ()
{
  int16x8_t val1, val2, val3;
  int16x8_t result;
  uint64_t act, exp;

  val1 = vcombine_s16 (vcreate_s16 (UINT64_C (0xffff9ab680000000)),
		       vcreate_s16 (UINT64_C (0x00000000ffff0000)));
  val2 = vcombine_s16 (vcreate_s16 (UINT64_C (0x32b77fffffff7fff)),
		       vcreate_s16 (UINT64_C (0x0000ffff00007fff)));
  val3 = vcombine_s16 (vcreate_s16 (UINT64_C (0x7fff00007fff0000)),
		       vcreate_s16 (UINT64_C (0x80007fff00000000)));
  result = vmlsq_laneq_s16 (val1, val2, val3, 6);

  act = vgetq_lane_u64 (vreinterpretq_u64_s16 (result), 0);
  exp = UINT64_C (0xb2b69ab5ffffffff);
  if (act != exp)
    abort ();

  act = vgetq_lane_u64 (vreinterpretq_u64_s16 (result), 1);
  exp = UINT64_C (0x00007fffffffffff);
  if (act != exp)
    abort ();
}

void
test2 ()
{
  int32x4_t val1, val2, val3;
  int32x4_t result;
  uint64_t exp, act;

  val1 = vcombine_s32 (vcreate_s32 (UINT64_C (0x00008000f46f7fff)),
		       vcreate_s32 (UINT64_C (0x7fffffffffff8000)));
  val2 = vcombine_s32 (vcreate_s32 (UINT64_C (0x7fff7fff0e700000)),
		       vcreate_s32 (UINT64_C (0xffff000080000000)));
  val3 = vcombine_s32 (vcreate_s32 (UINT64_C (0x00000000ffff0000)),
		       vcreate_s32 (UINT64_C (0xd9edea1a8000fb28)));
  result = vmlsq_laneq_s32 (val1, val2, val3, 3);

  act = vgetq_lane_u64 (vreinterpretq_u64_s32 (result), 0);
  exp = UINT64_C (0xcefb6a1a1d0f7fff);
  if (act != exp)
    abort ();

  act = vgetq_lane_u64 (vreinterpretq_u64_s32 (result), 1);
  exp = UINT64_C (0x6a19ffffffff8000);
  if (act != exp)
    abort ();
}

void
test3 ()
{
  uint16x8_t val1, val2, val3;
  uint16x8_t result;
  uint64_t act, exp;

  val1 = vcombine_u16 (vcreate_u16 (UINT64_C (0x000080008000802a)),
		       vcreate_u16 (UINT64_C (0x7fffffff00007fff)));
  val2 = vcombine_u16 (vcreate_u16 (UINT64_C (0x7fffcdf1ffff0000)),
		       vcreate_u16 (UINT64_C (0xe2550000ffffffff)));
  val3 = vcombine_u16 (vcreate_u16 (UINT64_C (0x80007fff80000000)),
		       vcreate_u16 (UINT64_C (0xbe2100007fffffff)));

  result = vmlsq_laneq_u16 (val1, val2, val3, 7);

  act = vgetq_lane_u64 (vreinterpretq_u64_u16 (result), 0);
  exp = UINT64_C (0x3e2115ef3e21802a);
  if (act != exp)
    abort ();

  act = vgetq_lane_u64 (vreinterpretq_u64_u16 (result), 1);
  exp = UINT64_C (0x3d0affffbe213e20);
  if (act != exp)
    abort ();
}

void
test4 ()
{
  uint32x4_t val1, val2, val3;
  uint32x4_t result;
  uint64_t act, exp;

  val1 = vcombine_u32 (vcreate_u32 (UINT64_C (0x3295fe3d7fff7fff)),
		       vcreate_u32 (UINT64_C (0x7fff00007fff7fff)));
  val2 = vcombine_u32 (vcreate_u32 (UINT64_C (0xffff7fff7fff8000)),
		       vcreate_u32 (UINT64_C (0x7fff80008000ffff)));
  val3 = vcombine_u32 (vcreate_u32 (UINT64_C (0x7fff7fff80008000)),
		       vcreate_u32 (UINT64_C (0x0000800053ab7fff)));

  result = vmlsq_laneq_u32 (val1, val2, val3, 2);

  act = vgetq_lane_u64 (vreinterpretq_u64_u32 (result), 0);
  exp = UINT64_C (0x4640fe3cbffeffff);
  if (act != exp)
    abort ();

  act = vgetq_lane_u64 (vreinterpretq_u64_u32 (result), 1);
  exp = UINT64_C (0xbffe8000d3abfffe);
  if (act != exp)
    abort ();
}

void
test5 ()
{
  float32x4_t val1, val2, val3;
  float32x4_t result;
  float32_t act;

  val1 = vcombine_f32 (vcreate_f32 (UINT64_C (0x3f49daf03ef3dc73)),
		       vcreate_f32 (UINT64_C (0x3f5d467a3ef3dc73)));
  val2 = vcombine_f32 (vcreate_f32 (UINT64_C (0x3d2064c83d10cd28)),
		       vcreate_f32 (UINT64_C (0x3ea7d1a23d10cd28)));
  val3 = vcombine_f32 (vcreate_f32 (UINT64_C (0x3f6131993edb1e04)),
		       vcreate_f32 (UINT64_C (0x3f37f4bf3edb1e04)));

  result = vmlsq_laneq_f32 (val1, val2, val3, 0);

  act = vgetq_lane_f32 (result, 0);
  if (act != 0.46116194128990173f)
    abort ();

  act = vgetq_lane_f32 (result, 1);
  if (act != 0.7717385292053223f)
    abort ();

  act = vgetq_lane_f32 (result, 2);
  if (act != 0.46116194128990173f)
    abort ();

  act = vgetq_lane_f32 (result, 3);
  if (act != 0.7240825295448303f)
    abort ();
}

int
main (void)
{
  test1 ();
  test2 ();
  test3 ();
  test4 ();
  test5 ();

  return 0;
}