aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_m64m128_returning.c
blob: cde0346935c9e7049aca90a7efa7c7ec46ba3f91 (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
#include <stdio.h>
#include "defines.h"
#include "macros.h"
#include "args.h"

struct IntegerRegisters iregs;
struct FloatRegisters fregs;
unsigned int num_iregs, num_fregs;

__m64
fun_test_returning___m64 (void)
{
  volatile_var++;
  return (__m64){72,0};
}

__m128
fun_test_returning___m128 (void)
{
  volatile_var++;
  return (__m128){73,0,0,0};
}

__m64 test_64;
__m128 test_128;

int
main (void)
{
  unsigned failed = 0;
  XMM_T xmmt1, xmmt2;

  /* We jump through hoops to compare the results as gcc 3.3 does throw
     an ICE when trying to generate a compare for a == b, when a and b
     are of __m64 or __m128 type :-(  */
  clear_struct_registers;
  test_64 = (__m64){72,0};
  xmmt1._m64[0] = test_64;
  xmmt2._m64[0] = WRAP_RET (fun_test_returning___m64)();
  if (xmmt1._long[0] != xmmt2._long[0]
      || xmmt1._long[0] != xmm_regs[0]._long[0])
    printf ("fail m64\n"), failed++;

  clear_struct_registers;
  test_128 = (__m128){73,0};
  xmmt1._m128[0] = test_128;
  xmmt2._m128[0] = WRAP_RET (fun_test_returning___m128)();
  if (xmmt1._long[0] != xmmt2._long[0]
      || xmmt1._long[0] != xmm_regs[0]._long[0])
    printf ("fail m128\n"), failed++;
  if (failed)
    abort ();
  return 0;
}