This commit is contained in:
attilio 2011-06-04 22:05:20 +00:00
commit 8e66ca1ff1
258 changed files with 2518 additions and 852 deletions

View File

@ -238,7 +238,7 @@ aliascmd(int argc, char **argv)
while ((n = *++argv) != NULL) {
if ((v = strchr(n+1, '=')) == NULL) /* n+1: funny ksh stuff */
if ((ap = lookupalias(n, 0)) == NULL) {
warning("%s not found", n);
warning("%s: not found", n);
ret = 1;
} else
printalias(ap);

View File

@ -165,7 +165,7 @@ evalstring(char *s, int flags)
setstackmark(&smark);
setinputstring(s, 1);
while ((n = parsecmd(0)) != NEOF) {
if (n != NULL) {
if (n != NULL && !nflag) {
if (flags_exit && preadateof())
evaltree(n, flags | EV_EXIT);
else

View File

@ -403,7 +403,7 @@ setinputfile(const char *fname, int push)
INTOFF;
if ((fd = open(fname, O_RDONLY)) < 0)
error("Can't open %s: %s", fname, strerror(errno));
error("cannot open %s: %s", fname, strerror(errno));
if (fd < 10) {
fd2 = fcntl(fd, F_DUPFD, 10);
close(fd);

View File

@ -820,7 +820,7 @@ forkshell(struct job *jp, union node *n, int mode)
! fd0_redirected_p ()) {
close(0);
if (open(_PATH_DEVNULL, O_RDONLY) != 0)
error("Can't open %s: %s",
error("cannot open %s: %s",
_PATH_DEVNULL, strerror(errno));
}
}
@ -832,7 +832,7 @@ forkshell(struct job *jp, union node *n, int mode)
! fd0_redirected_p ()) {
close(0);
if (open(_PATH_DEVNULL, O_RDONLY) != 0)
error("Can't open %s: %s",
error("cannot open %s: %s",
_PATH_DEVNULL, strerror(errno));
}
}

View File

@ -264,7 +264,7 @@ readcmdfile(const char *name)
if ((fd = open(name, O_RDONLY)) >= 0)
setinputfd(fd, 1);
else
error("Can't open %s: %s", name, strerror(errno));
error("cannot open %s: %s", name, strerror(errno));
INTON;
cmdloop(0);
popfile();

View File

@ -19,3 +19,6 @@ W: http://www.auroraux.org
D: CMake'ify Compiler-RT build system
D: Maintain Solaris & AuroraUX ports of Compiler-RT
N: Howard Hinnant
E: hhinnant@apple.com
D: Architect and primary author of compiler-rt

View File

@ -1,10 +1,21 @@
==============================================================================
LLVM Release License
compiler_rt License
==============================================================================
The compiler_rt library is dual licensed under both the University of Illinois
"BSD-Like" license and the MIT license. As a user of this code you may choose
to use it under either license. As a contributor, you agree to allow your code
to be used under both.
Full text of the relevant licenses is included below.
==============================================================================
University of Illinois/NCSA
Open Source License
Copyright (c) 2003-2009 University of Illinois at Urbana-Champaign.
Copyright (c) 2009-2010 by the contributors listed in CREDITS.TXT
All rights reserved.
Developed by:
@ -43,21 +54,23 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
SOFTWARE.
==============================================================================
Copyrights and Licenses for Third Party Software Distributed with LLVM:
==============================================================================
The LLVM software contains code written by third parties. Such software will
have its own individual LICENSE.TXT file in the directory in which it appears.
This file will describe the copyrights, license, and restrictions which apply
to that code.
The disclaimer of warranty in the University of Illinois Open Source License
applies to all code in the LLVM Distribution, and nothing in any of the
other licenses gives permission to use the names of the LLVM Team or the
University of Illinois to endorse or promote products derived from this
Software.
Copyright (c) 2009-2010 by the contributors listed in CREDITS.TXT
The following pieces of software have additional or alternate copyrights,
licenses, and/or restrictions:
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Program Directory
------- ---------
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -77,8 +77,12 @@ ti_int __modti3 (ti_int a, ti_int b); // a % b signed
su_int __umodsi3 (su_int a, su_int b); // a % b unsigned
du_int __umoddi3 (du_int a, du_int b); // a % b unsigned
tu_int __umodti3 (tu_int a, tu_int b); // a % b unsigned
du_int __udivmoddi4(du_int a, du_int b, du_int* rem); // a / b, *rem = a % b
tu_int __udivmodti4(tu_int a, tu_int b, tu_int* rem); // a / b, *rem = a % b
du_int __udivmoddi4(du_int a, du_int b, du_int* rem); // a / b, *rem = a % b unsigned
tu_int __udivmodti4(tu_int a, tu_int b, tu_int* rem); // a / b, *rem = a % b unsigned
su_int __udivmodsi4(su_int a, su_int b, su_int* rem); // a / b, *rem = a % b unsigned
si_int __divmodsi4(si_int a, si_int b, si_int* rem); // a / b, *rem = a % b signed
// Integral arithmetic with trapping overflow

View File

@ -0,0 +1,23 @@
/* ===------ abi.h - configuration header for compiler-rt -----------------===
*
* The LLVM Compiler Infrastructure
*
* This file is dual licensed under the MIT and the University of Illinois Open
* Source Licenses. See LICENSE.TXT for details.
*
* ===----------------------------------------------------------------------===
*
* This file is a configuration header for compiler-rt.
* This file is not part of the interface of this library.
*
* ===----------------------------------------------------------------------===
*/
#if __ARM_EABI__
# define ARM_EABI_FNALIAS(aeabi_name, name) \
void __aeabi_##aeabi_name() __attribute__((alias("__" #name)));
# define COMPILER_RT_ABI __attribute__((pcs("aapcs")))
#else
# define ARM_EABI_FNALIAS(aeabi_name, name)
# define COMPILER_RT_ABI
#endif

View File

@ -2,8 +2,8 @@
*
* The LLVM Compiler Infrastructure
*
* This file is distributed under the University of Illinois Open Source
* License. See LICENSE.TXT for details.
* This file is dual licensed under the MIT and the University of Illinois Open
* Source Licenses. See LICENSE.TXT for details.
*
*===----------------------------------------------------------------------===
*
@ -11,6 +11,7 @@
*
*===----------------------------------------------------------------------===
*/
#include "abi.h"
#include "int_lib.h"
#include <stdlib.h>
@ -19,7 +20,7 @@
/* Effects: aborts if abs(x) < 0 */
di_int
COMPILER_RT_ABI di_int
__absvdi2(di_int a)
{
const int N = (int)(sizeof(di_int) * CHAR_BIT);

View File

@ -2,15 +2,16 @@
*
* The LLVM Compiler Infrastructure
*
* This file is distributed under the University of Illinois Open Source
* License. See LICENSE.TXT for details.
* This file is dual licensed under the MIT and the University of Illinois Open
* Source Licenses. See LICENSE.TXT for details.
*
* ===----------------------------------------------------------------------===
*
* This file implements __absvsi2 for the compiler_rt library.
*
* ===----------------------------------------------------------------------===
*/
*/
#include "abi.h"
#include "int_lib.h"
#include <stdlib.h>
@ -19,7 +20,7 @@
/* Effects: aborts if abs(x) < 0 */
si_int
COMPILER_RT_ABI si_int
__absvsi2(si_int a)
{
const int N = (int)(sizeof(si_int) * CHAR_BIT);

View File

@ -2,8 +2,8 @@
*
* The LLVM Compiler Infrastructure
*
* This file is distributed under the University of Illinois Open Source
* License. See LICENSE.TXT for details.
* This file is dual licensed under the MIT and the University of Illinois Open
* Source Licenses. See LICENSE.TXT for details.
*
* ===----------------------------------------------------------------------===
*

View File

@ -1,21 +1,26 @@
//===-- lib/adddf3.c - Double-precision addition and subtraction --*- C -*-===//
//===-- lib/adddf3.c - Double-precision addition ------------------*- C -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file implements double-precision soft-float addition and subtraction
// with the IEEE-754 default rounding (to nearest, ties to even).
// This file implements double-precision soft-float addition with the IEEE-754
// default rounding (to nearest, ties to even).
//
//===----------------------------------------------------------------------===//
#include "abi.h"
#define DOUBLE_PRECISION
#include "fp_lib.h"
fp_t __adddf3(fp_t a, fp_t b) {
ARM_EABI_FNALIAS(dadd, adddf3);
COMPILER_RT_ABI fp_t
__adddf3(fp_t a, fp_t b) {
rep_t aRep = toRep(a);
rep_t bRep = toRep(b);
@ -147,8 +152,3 @@ fp_t __adddf3(fp_t a, fp_t b) {
if (roundGuardSticky == 0x4) result += result & 1;
return fromRep(result);
}
// Subtraction; flip the sign bit of b and add.
fp_t __subdf3(fp_t a, fp_t b) {
return __adddf3(a, fromRep(toRep(b) ^ signBit));
}

View File

@ -1,20 +1,24 @@
//===-- lib/addsf3.c - Single-precision addition and subtraction --*- C -*-===//
//===-- lib/addsf3.c - Single-precision addition ------------------*- C -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file implements single-precision soft-float addition and subtraction
// with the IEEE-754 default rounding (to nearest, ties to even).
// This file implements single-precision soft-float addition with the IEEE-754
// default rounding (to nearest, ties to even).
//
//===----------------------------------------------------------------------===//
#include "abi.h"
#define SINGLE_PRECISION
#include "fp_lib.h"
ARM_EABI_FNALIAS(fadd, addsf3);
fp_t __addsf3(fp_t a, fp_t b) {
rep_t aRep = toRep(a);
@ -147,18 +151,3 @@ fp_t __addsf3(fp_t a, fp_t b) {
if (roundGuardSticky == 0x4) result += result & 1;
return fromRep(result);
}
// Subtraction; flip the sign bit of b and add.
fp_t __subsf3(fp_t a, fp_t b) {
return __addsf3(a, fromRep(toRep(b) ^ signBit));
}

View File

@ -2,8 +2,8 @@
*
* The LLVM Compiler Infrastructure
*
* This file is distributed under the University of Illinois Open Source
* License. See LICENSE.TXT for details.
* This file is dual licensed under the MIT and the University of Illinois Open
* Source Licenses. See LICENSE.TXT for details.
*
* ===----------------------------------------------------------------------===
*
@ -11,6 +11,7 @@
*
* ===----------------------------------------------------------------------===
*/
#include "abi.h"
#include "int_lib.h"
#include <stdlib.h>
@ -19,7 +20,7 @@
/* Effects: aborts if a + b overflows */
di_int
COMPILER_RT_ABI di_int
__addvdi3(di_int a, di_int b)
{
di_int s = a + b;

View File

@ -2,8 +2,8 @@
*
* The LLVM Compiler Infrastructure
*
* This file is distributed under the University of Illinois Open Source
* License. See LICENSE.TXT for details.
* This file is dual licensed under the MIT and the University of Illinois Open
* Source Licenses. See LICENSE.TXT for details.
*
* ===----------------------------------------------------------------------===
*
@ -11,6 +11,7 @@
*
* ===----------------------------------------------------------------------===
*/
#include "abi.h"
#include "int_lib.h"
#include <stdlib.h>
@ -19,7 +20,7 @@
/* Effects: aborts if a + b overflows */
si_int
COMPILER_RT_ABI si_int
__addvsi3(si_int a, si_int b)
{
si_int s = a + b;

View File

@ -2,8 +2,8 @@
*
* The LLVM Compiler Infrastructure
*
* This file is distributed under the University of Illinois Open Source
* License. See LICENSE.TXT for details.
* This file is dual licensed under the MIT and the University of Illinois Open
* Source Licenses. See LICENSE.TXT for details.
*
* ===----------------------------------------------------------------------===
*

View File

@ -2,8 +2,8 @@
*
* The LLVM Compiler Infrastructure
*
* This file is distributed under the University of Illinois Open Source
* License. See LICENSE.TXT for details.
* This file is dual licensed under the MIT and the University of Illinois Open
* Source Licenses. See LICENSE.TXT for details.
*
* ===----------------------------------------------------------------------===
*/
@ -143,6 +143,147 @@ NOT_HERE_BEFORE_10_6(__gcc_qsub)
NOT_HERE_BEFORE_10_6(__trampoline_setup)
#endif /* __ppc__ */
#if __arm__ && __DYNAMIC__
#define NOT_HERE_UNTIL_AFTER_4_3(sym) \
extern const char sym##_tmp1 __asm("$ld$hide$os3.0$_" #sym ); \
__attribute__((visibility("default"))) const char sym##_tmp1 = 0; \
extern const char sym##_tmp2 __asm("$ld$hide$os3.1$_" #sym ); \
__attribute__((visibility("default"))) const char sym##_tmp2 = 0; \
extern const char sym##_tmp3 __asm("$ld$hide$os3.2$_" #sym ); \
__attribute__((visibility("default"))) const char sym##_tmp3 = 0; \
extern const char sym##_tmp4 __asm("$ld$hide$os4.0$_" #sym ); \
__attribute__((visibility("default"))) const char sym##_tmp4 = 0; \
extern const char sym##_tmp5 __asm("$ld$hide$os4.1$_" #sym ); \
__attribute__((visibility("default"))) const char sym##_tmp5 = 0; \
extern const char sym##_tmp6 __asm("$ld$hide$os4.2$_" #sym ); \
__attribute__((visibility("default"))) const char sym##_tmp6 = 0; \
extern const char sym##_tmp7 __asm("$ld$hide$os4.3$_" #sym ); \
__attribute__((visibility("default"))) const char sym##_tmp7 = 0;
NOT_HERE_UNTIL_AFTER_4_3(__absvdi2)
NOT_HERE_UNTIL_AFTER_4_3(__absvsi2)
NOT_HERE_UNTIL_AFTER_4_3(__adddf3)
NOT_HERE_UNTIL_AFTER_4_3(__adddf3vfp)
NOT_HERE_UNTIL_AFTER_4_3(__addsf3)
NOT_HERE_UNTIL_AFTER_4_3(__addsf3vfp)
NOT_HERE_UNTIL_AFTER_4_3(__addvdi3)
NOT_HERE_UNTIL_AFTER_4_3(__addvsi3)
NOT_HERE_UNTIL_AFTER_4_3(__ashldi3)
NOT_HERE_UNTIL_AFTER_4_3(__ashrdi3)
NOT_HERE_UNTIL_AFTER_4_3(__bswapdi2)
NOT_HERE_UNTIL_AFTER_4_3(__bswapsi2)
NOT_HERE_UNTIL_AFTER_4_3(__clzdi2)
NOT_HERE_UNTIL_AFTER_4_3(__clzsi2)
NOT_HERE_UNTIL_AFTER_4_3(__cmpdi2)
NOT_HERE_UNTIL_AFTER_4_3(__ctzdi2)
NOT_HERE_UNTIL_AFTER_4_3(__ctzsi2)
NOT_HERE_UNTIL_AFTER_4_3(__divdc3)
NOT_HERE_UNTIL_AFTER_4_3(__divdf3)
NOT_HERE_UNTIL_AFTER_4_3(__divdf3vfp)
NOT_HERE_UNTIL_AFTER_4_3(__divdi3)
NOT_HERE_UNTIL_AFTER_4_3(__divsc3)
NOT_HERE_UNTIL_AFTER_4_3(__divsf3)
NOT_HERE_UNTIL_AFTER_4_3(__divsf3vfp)
NOT_HERE_UNTIL_AFTER_4_3(__divsi3)
NOT_HERE_UNTIL_AFTER_4_3(__eqdf2)
NOT_HERE_UNTIL_AFTER_4_3(__eqdf2vfp)
NOT_HERE_UNTIL_AFTER_4_3(__eqsf2)
NOT_HERE_UNTIL_AFTER_4_3(__eqsf2vfp)
NOT_HERE_UNTIL_AFTER_4_3(__extendsfdf2)
NOT_HERE_UNTIL_AFTER_4_3(__extendsfdf2vfp)
NOT_HERE_UNTIL_AFTER_4_3(__ffsdi2)
NOT_HERE_UNTIL_AFTER_4_3(__fixdfdi)
NOT_HERE_UNTIL_AFTER_4_3(__fixdfsi)
NOT_HERE_UNTIL_AFTER_4_3(__fixdfsivfp)
NOT_HERE_UNTIL_AFTER_4_3(__fixsfdi)
NOT_HERE_UNTIL_AFTER_4_3(__fixsfsi)
NOT_HERE_UNTIL_AFTER_4_3(__fixsfsivfp)
NOT_HERE_UNTIL_AFTER_4_3(__fixunsdfdi)
NOT_HERE_UNTIL_AFTER_4_3(__fixunsdfsi)
NOT_HERE_UNTIL_AFTER_4_3(__fixunsdfsivfp)
NOT_HERE_UNTIL_AFTER_4_3(__fixunssfdi)
NOT_HERE_UNTIL_AFTER_4_3(__fixunssfsi)
NOT_HERE_UNTIL_AFTER_4_3(__fixunssfsivfp)
NOT_HERE_UNTIL_AFTER_4_3(__floatdidf)
NOT_HERE_UNTIL_AFTER_4_3(__floatdisf)
NOT_HERE_UNTIL_AFTER_4_3(__floatsidf)
NOT_HERE_UNTIL_AFTER_4_3(__floatsidfvfp)
NOT_HERE_UNTIL_AFTER_4_3(__floatsisf)
NOT_HERE_UNTIL_AFTER_4_3(__floatsisfvfp)
NOT_HERE_UNTIL_AFTER_4_3(__floatundidf)
NOT_HERE_UNTIL_AFTER_4_3(__floatundisf)
NOT_HERE_UNTIL_AFTER_4_3(__floatunsidf)
NOT_HERE_UNTIL_AFTER_4_3(__floatunsisf)
NOT_HERE_UNTIL_AFTER_4_3(__floatunssidfvfp)
NOT_HERE_UNTIL_AFTER_4_3(__floatunssisfvfp)
NOT_HERE_UNTIL_AFTER_4_3(__gedf2)
NOT_HERE_UNTIL_AFTER_4_3(__gedf2vfp)
NOT_HERE_UNTIL_AFTER_4_3(__gesf2)
NOT_HERE_UNTIL_AFTER_4_3(__gesf2vfp)
NOT_HERE_UNTIL_AFTER_4_3(__gtdf2)
NOT_HERE_UNTIL_AFTER_4_3(__gtdf2vfp)
NOT_HERE_UNTIL_AFTER_4_3(__gtsf2)
NOT_HERE_UNTIL_AFTER_4_3(__gtsf2vfp)
NOT_HERE_UNTIL_AFTER_4_3(__ledf2)
NOT_HERE_UNTIL_AFTER_4_3(__ledf2vfp)
NOT_HERE_UNTIL_AFTER_4_3(__lesf2)
NOT_HERE_UNTIL_AFTER_4_3(__lesf2vfp)
NOT_HERE_UNTIL_AFTER_4_3(__lshrdi3)
NOT_HERE_UNTIL_AFTER_4_3(__ltdf2)
NOT_HERE_UNTIL_AFTER_4_3(__ltdf2vfp)
NOT_HERE_UNTIL_AFTER_4_3(__ltsf2)
NOT_HERE_UNTIL_AFTER_4_3(__ltsf2vfp)
NOT_HERE_UNTIL_AFTER_4_3(__moddi3)
NOT_HERE_UNTIL_AFTER_4_3(__modsi3)
NOT_HERE_UNTIL_AFTER_4_3(__muldc3)
NOT_HERE_UNTIL_AFTER_4_3(__muldf3)
NOT_HERE_UNTIL_AFTER_4_3(__muldf3vfp)
NOT_HERE_UNTIL_AFTER_4_3(__muldi3)
NOT_HERE_UNTIL_AFTER_4_3(__mulsc3)
NOT_HERE_UNTIL_AFTER_4_3(__mulsf3)
NOT_HERE_UNTIL_AFTER_4_3(__mulsf3vfp)
NOT_HERE_UNTIL_AFTER_4_3(__mulvdi3)
NOT_HERE_UNTIL_AFTER_4_3(__mulvsi3)
NOT_HERE_UNTIL_AFTER_4_3(__nedf2)
NOT_HERE_UNTIL_AFTER_4_3(__nedf2vfp)
NOT_HERE_UNTIL_AFTER_4_3(__negdi2)
NOT_HERE_UNTIL_AFTER_4_3(__negvdi2)
NOT_HERE_UNTIL_AFTER_4_3(__negvsi2)
NOT_HERE_UNTIL_AFTER_4_3(__nesf2)
NOT_HERE_UNTIL_AFTER_4_3(__nesf2vfp)
NOT_HERE_UNTIL_AFTER_4_3(__paritydi2)
NOT_HERE_UNTIL_AFTER_4_3(__paritysi2)
NOT_HERE_UNTIL_AFTER_4_3(__popcountdi2)
NOT_HERE_UNTIL_AFTER_4_3(__popcountsi2)
NOT_HERE_UNTIL_AFTER_4_3(__powidf2)
NOT_HERE_UNTIL_AFTER_4_3(__powisf2)
NOT_HERE_UNTIL_AFTER_4_3(__subdf3)
NOT_HERE_UNTIL_AFTER_4_3(__subdf3vfp)
NOT_HERE_UNTIL_AFTER_4_3(__subsf3)
NOT_HERE_UNTIL_AFTER_4_3(__subsf3vfp)
NOT_HERE_UNTIL_AFTER_4_3(__subvdi3)
NOT_HERE_UNTIL_AFTER_4_3(__subvsi3)
NOT_HERE_UNTIL_AFTER_4_3(__truncdfsf2)
NOT_HERE_UNTIL_AFTER_4_3(__truncdfsf2vfp)
NOT_HERE_UNTIL_AFTER_4_3(__ucmpdi2)
NOT_HERE_UNTIL_AFTER_4_3(__udivdi3)
NOT_HERE_UNTIL_AFTER_4_3(__udivmoddi4)
NOT_HERE_UNTIL_AFTER_4_3(__udivsi3)
NOT_HERE_UNTIL_AFTER_4_3(__umoddi3)
NOT_HERE_UNTIL_AFTER_4_3(__umodsi3)
NOT_HERE_UNTIL_AFTER_4_3(__unorddf2)
NOT_HERE_UNTIL_AFTER_4_3(__unorddf2vfp)
NOT_HERE_UNTIL_AFTER_4_3(__unordsf2)
NOT_HERE_UNTIL_AFTER_4_3(__unordsf2vfp)
NOT_HERE_UNTIL_AFTER_4_3(__divmodsi4)
NOT_HERE_UNTIL_AFTER_4_3(__udivmodsi4)
#endif // __arm__ && __DYNAMIC__
#else /* !__APPLE__ */
extern int avoid_empty_file;

View File

@ -2,8 +2,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@ -2,8 +2,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@ -2,8 +2,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@ -2,8 +2,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@ -2,8 +2,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//

View File

@ -2,8 +2,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@ -0,0 +1,47 @@
/*===-- divmodsi4.S - 32-bit signed integer divide and modulus ------------===//
*
* The LLVM Compiler Infrastructure
*
* This file is dual licensed under the MIT and the University of Illinois Open
* Source Licenses. See LICENSE.TXT for details.
*
*===----------------------------------------------------------------------===//
*
* This file implements the __divmodsi4 (32-bit signed integer divide and
* modulus) function for the ARM architecture. A naive digit-by-digit
* computation is employed for simplicity.
*
*===----------------------------------------------------------------------===*/
#include "../assembly.h"
#define ESTABLISH_FRAME \
push {r4-r7, lr} ;\
add r7, sp, #12
#define CLEAR_FRAME_AND_RETURN \
pop {r4-r7, pc}
.syntax unified
.align 3
DEFINE_COMPILERRT_FUNCTION(__divmodsi4)
ESTABLISH_FRAME
// Set aside the sign of the quotient and modulus, and the address for the
// modulus.
eor r4, r0, r1
mov r5, r0
mov r6, r2
// Take the absolute value of a and b via abs(x) = (x^(x >> 31)) - (x >> 31).
eor ip, r0, r0, asr #31
eor lr, r1, r1, asr #31
sub r0, ip, r0, asr #31
sub r1, lr, r1, asr #31
// Unsigned divmod:
bl SYMBOL_NAME(__udivmodsi4)
// Apply the sign of quotient and modulus
ldr r1, [r6]
eor r0, r0, r4, asr #31
eor r1, r1, r5, asr #31
sub r0, r0, r4, asr #31
sub r1, r1, r5, asr #31
str r1, [r6]
CLEAR_FRAME_AND_RETURN

View File

@ -2,8 +2,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@ -0,0 +1,41 @@
/*===-- divsi3.S - 32-bit signed integer divide ---------------------------===//
*
* The LLVM Compiler Infrastructure
*
* This file is dual licensed under the MIT and the University of Illinois Open
* Source Licenses. See LICENSE.TXT for details.
*
*===----------------------------------------------------------------------===//
*
* This file implements the __divsi3 (32-bit signed integer divide) function
* for the ARM architecture as a wrapper around the unsigned routine.
*
*===----------------------------------------------------------------------===*/
#include "../assembly.h"
#define ESTABLISH_FRAME \
push {r4, r7, lr} ;\
add r7, sp, #4
#define CLEAR_FRAME_AND_RETURN \
pop {r4, r7, pc}
.syntax unified
.align 3
// Ok, APCS and AAPCS agree on 32 bit args, so it's safe to use the same routine.
DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_idiv, __divsi3)
DEFINE_COMPILERRT_FUNCTION(__divsi3)
ESTABLISH_FRAME
// Set aside the sign of the quotient.
eor r4, r0, r1
// Take absolute value of a and b via abs(x) = (x^(x >> 31)) - (x >> 31).
eor r2, r0, r0, asr #31
eor r3, r1, r1, asr #31
sub r0, r2, r0, asr #31
sub r1, r3, r1, asr #31
// abs(a) / abs(b)
bl SYMBOL_NAME(__udivsi3)
// Apply sign of quotient to result and return.
eor r0, r0, r4, asr #31
sub r0, r0, r4, asr #31
CLEAR_FRAME_AND_RETURN

View File

@ -2,8 +2,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@ -2,8 +2,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@ -2,8 +2,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@ -2,8 +2,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@ -2,8 +2,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@ -2,8 +2,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@ -2,8 +2,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@ -2,8 +2,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@ -2,8 +2,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@ -2,8 +2,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@ -2,8 +2,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@ -2,8 +2,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@ -2,8 +2,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@ -2,8 +2,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@ -2,8 +2,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@ -2,8 +2,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@ -2,8 +2,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@ -2,8 +2,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@ -2,8 +2,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@ -1,36 +1,39 @@
//===-------- modsi3.S - Implement modsi3 ---------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
/*===-- modsi3.S - 32-bit signed integer modulus --------------------------===//
*
* The LLVM Compiler Infrastructure
*
* This file is dual licensed under the MIT and the University of Illinois Open
* Source Licenses. See LICENSE.TXT for details.
*
*===----------------------------------------------------------------------===//
*
* This file implements the __modsi3 (32-bit signed integer modulus) function
* for the ARM architecture as a wrapper around the unsigned routine.
*
*===----------------------------------------------------------------------===*/
#include "../assembly.h"
//
// extern int32_t __modsi3(int32_t a, int32_t b);
//
// Returns the remainder when dividing two 32-bit signed integers.
// Conceptually, the function is: { return a - (a / b) * b; }
// But if you write that in C, llvm compiles it to a call to __modsi3...
//
.align 2
#define ESTABLISH_FRAME \
push {r4, r7, lr} ;\
add r7, sp, #4
#define CLEAR_FRAME_AND_RETURN \
pop {r4, r7, pc}
.syntax unified
.align 3
DEFINE_COMPILERRT_FUNCTION(__modsi3)
push {r4, r5, r7, lr}
add r7, sp, #8 // set stack frame
mov r5, r0 // save a
mov r4, r1 // save b
bl ___divsi3 // compute a/b
#if __ARM_ARCH_7A__
mls r0, r4, r0, r5 // mulitple result * b and subtract from a
#else
// before armv7, does not have "mls" instruction
mul r3, r0, r4 // multiple result * b
sub r0, r5, r3 // a - result
#endif
pop {r4, r5, r7, pc}
ESTABLISH_FRAME
// Set aside the sign of the dividend.
mov r4, r0
// Take absolute value of a and b via abs(x) = (x^(x >> 31)) - (x >> 31).
eor r2, r0, r0, asr #31
eor r3, r1, r1, asr #31
sub r0, r2, r0, asr #31
sub r1, r3, r1, asr #31
// abs(a) % abs(b)
bl SYMBOL_NAME(__umodsi3)
// Apply sign of dividend to result and return.
eor r0, r0, r4, asr #31
sub r0, r0, r4, asr #31
CLEAR_FRAME_AND_RETURN

View File

@ -2,8 +2,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@ -2,8 +2,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@ -2,8 +2,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@ -2,8 +2,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@ -2,8 +2,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@ -2,8 +2,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@ -2,8 +2,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@ -2,8 +2,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@ -0,0 +1,21 @@
#
# These are soft float functions which can be
# aliased to the *vfp functions on arm processors
# that support floating point instructions.
#
___adddf3vfp ___adddf3
___addsf3vfp ___addsf3
___divdf3vfp ___divdf3
___divsf3vfp ___divsf3
___extendsfdf2vfp ___extendsfdf2
___fixdfsivfp ___fixdfsi
___fixsfsivfp ___fixsfsi
___floatsidfvfp ___floatsidf
___floatsisfvfp ___floatsisf
___muldf3vfp ___muldf3
___mulsf3vfp ___mulsf3
___subdf3vfp ___subdf3
___subsf3vfp ___subsf3
___truncdfsf2vfp ___truncdfsf2
___floatunssidfvfp ___floatunsidf
___floatunssisfvfp ___floatunsisf

View File

@ -2,8 +2,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@ -2,8 +2,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@ -2,8 +2,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@ -2,8 +2,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@ -2,8 +2,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@ -2,8 +2,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@ -2,8 +2,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@ -2,8 +2,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@ -0,0 +1,80 @@
/*===-- udivmodsi4.S - 32-bit unsigned integer divide and modulus ---------===//
*
* The LLVM Compiler Infrastructure
*
* This file is dual licensed under the MIT and the University of Illinois Open
* Source Licenses. See LICENSE.TXT for details.
*
*===----------------------------------------------------------------------===//
*
* This file implements the __udivmodsi4 (32-bit unsigned integer divide and
* modulus) function for the ARM architecture. A naive digit-by-digit
* computation is employed for simplicity.
*
*===----------------------------------------------------------------------===*/
#include "../assembly.h"
#define ESTABLISH_FRAME \
push {r4, r7, lr} ;\
add r7, sp, #4
#define CLEAR_FRAME_AND_RETURN \
pop {r4, r7, pc}
#define a r0
#define b r1
#define i r3
#define r r4
#define q ip
#define one lr
.syntax unified
.align 3
DEFINE_COMPILERRT_FUNCTION(__udivmodsi4)
// We use a simple digit by digit algorithm; before we get into the actual
// divide loop, we must calculate the left-shift amount necessary to align
// the MSB of the divisor with that of the dividend (If this shift is
// negative, then the result is zero, and we early out). We also conjure a
// bit mask of 1 to use in constructing the quotient, and initialize the
// quotient to zero.
ESTABLISH_FRAME
clz r4, a
tst b, b // detect divide-by-zero
clz r3, b
mov q, #0
beq LOCAL_LABEL(return) // return 0 if b is zero.
mov one, #1
subs i, r3, r4
blt LOCAL_LABEL(return) // return 0 if MSB(a) < MSB(b)
LOCAL_LABEL(mainLoop):
// This loop basically implements the following:
//
// do {
// if (a >= b << i) {
// a -= b << i;
// q |= 1 << i;
// if (a == 0) break;
// }
// } while (--i)
//
// Note that this does not perform the final iteration (i == 0); by doing it
// this way, we can merge the two branches which is a substantial win for
// such a tight loop on current ARM architectures.
subs r, a, b, lsl i
orrhs q, q,one, lsl i
movhs a, r
subsne i, i, #1
bhi LOCAL_LABEL(mainLoop)
// Do the final test subtraction and update of quotient (i == 0), as it is
// not performed in the main loop.
subs r, a, b
orrhs q, #1
movhs a, r
LOCAL_LABEL(return):
// Store the remainder, and move the quotient to r0, then return.
str a, [r2]
mov r0, q
CLEAR_FRAME_AND_RETURN

View File

@ -0,0 +1,80 @@
/*===-- udivsi3.S - 32-bit unsigned integer divide ------------------------===//
*
* The LLVM Compiler Infrastructure
*
* This file is dual licensed under the MIT and the University of Illinois Open
* Source Licenses. See LICENSE.TXT for details.
*
*===----------------------------------------------------------------------===//
*
* This file implements the __udivsi3 (32-bit unsigned integer divide)
* function for the ARM architecture. A naive digit-by-digit computation is
* employed for simplicity.
*
*===----------------------------------------------------------------------===*/
#include "../assembly.h"
#define ESTABLISH_FRAME \
push {r7, lr} ;\
mov r7, sp
#define CLEAR_FRAME_AND_RETURN \
pop {r7, pc}
#define a r0
#define b r1
#define r r2
#define i r3
#define q ip
#define one lr
.syntax unified
.align 3
// Ok, APCS and AAPCS agree on 32 bit args, so it's safe to use the same routine.
DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_uidiv, __udivsi3)
DEFINE_COMPILERRT_FUNCTION(__udivsi3)
// We use a simple digit by digit algorithm; before we get into the actual
// divide loop, we must calculate the left-shift amount necessary to align
// the MSB of the divisor with that of the dividend (If this shift is
// negative, then the result is zero, and we early out). We also conjure a
// bit mask of 1 to use in constructing the quotient, and initialize the
// quotient to zero.
ESTABLISH_FRAME
clz r2, a
tst b, b // detect divide-by-zero
clz r3, b
mov q, #0
beq LOCAL_LABEL(return) // return 0 if b is zero.
mov one, #1
subs i, r3, r2
blt LOCAL_LABEL(return) // return 0 if MSB(a) < MSB(b)
LOCAL_LABEL(mainLoop):
// This loop basically implements the following:
//
// do {
// if (a >= b << i) {
// a -= b << i;
// q |= 1 << i;
// if (a == 0) break;
// }
// } while (--i)
//
// Note that this does not perform the final iteration (i == 0); by doing it
// this way, we can merge the two branches which is a substantial win for
// such a tight loop on current ARM architectures.
subs r, a, b, lsl i
orrhs q, q,one, lsl i
movhs a, r
subsne i, i, #1
bhi LOCAL_LABEL(mainLoop)
// Do the final test subtraction and update of quotient (i == 0), as it is
// not performed in the main loop.
subs r, a, b
orrhs q, #1
LOCAL_LABEL(return):
// Move the quotient to r0 and return.
mov r0, q
CLEAR_FRAME_AND_RETURN

View File

@ -0,0 +1,58 @@
/*===-- umodsi3.S - 32-bit unsigned integer modulus -----------------------===//
*
* The LLVM Compiler Infrastructure
*
* This file is dual licensed under the MIT and the University of Illinois Open
* Source Licenses. See LICENSE.TXT for details.
*
*===----------------------------------------------------------------------===//
*
* This file implements the __umodsi3 (32-bit unsigned integer modulus)
* function for the ARM architecture. A naive digit-by-digit computation is
* employed for simplicity.
*
*===----------------------------------------------------------------------===*/
#include "../assembly.h"
#define a r0
#define b r1
#define r r2
#define i r3
.syntax unified
.align 3
DEFINE_COMPILERRT_FUNCTION(__umodsi3)
// We use a simple digit by digit algorithm; before we get into the actual
// divide loop, we must calculate the left-shift amount necessary to align
// the MSB of the divisor with that of the dividend.
clz r2, a
tst b, b // detect b == 0
clz r3, b
bxeq lr // return a if b == 0
subs i, r3, r2
bxlt lr // return a if MSB(a) < MSB(b)
LOCAL_LABEL(mainLoop):
// This loop basically implements the following:
//
// do {
// if (a >= b << i) {
// a -= b << i;
// if (a == 0) break;
// }
// } while (--i)
//
// Note that this does not perform the final iteration (i == 0); by doing it
// this way, we can merge the two branches which is a substantial win for
// such a tight loop on current ARM architectures.
subs r, a, b, lsl i
movhs a, r
subsne i, i, #1
bhi LOCAL_LABEL(mainLoop)
// Do the final test subtraction and update of remainder (i == 0), as it is
// not performed in the main loop.
subs r, a, b
movhs a, r
bx lr

View File

@ -2,8 +2,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@ -2,8 +2,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@ -2,8 +2,8 @@
*
* The LLVM Compiler Infrastructure
*
* This file is distributed under the University of Illinois Open Source
* License. See LICENSE.TXT for details.
* This file is dual licensed under the MIT and the University of Illinois Open
* Source Licenses. See LICENSE.TXT for details.
*
* ===----------------------------------------------------------------------===
*
@ -11,6 +11,7 @@
*
* ===----------------------------------------------------------------------===
*/
#include "abi.h"
#include "int_lib.h"
@ -18,7 +19,9 @@
/* Precondition: 0 <= b < bits_in_dword */
di_int
ARM_EABI_FNALIAS(llsl, ashldi3);
COMPILER_RT_ABI di_int
__ashldi3(di_int a, si_int b)
{
const int bits_in_word = (int)(sizeof(si_int) * CHAR_BIT);

View File

@ -2,8 +2,8 @@
*
* The LLVM Compiler Infrastructure
*
* This file is distributed under the University of Illinois Open Source
* License. See LICENSE.TXT for details.
* This file is dual licensed under the MIT and the University of Illinois Open
* Source Licenses. See LICENSE.TXT for details.
*
* ===----------------------------------------------------------------------===
*

View File

@ -2,8 +2,8 @@
*
* The LLVM Compiler Infrastructure
*
* This file is distributed under the University of Illinois Open Source
* License. See LICENSE.TXT for details.
* This file is dual licensed under the MIT and the University of Illinois Open
* Source Licenses. See LICENSE.TXT for details.
*
* ===----------------------------------------------------------------------===
*
@ -11,6 +11,7 @@
*
* ===----------------------------------------------------------------------===
*/
#include "abi.h"
#include "int_lib.h"
@ -18,7 +19,9 @@
/* Precondition: 0 <= b < bits_in_dword */
di_int
ARM_EABI_FNALIAS(lasr, ashrdi3);
COMPILER_RT_ABI di_int
__ashrdi3(di_int a, si_int b)
{
const int bits_in_word = (int)(sizeof(si_int) * CHAR_BIT);

View File

@ -2,8 +2,8 @@
*
* The LLVM Compiler Infrastructure
*
* This file is distributed under the University of Illinois Open Source
* License. See LICENSE.TXT for details.
* This file is dual licensed under the MIT and the University of Illinois Open
* Source Licenses. See LICENSE.TXT for details.
*
* ===----------------------------------------------------------------------===
*

View File

@ -2,8 +2,8 @@
*
* The LLVM Compiler Infrastructure
*
* This file is distributed under the University of Illinois Open Source
* License. See LICENSE.TXT for details.
* This file is dual licensed under the MIT and the University of Illinois Open
* Source Licenses. See LICENSE.TXT for details.
*
* ===----------------------------------------------------------------------===
*
@ -22,33 +22,48 @@
#define SEPARATOR ;
#endif
/* We can't use __USER_LABEL_PREFIX__ here, it isn't possible to concatenate the
*values* of two macros. This is quite brittle, though. */
#if defined(__APPLE__)
#define SYMBOL_NAME(name) _##name
#define HIDDEN_DIRECTIVE .private_extern
#define LOCAL_LABEL(name) L_##name
#else
#define SYMBOL_NAME(name) name
#define HIDDEN_DIRECTIVE .hidden
#define LOCAL_LABEL(name) .L_##name
#endif
#define GLUE2(a, b) a ## b
#define GLUE(a, b) GLUE2(a, b)
#define SYMBOL_NAME(name) GLUE(__USER_LABEL_PREFIX__, name)
#ifdef VISIBILITY_HIDDEN
#define DEFINE_COMPILERRT_FUNCTION(name) \
.globl SYMBOL_NAME(name) SEPARATOR \
.hidden SYMBOL_NAME(name) SEPARATOR \
#define DEFINE_COMPILERRT_FUNCTION(name) \
.globl SYMBOL_NAME(name) SEPARATOR \
HIDDEN_DIRECTIVE SYMBOL_NAME(name) SEPARATOR \
SYMBOL_NAME(name):
#else
#define DEFINE_COMPILERRT_FUNCTION(name) \
.globl SYMBOL_NAME(name) SEPARATOR \
#define DEFINE_COMPILERRT_FUNCTION(name) \
.globl SYMBOL_NAME(name) SEPARATOR \
SYMBOL_NAME(name):
#endif
#define DEFINE_COMPILERRT_PRIVATE_FUNCTION(name) \
.globl SYMBOL_NAME(name) SEPARATOR \
.hidden SYMBOL_NAME(name) SEPARATOR \
#define DEFINE_COMPILERRT_PRIVATE_FUNCTION(name) \
.globl SYMBOL_NAME(name) SEPARATOR \
HIDDEN_DIRECTIVE SYMBOL_NAME(name) SEPARATOR \
SYMBOL_NAME(name):
#define DEFINE_COMPILERRT_PRIVATE_FUNCTION_UNMANGLED(name) \
.globl name SEPARATOR \
.hidden name SEPARATOR \
.globl name SEPARATOR \
HIDDEN_DIRECTIVE name SEPARATOR \
name:
#define DEFINE_COMPILERRT_FUNCTION_ALIAS(name, target) \
.globl SYMBOL_NAME(name) SEPARATOR \
.set SYMBOL_NAME(name), SYMBOL_NAME(target) SEPARATOR
#if defined (__ARM_EABI__)
# define DEFINE_AEABI_FUNCTION_ALIAS(aeabi_name, name) \
DEFINE_COMPILERRT_FUNCTION_ALIAS(aeabi_name, name)
#else
# define DEFINE_AEABI_FUNCTION_ALIAS(aeabi_name, name)
#endif
#endif /* COMPILERRT_ASSEMBLY_H */

View File

@ -2,8 +2,8 @@
*
* The LLVM Compiler Infrastructure
*
* This file is distributed under the University of Illinois Open Source
* License. See LICENSE.TXT for details.
* This file is dual licensed under the MIT and the University of Illinois Open
* Source Licenses. See LICENSE.TXT for details.
*
* ===----------------------------------------------------------------------===
*/

View File

@ -1,9 +1,9 @@
/* ===-- clzdi2.c - Implement __clzdi2 -------------------------------------===
*
* The LLVM Compiler Infrastructure
* The LLVM Compiler Infrastructure
*
* This file is distributed under the University of Illinois Open Source
* License. See LICENSE.TXT for details.
* This file is dual licensed under the MIT and the University of Illinois Open
* Source Licenses. See LICENSE.TXT for details.
*
* ===----------------------------------------------------------------------===
*
@ -11,6 +11,7 @@
*
* ===----------------------------------------------------------------------===
*/
#include "abi.h"
#include "int_lib.h"
@ -18,7 +19,7 @@
/* Precondition: a != 0 */
si_int
COMPILER_RT_ABI si_int
__clzdi2(di_int a)
{
dwords x;

View File

@ -1,9 +1,9 @@
/* ===-- clzsi2.c - Implement __clzsi2 -------------------------------------===
*
* The LLVM Compiler Infrastructure
* The LLVM Compiler Infrastructure
*
* This file is distributed under the University of Illinois Open Source
* License. See LICENSE.TXT for details.
* This file is dual licensed under the MIT and the University of Illinois Open
* Source Licenses. See LICENSE.TXT for details.
*
* ===----------------------------------------------------------------------===
*
@ -11,6 +11,7 @@
*
* ===----------------------------------------------------------------------===
*/
#include "abi.h"
#include "int_lib.h"
@ -18,7 +19,7 @@
/* Precondition: a != 0 */
si_int
COMPILER_RT_ABI si_int
__clzsi2(si_int a)
{
su_int x = (su_int)a;

View File

@ -2,8 +2,8 @@
*
* The LLVM Compiler Infrastructure
*
* This file is distributed under the University of Illinois Open Source
* License. See LICENSE.TXT for details.
* This file is dual licensed under the MIT and the University of Illinois Open
* Source Licenses. See LICENSE.TXT for details.
*
* ===----------------------------------------------------------------------===
*

View File

@ -2,24 +2,25 @@
*
* The LLVM Compiler Infrastructure
*
* This file is distributed under the University of Illinois Open Source
* License. See LICENSE.TXT for details.
* This file is dual licensed under the MIT and the University of Illinois Open
* Source Licenses. See LICENSE.TXT for details.
*
* ===----------------------------------------------------------------------===
*
*
* This file implements __cmpdi2 for the compiler_rt library.
*
* ===----------------------------------------------------------------------===
*/
#include "abi.h"
#include "int_lib.h"
/* Returns: if (a < b) returns 0
/* Returns: if (a < b) returns 0
* if (a == b) returns 1
* if (a > b) returns 2
*/
si_int
COMPILER_RT_ABI si_int
__cmpdi2(di_int a, di_int b)
{
dwords x;

View File

@ -2,8 +2,8 @@
*
* The LLVM Compiler Infrastructure
*
* This file is distributed under the University of Illinois Open Source
* License. See LICENSE.TXT for details.
* This file is dual licensed under the MIT and the University of Illinois Open
* Source Licenses. See LICENSE.TXT for details.
*
* ===----------------------------------------------------------------------===
*

View File

@ -2,8 +2,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//

View File

@ -2,8 +2,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//

View File

@ -2,8 +2,8 @@
*
* The LLVM Compiler Infrastructure
*
* This file is distributed under the University of Illinois Open Source
* License. See LICENSE.TXT for details.
* This file is dual licensed under the MIT and the University of Illinois Open
* Source Licenses. See LICENSE.TXT for details.
*
* ===----------------------------------------------------------------------===
*
@ -11,6 +11,7 @@
*
* ===----------------------------------------------------------------------===
*/
#include "abi.h"
#include "int_lib.h"
@ -18,7 +19,7 @@
/* Precondition: a != 0 */
si_int
COMPILER_RT_ABI si_int
__ctzdi2(di_int a)
{
dwords x;

View File

@ -2,8 +2,8 @@
*
* The LLVM Compiler Infrastructure
*
* This file is distributed under the University of Illinois Open Source
* License. See LICENSE.TXT for details.
* This file is dual licensed under the MIT and the University of Illinois Open
* Source Licenses. See LICENSE.TXT for details.
*
* ===----------------------------------------------------------------------===
*
@ -11,6 +11,7 @@
*
* ===----------------------------------------------------------------------===
*/
#include "abi.h"
#include "int_lib.h"
@ -18,7 +19,7 @@
/* Precondition: a != 0 */
si_int
COMPILER_RT_ABI si_int
__ctzsi2(si_int a)
{
su_int x = (su_int)a;

View File

@ -2,8 +2,8 @@
*
* The LLVM Compiler Infrastructure
*
* This file is distributed under the University of Illinois Open Source
* License. See LICENSE.TXT for details.
* This file is dual licensed under the MIT and the University of Illinois Open
* Source Licenses. See LICENSE.TXT for details.
*
* ===----------------------------------------------------------------------===
*

View File

@ -2,8 +2,8 @@
*
* The LLVM Compiler Infrastructure
*
* This file is distributed under the University of Illinois Open Source
* License. See LICENSE.TXT for details.
* This file is dual licensed under the MIT and the University of Illinois Open
* Source Licenses. See LICENSE.TXT for details.
*
* ===----------------------------------------------------------------------===
*

View File

@ -2,8 +2,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
@ -15,10 +15,13 @@
// underflow with correct rounding.
//
//===----------------------------------------------------------------------===//
#include "abi.h"
#define DOUBLE_PRECISION
#include "fp_lib.h"
ARM_EABI_FNALIAS(ddiv, divdf3);
fp_t __divdf3(fp_t a, fp_t b) {
const unsigned int aExponent = toRep(a) >> significandBits & maxExponent;

View File

@ -2,8 +2,8 @@
*
* The LLVM Compiler Infrastructure
*
* This file is distributed under the University of Illinois Open Source
* License. See LICENSE.TXT for details.
* This file is dual licensed under the MIT and the University of Illinois Open
* Source Licenses. See LICENSE.TXT for details.
*
* ===----------------------------------------------------------------------===
*
@ -11,14 +11,15 @@
*
* ===----------------------------------------------------------------------===
*/
#include "abi.h"
#include "int_lib.h"
du_int __udivmoddi4(du_int a, du_int b, du_int* rem);
du_int COMPILER_RT_ABI __udivmoddi4(du_int a, du_int b, du_int* rem);
/* Returns: a / b */
di_int
COMPILER_RT_ABI di_int
__divdi3(di_int a, di_int b)
{
const int bits_in_dword_m1 = (int)(sizeof(di_int) * CHAR_BIT) - 1;

View File

@ -0,0 +1,30 @@
/*===-- divmoddi4.c - Implement __divmoddi4 --------------------------------===
*
* The LLVM Compiler Infrastructure
*
* This file is dual licensed under the MIT and the University of Illinois Open
* Source Licenses. See LICENSE.TXT for details.
*
* ===----------------------------------------------------------------------===
*
* This file implements __divmoddi4 for the compiler_rt library.
*
* ===----------------------------------------------------------------------===
*/
#include "abi.h"
#include "int_lib.h"
extern COMPILER_RT_ABI di_int __divdi3(di_int a, di_int b);
ARM_EABI_FNALIAS(ldivmod, divmoddi4);
/* Returns: a / b, *rem = a % b */
COMPILER_RT_ABI di_int
__divmoddi4(di_int a, di_int b, di_int* rem)
{
di_int d = __divdi3(a,b);
*rem = a - (d*b);
return d;
}

View File

@ -0,0 +1,31 @@
/*===-- divmodsi4.c - Implement __divmodsi4 --------------------------------===
*
* The LLVM Compiler Infrastructure
*
* This file is dual licensed under the MIT and the University of Illinois Open
* Source Licenses. See LICENSE.TXT for details.
*
* ===----------------------------------------------------------------------===
*
* This file implements __divmodsi4 for the compiler_rt library.
*
* ===----------------------------------------------------------------------===
*/
#include "abi.h"
#include "int_lib.h"
extern COMPILER_RT_ABI si_int __divsi3(si_int a, si_int b);
/* Returns: a / b, *rem = a % b */
COMPILER_RT_ABI si_int
__divmodsi4(si_int a, si_int b, si_int* rem)
{
si_int d = __divsi3(a,b);
*rem = a - (d*b);
return d;
}

View File

@ -2,8 +2,8 @@
*
* The LLVM Compiler Infrastructure
*
* This file is distributed under the University of Illinois Open Source
* License. See LICENSE.TXT for details.
* This file is dual licensed under the MIT and the University of Illinois Open
* Source Licenses. See LICENSE.TXT for details.
*
* ===----------------------------------------------------------------------===
*

View File

@ -2,8 +2,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
@ -15,10 +15,13 @@
// underflow with correct rounding.
//
//===----------------------------------------------------------------------===//
#include "abi.h"
#define SINGLE_PRECISION
#include "fp_lib.h"
ARM_EABI_FNALIAS(fdiv, divsf3);
fp_t __divsf3(fp_t a, fp_t b) {
const unsigned int aExponent = toRep(a) >> significandBits & maxExponent;

View File

@ -2,8 +2,8 @@
*
* The LLVM Compiler Infrastructure
*
* This file is distributed under the University of Illinois Open Source
* License. See LICENSE.TXT for details.
* This file is dual licensed under the MIT and the University of Illinois Open
* Source Licenses. See LICENSE.TXT for details.
*
* ===----------------------------------------------------------------------===
*
@ -11,14 +11,17 @@
*
* ===----------------------------------------------------------------------===
*/
#include "abi.h"
#include "int_lib.h"
su_int __udivsi3(su_int n, su_int d);
su_int COMPILER_RT_ABI __udivsi3(su_int n, su_int d);
/* Returns: a / b */
si_int
ARM_EABI_FNALIAS(idiv, divsi3);
COMPILER_RT_ABI si_int
__divsi3(si_int a, si_int b)
{
const int bits_in_word_m1 = (int)(sizeof(si_int) * CHAR_BIT) - 1;

View File

@ -2,8 +2,8 @@
*
* The LLVM Compiler Infrastructure
*
* This file is distributed under the University of Illinois Open Source
* License. See LICENSE.TXT for details.
* This file is dual licensed under the MIT and the University of Illinois Open
* Source Licenses. See LICENSE.TXT for details.
*
* ===----------------------------------------------------------------------===
*

View File

@ -2,8 +2,8 @@
*
* The LLVM Compiler Infrastructure
*
* This file is distributed under the University of Illinois Open Source
* License. See LICENSE.TXT for details.
* This file is dual licensed under the MIT and the University of Illinois Open
* Source Licenses. See LICENSE.TXT for details.
*
* ===----------------------------------------------------------------------===
*

View File

@ -2,8 +2,8 @@
*
* The LLVM Compiler Infrastructure
*
* This file is distributed under the University of Illinois Open Source
* License. See LICENSE.TXT for details.
* This file is dual licensed under the MIT and the University of Illinois Open
* Source Licenses. See LICENSE.TXT for details.
*
* ===----------------------------------------------------------------------===
*/

View File

@ -2,8 +2,8 @@
*
* The LLVM Compiler Infrastructure
*
* This file is distributed under the University of Illinois Open Source
* License. See LICENSE.TXT for details.
* This file is dual licensed under the MIT and the University of Illinois Open
* Source Licenses. See LICENSE.TXT for details.
*
* ===----------------------------------------------------------------------===
*

View File

@ -2,8 +2,8 @@
*
* The LLVM Compiler Infrastructure
*
* This file is distributed under the University of Illinois Open Source
* License. See LICENSE.TXT for details.
* This file is dual licensed under the MIT and the University of Illinois Open
* Source Licenses. See LICENSE.TXT for details.
*
* ===----------------------------------------------------------------------===
*/

View File

@ -2,8 +2,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
@ -41,6 +41,8 @@
#include <stdint.h>
#include <limits.h>
#include "abi.h"
typedef float src_t;
typedef uint32_t src_rep_t;
#define SRC_REP_C UINT32_C
@ -67,6 +69,8 @@ static inline dst_t dstFromRep(dst_rep_t x) {
// End helper routines. Conversion implementation follows.
ARM_EABI_FNALIAS(f2d, extendsfdf2);
dst_t __extendsfdf2(src_t a) {
// Various constants whose values follow from the type parameters.

View File

@ -2,8 +2,8 @@
*
* The LLVM Compiler Infrastructure
*
* This file is distributed under the University of Illinois Open Source
* License. See LICENSE.TXT for details.
* This file is dual licensed under the MIT and the University of Illinois Open
* Source Licenses. See LICENSE.TXT for details.
*
* ===----------------------------------------------------------------------===
*
@ -11,6 +11,7 @@
*
* ===----------------------------------------------------------------------===
*/
#include "abi.h"
#include "int_lib.h"
@ -18,7 +19,7 @@
* the value zero if a is zero. The least significant bit is index one.
*/
si_int
COMPILER_RT_ABI si_int
__ffsdi2(di_int a)
{
dwords x;

Some files were not shown because too many files have changed in this diff Show More