opcodes: Add 64-bit CountLeadingZeroes opcode

This commit is contained in:
Lioncash
2018-01-22 10:51:40 -05:00
committed by MerryMage
parent 4c4efb2213
commit b612782445
4 changed files with 43 additions and 3 deletions

View File

@@ -427,7 +427,19 @@ U64 IREmitter::ByteReverseDual(const U64& a) {
}
U32 IREmitter::CountLeadingZeros(const U32& a) {
return Inst<U32>(Opcode::CountLeadingZeros, a);
return Inst<U32>(Opcode::CountLeadingZeros32, a);
}
U64 IREmitter::CountLeadingZeros(const U64& a) {
return Inst<U64>(Opcode::CountLeadingZeros64, a);
}
U32U64 IREmitter::CountLeadingZeros(const U32U64& a) {
if (a.GetType() == IR::Type::U32) {
return Inst<U32>(Opcode::CountLeadingZeros32, a);
}
return Inst<U64>(Opcode::CountLeadingZeros64, a);
}
ResultAndOverflow<U32> IREmitter::SignedSaturatedAdd(const U32& a, const U32& b) {

View File

@@ -139,6 +139,8 @@ public:
U16 ByteReverseHalf(const U16& a);
U64 ByteReverseDual(const U64& a);
U32 CountLeadingZeros(const U32& a);
U64 CountLeadingZeros(const U64& a);
U32U64 CountLeadingZeros(const U32U64& a);
ResultAndOverflow<U32> SignedSaturatedAdd(const U32& a, const U32& b);
ResultAndOverflow<U32> SignedSaturatedSub(const U32& a, const U32& b);

View File

@@ -115,7 +115,8 @@ OPCODE(ZeroExtendWordToLong, T::U64, T::U32
OPCODE(ByteReverseWord, T::U32, T::U32 )
OPCODE(ByteReverseHalf, T::U16, T::U16 )
OPCODE(ByteReverseDual, T::U64, T::U64 )
OPCODE(CountLeadingZeros, T::U32, T::U32 )
OPCODE(CountLeadingZeros32, T::U32, T::U32 )
OPCODE(CountLeadingZeros64, T::U64, T::U64 )
// Saturated instructions
OPCODE(SignedSaturatedAdd, T::U32, T::U32, T::U32 )