Skip to content

Commit 20f7dbf

Browse files
authored
add complex to tstresult() (dlang#22601)
1 parent de3ad22 commit 20f7dbf

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

  • compiler/src/dmd/backend/arm

compiler/src/dmd/backend/arm/cod1.d

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1325,7 +1325,20 @@ void tstresult(ref CodeBuilder cdb, regm_t regm, tym_t tym, bool saveflag)
13251325
if (tyfloating(tym))
13261326
{
13271327
assert(reg & 32);
1328-
if (tym == TYreal || tym == TYireal)
1328+
if (tycomplex(tym))
1329+
{
1330+
sz /= 2;
1331+
assert(sz <= 8); // TODO AArch64 16 byte floats
1332+
const regm_t V0 = findreg(regm & INSTR.LSW);
1333+
const regm_t V1 = findreg(regm & INSTR.MSW);
1334+
const ftype = INSTR.szToFtype(sz);
1335+
cdb.gen1(INSTR.fcmp_float(ftype,0,V0)); // FCMP V0,#0.0
1336+
code* cnop = gen1(null, INSTR.nop);
1337+
genBranch(cdb, COND.ne, FL.code, cast(block*)cnop); // B.ne cnop1;
1338+
cdb.gen1(INSTR.fcmp_float(ftype,0,V1)); // FCMP V1,#0.0
1339+
cdb.append(cnop); // cnop1:
1340+
}
1341+
else if (sz == 16) // 128 byte floats
13291342
{
13301343
/*
13311344
fmov q0,reg

0 commit comments

Comments
 (0)