OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [gcc/] [testsuite/] [gcc.target/] [i386/] [builtin-apply-mmx.c] - Blame information for rev 12

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 12 jlechner
/* __builtin_apply_args () and __builtin_return () built-in functions does
2
   not function properly when -mmmx is used in compile flags.
3
   __builtin_apply_args () saves all registers that pass arguments to a
4
   function, including %mm0-%mm3, to a memory block, and __builtin_return ()
5
   restores %mm0, from a return memory block, as it can be used as a
6
   function return register.  Unfortunatelly, when MMX registers are touched,
7
   i387 FPU switches to MMX mode, and no FP operation is possible until emms
8
   instruction is issued.  */
9
 
10
/* This test case is adapted from gcc.dg/builtin-apply4.c.  */
11
 
12
/* { dg-do run { xfail "*-*-*" } } */
13
/* { dg-options "-O2 -mmmx" } */
14
/* { dg-require-effective-target ilp32 } */
15
 
16
#include "../../gcc.dg/i386-cpuid.h"
17
 
18
extern void abort (void);
19
 
20
double
21
foo (double arg)
22
{
23
  if (arg != 116.0)
24
    abort ();
25
 
26
  return arg + 1.0;
27
}
28
 
29
inline double
30
bar (double arg)
31
{
32
  foo (arg);
33
  __builtin_return (__builtin_apply ((void (*)()) foo,
34
                                     __builtin_apply_args (), 16));
35
}
36
 
37
int
38
main (int argc, char **argv)
39
{
40
  unsigned long cpu_facilities;
41
 
42
  cpu_facilities = i386_cpuid ();
43
 
44
  if (!(cpu_facilities & bit_MMX))
45
    /* If host has no MMX support, pass.  */
46
    return 0;
47
 
48
  if (bar (116.0) != 117.0)
49
    abort ();
50
 
51
  return 0;
52
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.