aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/aarch64/vabsd_s64.c
blob: a0f88ee12c3ea0269041213899a68f6677d80d42 (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
/* Check that the compiler does not optimise the vabsd_s64 call out.
   We need to check for this because there is a mismatch in semantics
   between the ACLE, which states that he absolute value of the minimum
   (signed) value is itself, and C, where this is undefined behaviour.  */

/* { dg-do run } */
/* { dg-options "--save-temps -fno-inline -O2" } */

#include <arm_neon.h>
#include <limits.h>

extern void abort (void);

int
bar (int64_t x)
{
  if (x < (int64_t) 0)
    return vabsd_s64 (x) < (int64_t) 0;
  else
	return -1;
}

int
main (void)
{
  int ans = 1;
  int res_abs = bar (INT64_MIN);

  if (res_abs != ans)
    abort ();

  return 0;
}