Mercurial > projects > ldc
view runtime/llvmdc.diff @ 444:f2b5f86348ef
Updated tango patch. tango.math.Math was incorrect.
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Fri, 01 Aug 2008 01:12:33 +0200 |
parents | 44f08170f4ef |
children | cc40db549aea |
line wrap: on
line source
Index: object.di =================================================================== --- object.di (revision 3831) +++ object.di (working copy) @@ -150,6 +150,9 @@ void function() dtor; void function() unitTest; + void* xgetMembers; + void function() ictor; + static int opApply( int delegate( inout ModuleInfo ) ); } Index: lib/common/tango/core/BitManip.d =================================================================== --- lib/common/tango/core/BitManip.d (revision 3831) +++ lib/common/tango/core/BitManip.d (working copy) @@ -171,6 +171,10 @@ */ uint outpl( uint port_address, uint value ); } +else version( LLVMDC ) +{ + public import llvmdc.bitmanip; +} else { public import std.intrinsic; Index: lib/common/tango/core/Thread.d =================================================================== --- lib/common/tango/core/Thread.d (revision 3831) +++ lib/common/tango/core/Thread.d (working copy) @@ -244,10 +244,33 @@ } body { - version( D_InlineAsm_X86 ) + version( LLVMDC ) { + // put registers on the stack + version(D_InlineAsm_X86) + { + uint _eax, _ecx, _edx, _ebx, _esp, _ebp, _esi, _edi; asm { + mov _eax, EAX; + mov _ecx, ECX; + mov _edx, EDX; + mov _ebx, EBX; + mov _esp, ESP; + mov _ebp, EBP; + mov _esi, ESI; + mov _edi, EDI; + } + } + else + { + // FIXME + } + } + else version( D_InlineAsm_X86 ) + { + asm + { pushad; } } @@ -297,8 +320,12 @@ } } - version( D_InlineAsm_X86 ) + version( LLVMDC ) { + // nothing to do + } + else version( D_InlineAsm_X86 ) + { asm { popad; @@ -2266,8 +2293,12 @@ private { - version( D_InlineAsm_X86 ) + version( LLVMDC ) { + + } + else version( D_InlineAsm_X86 ) + { version( X86_64 ) { Index: lib/gc/basic/gcx.d =================================================================== --- lib/gc/basic/gcx.d (revision 3831) +++ lib/gc/basic/gcx.d (working copy) @@ -2178,6 +2178,28 @@ __builtin_unwind_init(); sp = & sp; } + else version(LLVMDC) + { + version(D_InlineAsm_X86) + { + uint _eax, _ecx, _edx, _ebx, _ebp, _esi, _edi; + asm + { + mov _eax, EAX; + mov _ecx, ECX; + mov _edx, EDX; + mov _ebx, EBX; + mov _ebp, EBP; + mov _esi, ESI; + mov _edi, EDI; + mov sp, ESP; + } + } + else + { + // FIXME + } + } else { asm @@ -2191,6 +2213,10 @@ { // nothing to do } + else version(LLVMDC) + { + // nothing to do + } else { asm Index: lib/gc/basic/gcbits.d =================================================================== --- lib/gc/basic/gcbits.d (revision 3831) +++ lib/gc/basic/gcbits.d (working copy) @@ -39,6 +39,10 @@ { // use the unoptimized version } +else version(LLVMDC) +{ + // ditto +} else version (D_InlineAsm_X86) { version = Asm86; Index: tango/text/convert/Layout.d =================================================================== --- tango/text/convert/Layout.d (revision 3831) +++ tango/text/convert/Layout.d (working copy) @@ -47,6 +47,12 @@ alias void* Arg; alias va_list ArgList; } +else version(LLVMDC) + { + private import tango.core.Vararg; + alias void* Arg; + alias va_list ArgList; + } else { alias void* Arg; @@ -197,9 +203,18 @@ assert (formatStr, "null format specifier"); assert (arguments.length < 64, "too many args in Layout.convert"); - version (GNU) + version (LLVMDC) { Arg[64] arglist = void; + foreach (i, arg; arguments) + { + arglist[i] = args; + args += (arg.tsize + size_t.sizeof - 1) & ~ (size_t.sizeof - 1); + } + } + else version (GNU) + { + Arg[64] arglist = void; int[64] intargs = void; byte[64] byteargs = void; long[64] longargs = void; Index: tango/core/Vararg.d =================================================================== --- tango/core/Vararg.d (revision 3831) +++ tango/core/Vararg.d (working copy) @@ -15,6 +15,10 @@ { public import std.stdarg; } +else version( LLVMDC ) +{ + public import llvmdc.vararg; +} else { /** Index: tango/math/Math.d =================================================================== --- tango/math/Math.d (revision 3831) +++ tango/math/Math.d (working copy) @@ -76,7 +76,77 @@ version = DigitalMars_D_InlineAsm_X86; } } +else version(LLVMDC) +{ + private + { + pragma(intrinsic, "llvm.sqrt.f32") + float sqrt(float); + pragma(intrinsic, "llvm.sqrt.f64") + double sqrt(double); + + version(LLVM_X86_FP80) + { + alias tango.stdc.math.tanl llvm_tan; + alias tango.stdc.math.acosl llvm_acos; + alias tango.stdc.math.asinl llvm_asin; + alias tango.stdc.math.atanl llvm_atan; + alias tango.stdc.math.atan2l llvm_atan2; + alias tango.stdc.math.coshl llvm_cosh; + alias tango.stdc.math.sinhl llvm_sinh; + alias tango.stdc.math.tanhl llvm_tanh; + alias tango.stdc.math.cbrtl llvm_cbrt; + alias tango.stdc.math.expl llvm_exp; + alias tango.stdc.math.expm1l llvm_expm1; + alias tango.stdc.math.exp2l llvm_exp2; + alias tango.stdc.math.logl llvm_log; + alias tango.stdc.math.log1pl llvm_log1p; + alias tango.stdc.math.log2l llvm_log2; + alias tango.stdc.math.log10l llvm_log10; + alias tango.stdc.math.powl llvm_pow; + alias tango.stdc.math.lrintl llvm_lrint; + alias tango.stdc.math.llrintl llvm_llrint; + + pragma(intrinsic, "llvm.cos.f80") + real cos(real); + pragma(intrinsic, "llvm.sin.f80") + real sin(real); + pragma(intrinsic, "llvm.sqrt.f80") + real sqrt(real); + } + else + { + alias tango.stdc.math.tan llvm_tan; + alias tango.stdc.math.acos llvm_acos; + alias tango.stdc.math.asin llvm_asin; + alias tango.stdc.math.atan llvm_atan; + alias tango.stdc.math.atan2 llvm_atan2; + alias tango.stdc.math.cosh llvm_cosh; + alias tango.stdc.math.sinh llvm_sinh; + alias tango.stdc.math.tanh llvm_tanh; + alias tango.stdc.math.cbrt llvm_cbrt; + alias tango.stdc.math.exp llvm_exp; + alias tango.stdc.math.expm1 llvm_expm1; + alias tango.stdc.math.exp2 llvm_exp2; + alias tango.stdc.math.log llvm_log; + alias tango.stdc.math.log1p llvm_log1p; + alias tango.stdc.math.log2 llvm_log2; + alias tango.stdc.math.log10 llvm_log10; + alias tango.stdc.math.pow llvm_pow; + alias tango.stdc.math.lrint llvm_lrint; + alias tango.stdc.math.llrint llvm_llrint; + + pragma(intrinsic, "llvm.cos.f64") + real cos(real); + pragma(intrinsic, "llvm.sin.f64") + real sin(real); + pragma(intrinsic, "llvm.sqrt.f64") + real sqrt(real); + } + } +} + /* * Constants */ @@ -298,6 +368,10 @@ * Bugs: * Results are undefined if |x| >= $(POWER 2,64). */ +version(LLVMDC) +{} +else +{ real cos(real x) /* intrinsic */ { version(D_InlineAsm_X86) @@ -313,6 +387,7 @@ return tango.stdc.math.cosl(x); } } +} debug(UnitTest) { unittest { @@ -333,6 +408,10 @@ * Bugs: * Results are undefined if |x| >= $(POWER 2,64). */ +version(LLVMDC) +{} +else +{ real sin(real x) /* intrinsic */ { version(D_InlineAsm_X86) @@ -348,6 +427,7 @@ return tango.stdc.math.sinl(x); } } +} debug(UnitTest) { unittest { @@ -374,6 +454,9 @@ { version (GNU) { return tanl(x); + } + else version(LLVMDC) { + return llvm_tan(x); } else { asm { @@ -576,7 +659,14 @@ */ real acos(real x) { - return tango.stdc.math.acosl(x); + version(LLVMDC) + { + return llvm_acos(x); + } + else + { + return tango.stdc.math.acosl(x); + } } debug(UnitTest) { @@ -599,7 +689,14 @@ */ real asin(real x) { - return tango.stdc.math.asinl(x); + version(LLVMDC) + { + return llvm_asin(x); + } + else + { + return tango.stdc.math.asinl(x); + } } debug(UnitTest) { @@ -621,7 +718,14 @@ */ real atan(real x) { - return tango.stdc.math.atanl(x); + version(LLVMDC) + { + return llvm_atan(x); + } + else + { + return tango.stdc.math.atanl(x); + } } debug(UnitTest) { @@ -658,7 +762,14 @@ */ real atan2(real y, real x) { - return tango.stdc.math.atan2l(y,x); + version(LLVMDC) + { + return llvm_atan2(y,x); + } + else + { + return tango.stdc.math.atan2l(y,x); + } } debug(UnitTest) { @@ -707,7 +818,14 @@ */ real cosh(real x) { - return tango.stdc.math.coshl(x); + version(LLVMDC) + { + return llvm_cosh(x); + } + else + { + return tango.stdc.math.coshl(x); + } } debug(UnitTest) { @@ -728,7 +846,14 @@ */ real sinh(real x) { - return tango.stdc.math.sinhl(x); + version(LLVMDC) + { + return llvm_sinh(x); + } + else + { + return tango.stdc.math.sinhl(x); + } } debug(UnitTest) { @@ -749,7 +874,14 @@ */ real tanh(real x) { - return tango.stdc.math.tanhl(x); + version(LLVMDC) + { + return llvm_tanh(x); + } + else + { + return tango.stdc.math.tanhl(x); + } } debug(UnitTest) { @@ -947,6 +1079,10 @@ * <tr> <td> +∞ <td> +∞ <td> no * ) */ +version(LLVMDC) +{} +else +{ float sqrt(float x) /* intrinsic */ { version(D_InlineAsm_X86) @@ -994,6 +1130,7 @@ return tango.stdc.math.sqrtl(x); } } +} /** ditto */ creal sqrt(creal z) @@ -1045,7 +1182,14 @@ */ real cbrt(real x) { - return tango.stdc.math.cbrtl(x); + version(LLVMDC) + { + return llvm_cbrt(x); + } + else + { + return tango.stdc.math.cbrtl(x); + } } @@ -1067,7 +1211,14 @@ */ real exp(real x) { - return tango.stdc.math.expl(x); + version(LLVMDC) + { + return llvm_exp(x); + } + else + { + return tango.stdc.math.expl(x); + } } debug(UnitTest) { @@ -1093,7 +1244,14 @@ */ real expm1(real x) { - return tango.stdc.math.expm1l(x); + version(LLVMDC) + { + return llvm_expm1(x); + } + else + { + return tango.stdc.math.expm1l(x); + } } debug(UnitTest) { @@ -1115,7 +1273,14 @@ */ real exp2(real x) { - return tango.stdc.math.exp2l(x); + version(LLVMDC) + { + return llvm_exp2(x); + } + else + { + return tango.stdc.math.exp2l(x); + } } debug(UnitTest) { @@ -1141,7 +1306,14 @@ */ real log(real x) { - return tango.stdc.math.logl(x); + version(LLVMDC) + { + return llvm_log(x); + } + else + { + return tango.stdc.math.logl(x); + } } debug(UnitTest) { @@ -1167,7 +1339,14 @@ */ real log1p(real x) { - return tango.stdc.math.log1pl(x); + version(LLVMDC) + { + return llvm_log1p(x); + } + else + { + return tango.stdc.math.log1pl(x); + } } debug(UnitTest) { @@ -1190,7 +1369,14 @@ */ real log2(real x) { - return tango.stdc.math.log2l(x); + version(LLVMDC) + { + return llvm_log2(x); + } + else + { + return tango.stdc.math.log2l(x); + } } debug(UnitTest) { @@ -1212,7 +1398,14 @@ */ real log10(real x) { - return tango.stdc.math.log10l(x); + version(LLVMDC) + { + return llvm_log10(x); + } + else + { + return tango.stdc.math.log10l(x); + } } debug(UnitTest) { @@ -1477,7 +1670,14 @@ } } } - return tango.stdc.math.powl(x, y); + version(LLVMDC) + { + return llvm_pow(x, y); + } + else + { + return tango.stdc.math.powl(x, y); + } } debug(UnitTest) { @@ -1823,6 +2023,10 @@ } return n; } + else version(LLVMDC) + { + return llvm_lrint(x); + } else { return tango.stdc.math.lrintl(x); @@ -1842,6 +2046,10 @@ } return n; } + else version(LLVMDC) + { + return llvm_llrint(x); + } else { return tango.stdc.math.llrintl(x); Index: tango/stdc/stdlib.d =================================================================== --- tango/stdc/stdlib.d (revision 3831) +++ tango/stdc/stdlib.d (working copy) @@ -94,6 +94,11 @@ { void* alloca(size_t size); } +else version( LLVMDC ) +{ + pragma(alloca) + void* alloca(size_t size); +} else version( GNU ) { private import gcc.builtins; Index: tango/stdc/stdarg.d =================================================================== --- tango/stdc/stdarg.d (revision 3831) +++ tango/stdc/stdarg.d (working copy) @@ -13,6 +13,10 @@ { public import std.c.stdarg; } +else version( LLVMDC ) +{ + public import llvmdc.cstdarg; +} else { alias void* va_list;