]> git.saurik.com Git - apple/dyld.git/blob - unit-tests/test-cases/lazy-binding-reg-params/foo.c
dyld-95.3.tar.gz
[apple/dyld.git] / unit-tests / test-cases / lazy-binding-reg-params / foo.c
1 /*
2 * Copyright (c) 2005 Apple Computer p1, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23 #include <string.h>
24 #include "foo.h"
25
26
27 #if __i386__
28 __attribute__((regparm(3)))
29 #endif
30 bool dointtest(int p1, int p2, int p3, int p4, int p5)
31 {
32 if ( p1 != 123)
33 return false;
34 if ( p2 != 456)
35 return false;
36 if ( p3 != 789)
37 return false;
38 if ( p4 != 4444)
39 return false;
40 if ( p5 != 55555)
41 return false;
42 return true;
43 }
44
45 #if __ppc__ || __ppc64__
46 bool dofloattest(double p1, double p2, double p3, double p4, double p5, double p6, double p7,
47 double p8, double p9, double p10, double p11, double p12, double p13)
48 {
49 if ( p1 != 1.0 )
50 return false;
51 if ( p2 != 2.0 )
52 return false;
53 if ( p3 != 3.0 )
54 return false;
55 if ( p4 != 4.0 )
56 return false;
57 if ( p5 != 5.0 )
58 return false;
59 if ( p6 != 6.0 )
60 return false;
61 if ( p7 != 7.0 )
62 return false;
63 if ( p8 != 8.0 )
64 return false;
65 if ( p9 != 9.0 )
66 return false;
67 if ( p10 != 10.0)
68 return false;
69 if ( p11 != 11.0)
70 return false;
71 if ( p12 != 12.0)
72 return false;
73 if ( p13 != 13.0)
74 return false;
75 return true;
76 }
77 #endif
78
79
80 static bool comparevFloat(vFloat p1, vFloat p2)
81 {
82 return (memcmp(&p1, &p2, 16) == 0);
83 }
84
85 bool dovectortest(vFloat p1, vFloat p2, vFloat p3, vFloat p4, vFloat p5)
86 {
87 vFloat r1 = { 1.1, 1.2, 1.3, 1.4 };
88 vFloat r2 = { 2.1, 2.2, 2.3, 2.4 };
89 vFloat r3 = { 3.1, 3.2, 3.3, 3.4 };
90 vFloat r4 = { 4.1, 4.2, 4.3, 4.4 };
91 vFloat r5 = { 5.1, 5.2, 5.3, 5.4 };
92
93 if ( !comparevFloat(p1, r1) )
94 return false;
95 if ( !comparevFloat(p2, r2) )
96 return false;
97 if ( !comparevFloat(p3, r3) )
98 return false;
99 if ( !comparevFloat(p4, r4) )
100 return false;
101 if ( !comparevFloat(p5, r5) )
102 return false;
103 return true;
104 }
105
106
107
108