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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.target/] [i386/] [fma_main.h] - Blame information for rev 691

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 691 jeremybenn
 
2
#ifndef fma_main
3
#define fma_main
4
 
5
#if DEBUG
6
#include <stdio.h>
7
#endif
8
 
9
TYPE m1[32] = {
10
                1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16,
11
               17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32
12
              };
13
TYPE m2[32] = {
14
                2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16, 17,
15
               18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33
16
              };
17
TYPE m3[32] = {
18
                3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
19
               19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34
20
              };
21
TYPE m4[32];
22
int test_fails = 0;
23
 
24
void
25
compare_result(char * title, TYPE *res)
26
{
27
  int i;
28
  int good = 1;
29
  for (i =0; i < 32; i++)
30
    if (m4[i] != res[i])
31
      {
32
        if (good)
33
          {
34
#if DEBUG
35
             printf ("!!!! %s miscompare\n", title);
36
#endif
37
             good = 0;
38
          }
39
#if DEBUG
40
        printf ("res[%d] = %d, must be %d\n", i, (int)res[i], (int) m4[i]);
41
#endif
42
      }
43
  if (!good)
44
    test_fails = 1;
45
}
46
 
47
static void fma_test ()
48
{
49
  int i;
50
  for (i=0; i <32; i++)
51
    m4[i] = test_noneg_add_noneg_add (m1[i], m2[i], m3[i]);
52
  compare_result ("test0000", res_test0000);
53
 
54
  for (i=0; i <32; i++)
55
    m4[i] = test_noneg_add_noneg_sub (m1[i], m2[i], m3[i]);
56
  compare_result ("test0001", res_test0001);
57
 
58
  for (i=0; i <32; i++)
59
    m4[i] = test_noneg_add_neg_add (m1[i], m2[i], m3[i]);
60
  compare_result ("test0010", res_test0010);
61
 
62
  for (i=0; i <32; i++)
63
    m4[i] = test_noneg_add_neg_sub (m1[i], m2[i], m3[i]);
64
  compare_result ("test0011", res_test0011);
65
 
66
  for (i=0; i <32; i++)
67
    m4[i] = test_noneg_sub_noneg_add (m1[i], m2[i], m3[i]);
68
  compare_result ("test0100", res_test0100);
69
 
70
  for (i=0; i <32; i++)
71
    m4[i] = test_noneg_sub_noneg_sub (m1[i], m2[i], m3[i]);
72
  compare_result ("test0101", res_test0101);
73
 
74
  for (i=0; i <32; i++)
75
    m4[i] = test_noneg_sub_neg_add (m1[i], m2[i], m3[i]);
76
  compare_result ("test0110", res_test0110);
77
 
78
  for (i=0; i <32; i++)
79
    m4[i] = test_noneg_sub_neg_sub (m1[i], m2[i], m3[i]);
80
  compare_result ("test0111", res_test0111);
81
 
82
  for (i=0; i <32; i++)
83
    m4[i] = test_neg_add_noneg_add (m1[i], m2[i], m3[i]);
84
  compare_result ("test1000", res_test1000);
85
 
86
  for (i=0; i <32; i++)
87
    m4[i] = test_neg_add_noneg_sub (m1[i], m2[i], m3[i]);
88
  compare_result ("test1001", res_test1001);
89
 
90
  for (i=0; i <32; i++)
91
    m4[i] = test_neg_add_neg_add (m1[i], m2[i], m3[i]);
92
  compare_result ("test1010", res_test1010);
93
 
94
  for (i=0; i <32; i++)
95
    m4[i] = test_neg_add_neg_sub (m1[i], m2[i], m3[i]);
96
  compare_result ("test1011", res_test1011);
97
 
98
  for (i=0; i <32; i++)
99
    m4[i] = test_neg_sub_noneg_add (m1[i], m2[i], m3[i]);
100
  compare_result ("test1100", res_test1100);
101
 
102
  for (i=0; i <32; i++)
103
    m4[i] = test_neg_sub_noneg_sub (m1[i], m2[i], m3[i]);
104
  compare_result ("test1101", res_test1101);
105
 
106
  for (i=0; i <32; i++)
107
    m4[i] = test_neg_sub_neg_add (m1[i], m2[i], m3[i]);
108
  compare_result ("test1110", res_test1110);
109
 
110
  for (i=0; i <32; i++)
111
    m4[i] = test_neg_sub_neg_sub (m1[i], m2[i], m3[i]);
112
  compare_result ("test1111", res_test1111);
113
 
114
  if (test_fails) abort ();
115
}
116
 
117
#endif

powered by: WebSVN 2.1.0

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