]>
git.saurik.com Git - apple/dyld.git/blob - unit-tests/test-cases/lazy-binding-reg-params/main.c
2 * Copyright (c) 2005 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
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
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.
21 * @APPLE_LICENSE_HEADER_END@
24 #include <stdio.h> // fprintf(), NULL
25 #include <stdlib.h> // exit(), EXIT_SUCCESS
27 #include <sys/sysctl.h>
29 #include "test.h" // PASS(), FAIL(), XPASS(), XFAIL()
33 /// rdar://problem/4132378 support __attribute__((regparm()))
35 /// The stub binding helper for dyld needs to preserve registers
44 return dointtest(123,456,789,4444,55555);
47 static bool floattest()
49 #if __ppc__ || __ppc64__
50 return dofloattest(1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0,11.0,12.0,13.0);
54 #error unknown architecture
58 static bool vectorSupport()
62 size_t size
=sizeof(uint32_t);
63 int err
= sysctlbyname("hw.optional.altivec", &value
, &size
, NULL
, 0);
64 //fprintf(stderr, "sysctlbyname() = %d\n", err);
72 static bool vectortest()
74 vFloat p1
= { 1.1, 1.2, 1.3, 1.4 };
75 vFloat p2
= { 2.1, 2.2, 2.3, 2.4 };
76 vFloat p3
= { 3.1, 3.2, 3.3, 3.4 };
77 vFloat p4
= { 4.1, 4.2, 4.3, 4.4 };
78 vFloat p5
= { 5.1, 5.2, 5.3, 5.4 };
79 return dovectortest(p1
, p2
, p3
, p4
, p5
);
85 FAIL("lazy-binding-reg-params int parameters");
89 if ( ! floattest() ) {
90 FAIL("lazy-binding-reg-params float parameters");
94 if ( vectorSupport() && ! vectortest() ) {
95 FAIL("lazy-binding-reg-params vector parameters");
99 PASS("lazy-binding-reg-params");