Skip to content
This repository was archived by the owner on Jun 20, 2019. It is now read-only.

Commit 1b6c689

Browse files
authored
Merge pull request #583 from jpf91/aarchASM
std.math AArch64 ASM implementation
2 parents ae0cf9b + 71d4809 commit 1b6c689

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

libphobos/src/std/math.d

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5162,6 +5162,15 @@ public:
51625162
return true;
51635163
else version(PPC_Any)
51645164
return true;
5165+
else version(AArch64)
5166+
{
5167+
auto oldState = getControlState();
5168+
// If exceptions are not supported, we set the bit but read it back as zero
5169+
setControlState(oldState | (divByZeroException & allExceptions));
5170+
bool result = (getControlState() & allExceptions) != 0;
5171+
setControlState(oldState);
5172+
return result;
5173+
}
51655174
else version(ARM)
51665175
{
51675176
auto oldState = getControlState();
@@ -5291,6 +5300,13 @@ private:
52915300
"fstcw %0;" : "=m" cont;
52925301
}
52935302
}
5303+
else version (AArch64)
5304+
{
5305+
asm pure nothrow @nogc
5306+
{
5307+
"mrs %0, FPCR;" : "=r" cont;
5308+
}
5309+
}
52945310
else version (ARM)
52955311
{
52965312
version (ARM_SoftFloat)
@@ -5304,7 +5320,8 @@ private:
53045320
}
53055321
}
53065322
else
5307-
assert(0, "Not yet supported");
5323+
static assert(0, "Not yet supported");
5324+
53085325
return cont;
53095326
}
53105327
else
@@ -5379,6 +5396,13 @@ private:
53795396
}
53805397
}
53815398
}
5399+
else version (AArch64)
5400+
{
5401+
asm pure nothrow @nogc
5402+
{
5403+
"msr FPCR, %0;" : : "r" (newState);
5404+
}
5405+
}
53825406
else version (ARM)
53835407
{
53845408
version (ARM_SoftFloat)

0 commit comments

Comments
 (0)