]> git.saurik.com Git - apple/dyld.git/blame - unit-tests/test-cases/lazy-binding-reg-params/foo.c
dyld-353.2.1.tar.gz
[apple/dyld.git] / unit-tests / test-cases / lazy-binding-reg-params / foo.c
CommitLineData
9e225d03 1/*
d6f5f96d 2 * Copyright (c) 2005 Apple Computer p1, Inc. All rights reserved.
9e225d03
A
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 */
d6f5f96d
A
23#include <string.h>
24#include "foo.h"
25
9e225d03
A
26
27#if __i386__
28__attribute__((regparm(3)))
29#endif
d6f5f96d 30bool dointtest(int p1, int p2, int p3, int p4, int p5)
9e225d03
A
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
d6f5f96d
A
45#if __ppc__ || __ppc64__
46bool 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
39a8cd10
A
80
81#if __i386__ || __x86_64__ || __ppc__ || __ppc64__
82
d6f5f96d
A
83static bool comparevFloat(vFloat p1, vFloat p2)
84{
85 return (memcmp(&p1, &p2, 16) == 0);
86}
87
88bool dovectortest(vFloat p1, vFloat p2, vFloat p3, vFloat p4, vFloat p5)
89{
90 vFloat r1 = { 1.1, 1.2, 1.3, 1.4 };
91 vFloat r2 = { 2.1, 2.2, 2.3, 2.4 };
92 vFloat r3 = { 3.1, 3.2, 3.3, 3.4 };
93 vFloat r4 = { 4.1, 4.2, 4.3, 4.4 };
94 vFloat r5 = { 5.1, 5.2, 5.3, 5.4 };
95
96 if ( !comparevFloat(p1, r1) )
97 return false;
98 if ( !comparevFloat(p2, r2) )
99 return false;
100 if ( !comparevFloat(p3, r3) )
101 return false;
102 if ( !comparevFloat(p4, r4) )
103 return false;
104 if ( !comparevFloat(p5, r5) )
105 return false;
106 return true;
107}
108
39a8cd10
A
109#endif
110
d6f5f96d
A
111
112
9e225d03 113