aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/i386/avx10_2-vcvttss2sis-2.c
blob: 0c64922998ac068103c6feb3d144e3e52417ec82 (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
/* { dg-do run } */
/* { dg-options "-O2 -march=x86-64-v3 -mavx10.2-256" } */
/* { dg-require-effective-target avx10_2_256 } */

#define AVX10_2
#define AVX10_SCALAR
#include "avx10-helper.h"
#include <limits.h>

void
TEST (void)
{
  UNION_TYPE (128, ) s;
  int res1;
  long long res2;
  int res1_ref = 0;
  long long res2_ref = 0;
  int i, sign = 1;

  s.a[0] = 2.46;

  res1 = _mm_cvtts_roundss_epi32 (s.x, 8);

  if (s.a[0] > INT_MAX)
    res1_ref = INT_MAX;
  else if (s.a[0] < INT_MIN)
    res1_ref = INT_MIN;
  else
    res1_ref = s.a[0];

  if (res1 != res1_ref)
    abort();

  res1 = _mm_cvtts_ss_epi32 (s.x);

  if (s.a[0] > INT_MAX)
    res1_ref = INT_MAX;
  else if (s.a[0] < INT_MIN)
    res1_ref = INT_MIN;
  else
    res1_ref = s.a[0];

  if (res1 != res1_ref)
    abort();

#ifdef __x86_64__
  res2 = _mm_cvtts_roundss_epi64 (s.x, 8);

  if (s.a[0] > LLONG_MAX)
    res2_ref = LLONG_MAX;
  else if (s.a[0] < LLONG_MIN)
    res2_ref = LLONG_MIN;
  else
    res2_ref = s.a[0];

  if (res2 != res2_ref)
    abort();

  res2 = _mm_cvtts_ss_epi64 (s.x);

  if (s.a[0] > LLONG_MAX)
    res2_ref = LLONG_MAX;
  else if (s.a[0] < LLONG_MIN)
    res2_ref = LLONG_MIN;
  else
    res2_ref = s.a[0];

  if (res2 != res2_ref)
    abort();
#endif
}