Skip to content

Commit ccddf1c

Browse files
committed
Furture reduce the TP cost
Moved the *= operators as instance of `regMaskTP` so the `.low` private field can directly be manipulated instead of converting the `64-bit` value in `regMaskTP` before doing any operation. Overall: 0.74% MinOpts: 0.82% FullOpts: 0.68%
1 parent b3218e1 commit ccddf1c

File tree

2 files changed

+23
-27
lines changed

2 files changed

+23
-27
lines changed

src/coreclr/jit/compiler.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1009,7 +1009,7 @@ inline regNumber genFirstRegNumFromMaskAndToggle(SingleTypeRegSet& mask)
10091009

10101010
/* Convert the mask to a register number */
10111011

1012-
regNumber regNum = (regNumber)BitScanForward(mask);
1012+
regNumber regNum = (regNumber)BitOperations::BitScanForward(mask);
10131013

10141014
mask ^= genRegMask(regNum);
10151015

src/coreclr/jit/target.h

+22-26
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,7 @@ struct regMaskTP
249249
public:
250250
regMaskTP(regMaskSmall regMask)
251251
: low(regMask)
252-
{
253-
252+
{
254253
}
255254

256255
regMaskTP()
@@ -323,6 +322,27 @@ struct regMaskTP
323322
void RemoveRegNumFromMask(regNumber reg);
324323

325324
bool IsRegNumInMask(regNumber reg);
325+
326+
327+
void operator|=(const regMaskTP& second)
328+
{
329+
low |= second.getLow();
330+
}
331+
332+
void operator^=(const regMaskTP& second)
333+
{
334+
low ^= second.getLow();
335+
}
336+
337+
void operator^=(const regNumber reg)
338+
{
339+
low ^= genRegMask(reg);
340+
}
341+
342+
void operator&=(const regMaskTP& second)
343+
{
344+
low &= second.getLow();
345+
}
326346
};
327347

328348
static regMaskTP operator^(const regMaskTP& first, const regMaskTP& second)
@@ -343,30 +363,6 @@ static regMaskTP operator|(const regMaskTP& first, const regMaskTP& second)
343363
return result;
344364
}
345365

346-
static regMaskTP& operator|=(regMaskTP& first, const regMaskTP& second)
347-
{
348-
first = first | second;
349-
return first;
350-
}
351-
352-
static regMaskTP& operator^=(regMaskTP& first, const regMaskTP& second)
353-
{
354-
first = first ^ second;
355-
return first;
356-
}
357-
358-
static regMaskTP& operator^=(regMaskTP& first, const regNumber reg)
359-
{
360-
first = first ^ genRegMask(reg);
361-
return first;
362-
}
363-
364-
static regMaskTP& operator&=(regMaskTP& first, const regMaskTP& second)
365-
{
366-
first = first & second;
367-
return first;
368-
}
369-
370366
static bool operator==(const regMaskTP& first, const regMaskTP& second)
371367
{
372368
return (first.getLow() == second.getLow());

0 commit comments

Comments
 (0)