s390x: Add CountTrailingZerosU32/U64 to TFAssem
Change-Id: Idf653061a88beb348fa13e907932ca68f2d6d05b Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2685366 Reviewed-by: Milad Fa <mfarazma@redhat.com> Commit-Queue: Junliang Yan <junyan@redhat.com> Cr-Commit-Position: refs/heads/master@{#72636}
This commit is contained in:
parent
518ee01d39
commit
2c055469d8
@ -4712,6 +4712,47 @@ void TurboAssembler::CountLeadingZerosU64(Register dst, Register src,
|
||||
mov(dst, scratch_pair);
|
||||
}
|
||||
|
||||
void TurboAssembler::CountTrailingZerosU32(Register dst, Register src,
|
||||
Register scratch_pair) {
|
||||
Register scratch0 = scratch_pair;
|
||||
Register scratch1 = Register::from_code(scratch_pair.code() + 1);
|
||||
DCHECK(!AreAliased(dst, scratch0, scratch1));
|
||||
DCHECK(!AreAliased(src, scratch0, scratch1));
|
||||
|
||||
Label done;
|
||||
// Check if src is all zeros.
|
||||
ltr(scratch1, src);
|
||||
mov(dst, Operand(32));
|
||||
beq(&done);
|
||||
llgfr(scratch1, scratch1);
|
||||
lcgr(scratch0, scratch1);
|
||||
ngr(scratch1, scratch0);
|
||||
flogr(scratch0, scratch1);
|
||||
mov(dst, Operand(63));
|
||||
SubS64(dst, scratch0);
|
||||
bind(&done);
|
||||
}
|
||||
|
||||
void TurboAssembler::CountTrailingZerosU64(Register dst, Register src,
|
||||
Register scratch_pair) {
|
||||
Register scratch0 = scratch_pair;
|
||||
Register scratch1 = Register::from_code(scratch_pair.code() + 1);
|
||||
DCHECK(!AreAliased(dst, scratch0, scratch1));
|
||||
DCHECK(!AreAliased(src, scratch0, scratch1));
|
||||
|
||||
Label done;
|
||||
// Check if src is all zeros.
|
||||
ltgr(scratch1, src);
|
||||
mov(dst, Operand(64));
|
||||
beq(&done);
|
||||
lcgr(scratch0, scratch1);
|
||||
ngr(scratch0, scratch1);
|
||||
flogr(scratch0, scratch0);
|
||||
mov(dst, Operand(63));
|
||||
SubS64(dst, scratch0);
|
||||
bind(&done);
|
||||
}
|
||||
|
||||
} // namespace internal
|
||||
} // namespace v8
|
||||
|
||||
|
@ -495,9 +495,6 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
|
||||
void Popcnt64(Register dst, Register src);
|
||||
#endif
|
||||
|
||||
// CountLeadingZeros will corrupt the scratch register pair (eg. r0:r1)
|
||||
void CountLeadingZerosU32(Register dst, Register src, Register scratch_pair);
|
||||
void CountLeadingZerosU64(Register dst, Register src, Register scratch_pair);
|
||||
void mov(Register dst, const Operand& src);
|
||||
void mov(Register dst, Register src);
|
||||
|
||||
@ -1030,6 +1027,16 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
|
||||
void DecompressAnyTagged(Register destination, MemOperand field_operand);
|
||||
void DecompressAnyTagged(Register destination, Register source);
|
||||
|
||||
// CountLeadingZeros will corrupt the scratch register pair (eg. r0:r1)
|
||||
void CountLeadingZerosU32(Register dst, Register src,
|
||||
Register scratch_pair = r0);
|
||||
void CountLeadingZerosU64(Register dst, Register src,
|
||||
Register scratch_pair = r0);
|
||||
void CountTrailingZerosU32(Register dst, Register src,
|
||||
Register scratch_pair = r0);
|
||||
void CountTrailingZerosU64(Register dst, Register src,
|
||||
Register scratch_pair = r0);
|
||||
|
||||
private:
|
||||
static const int kSmiShift = kSmiTagSize + kSmiShiftSize;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user