diff --git a/src/builtin.c b/src/builtin.c index 30cd380b9501..6ec705e676b7 100644 --- a/src/builtin.c +++ b/src/builtin.c @@ -44,7 +44,7 @@ enum BUILTIN FuncDeclaration::isBuiltin() static const char FeZe [] = "FNaNbNfeZe"; // @safe pure nothrow real function(real) static const char FeZe2[] = "FNaNbNeeZe"; // @trusted pure nothrow real function(real) - //printf("FuncDeclaration::isBuiltin() %s\n", toChars()); + //printf("FuncDeclaration::isBuiltin() %s, %d\n", toChars(), builtin); if (builtin == BUILTINunknown) { builtin = BUILTINnot; @@ -52,7 +52,7 @@ enum BUILTIN FuncDeclaration::isBuiltin() { // If it's in the std.math package if (parent->ident == Id::math && - parent->parent && parent->parent->ident == Id::std && + parent->parent && (parent->parent->ident == Id::std || parent->parent->ident == Id::core) && !parent->parent->parent) { //printf("deco = %s\n", type->deco); diff --git a/src/idgen.c b/src/idgen.c index c45668c1e366..6f90d8aaf778 100644 --- a/src/idgen.c +++ b/src/idgen.c @@ -284,6 +284,7 @@ Msgtable msgtable[] = // Builtin functions { "std" }, + { "core" }, { "math" }, { "sin" }, { "cos" }, diff --git a/src/toir.c b/src/toir.c index 200cb307ead0..9ccaf62e1d2e 100644 --- a/src/toir.c +++ b/src/toir.c @@ -488,6 +488,18 @@ int intrinsic_op(char *name) #ifdef DMDV2 static const char *core_namearray[] = { + "4math3cosFNaNbNfeZe", + "4math3sinFNaNbNfeZe", + "4math4fabsFNaNbNfeZe", + "4math4rintFNaNbNfeZe", + "4math4sqrtFNaNbNfdZd", + "4math4sqrtFNaNbNfeZe", + "4math4sqrtFNaNbNffZf", + "4math4yl2xFNaNbNfeeZe", + "4math5ldexpFNaNbNfeiZe", + "4math6rndtolFNaNbNfeZl", + "4math6yl2xp1FNaNbNfeeZe", + "5bitop2btFNaNbxPkkZi", "5bitop3bsfFNaNbkZi", "5bitop3bsrFNaNbkZi", @@ -504,6 +516,18 @@ int intrinsic_op(char *name) }; static const char *core_namearray64[] = { + "4math3cosFNaNbNfeZe", + "4math3sinFNaNbNfeZe", + "4math4fabsFNaNbNfeZe", + "4math4rintFNaNbNfeZe", + "4math4sqrtFNaNbNfdZd", + "4math4sqrtFNaNbNfeZe", + "4math4sqrtFNaNbNffZf", + "4math4yl2xFNaNbNfeeZe", + "4math5ldexpFNaNbNfeiZe", + "4math6rndtolFNaNbNfeZl", + "4math6yl2xp1FNaNbNfeeZe", + "5bitop2btFNaNbxPmmZi", "5bitop3bsfFNaNbmZi", "5bitop3bsrFNaNbmZi", @@ -520,6 +544,18 @@ int intrinsic_op(char *name) }; static unsigned char core_ioptab[] = { + OPcos, + OPsin, + OPabs, + OPrint, + OPsqrt, + OPsqrt, + OPsqrt, + OPyl2x, + OPscale, + OPrndtol, + OPyl2xp1, + OPbt, OPbsf, OPbsr, @@ -589,7 +625,7 @@ int intrinsic_op(char *name) } #ifdef DMDV2 if (length > 12 && - name[8] == 'b' && + (name[8] == 'm' || name[8] == 'b') && !memcmp(name, "_D4core", 7)) { int i = binary(name + 7, I64 ? core_namearray64 : core_namearray, sizeof(core_namearray) / sizeof(char *));