diff --git a/dmd/constfold.c b/dmd/constfold.c index 08579869..d2707c27 100644 --- a/dmd/constfold.c +++ b/dmd/constfold.c @@ -487,9 +487,10 @@ Expression *Mod(Type *type, Expression *e1, Expression *e2) c = fmodl(e1->toReal(), r2) + fmodl(e1->toImaginary(), r2) * I; #elif defined(IN_GCC) c = complex_t(e1->toReal() % r2, e1->toImaginary() % r2); -#elif defined(__FreeBSD__) && __FreeBSD_version < 800000 - // freebsd is kinda messed up. the STABLE branch doesn't support C99's fmodl !?! - c = complex_t(fmod(e1->toReal(), r2), fmod(e1->toImaginary(), r2)); +#elif (defined(__FreeBSD__) && __FreeBSD_version < 800000) || defined(__arm__) + // freebsd is kinda messed up. the STABLE branch doesn't support C99's fmodl !?! + // arm also doesn't like fmodl + c = complex_t(fmod(e1->toReal(), r2), fmod(e1->toImaginary(), r2)); #else c = complex_t(fmodl(e1->toReal(), r2), fmodl(e1->toImaginary(), r2)); #endif @@ -501,9 +502,10 @@ Expression *Mod(Type *type, Expression *e1, Expression *e2) c = fmodl(e1->toReal(), i2) + fmodl(e1->toImaginary(), i2) * I; #elif defined(IN_GCC) c = complex_t(e1->toReal() % i2, e1->toImaginary() % i2); -#elif defined(__FreeBSD__) && __FreeBSD_version < 800000 +#elif (defined(__FreeBSD__) && __FreeBSD_version < 800000) || defined(__arm__) // freebsd is kinda messed up. the STABLE branch doesn't support C99's fmodl !?! - c = complex_t(fmod(e1->toReal(), i2), fmod(e1->toImaginary(), i2)); + // arm also doesn't like fmodl + c = complex_t(fmod(e1->toReal(), i2), fmod(e1->toImaginary(), i2)); #else c = complex_t(fmodl(e1->toReal(), i2), fmodl(e1->toImaginary(), i2)); #endif diff --git a/dmd/mars.c b/dmd/mars.c index 81e591c3..0f02ec5f 100644 --- a/dmd/mars.c +++ b/dmd/mars.c @@ -828,6 +828,8 @@ int main(int argc, char *argv[], char** envp) global.params.llvmArch = "ppc64"; else global.params.llvmArch = "ppc32"; + #elif defined(__arm__) + global.params.llvmArch = "arm"; #else #error #endif @@ -864,6 +866,12 @@ int main(int argc, char *argv[], char** envp) global.params.cpu = ARCHppc_64; //global.params.data_layout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64"; } + else if (strcmp(global.params.llvmArch,"arm")==0) { + VersionCondition::addPredefinedGlobalIdent("ARM"); + global.params.isLE = true; + global.params.is64bit = false; + global.params.cpu = ARCHarm; + } else { assert(0 && "Invalid arch"); } diff --git a/dmd/mars.h b/dmd/mars.h index 102cd067..c026b11e 100644 --- a/dmd/mars.h +++ b/dmd/mars.h @@ -44,7 +44,8 @@ enum ARCH ARCHx86, ARCHx86_64, ARCHppc, - ARCHppc_64 + ARCHppc_64, + ARCHarm }; enum OUTPUTFLAG {