зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1329774: Fix code generation for 64-bits integer left rotation on x86; r=h4writer
--HG-- extra : rebase_source : 984fb270ccf9ab3b2dcf5cf0415398d12ffb51ce extra : amend_source : 19c0c9e3bafd2733778c39bba09f7352a8e38e3d
This commit is contained in:
Родитель
6945ea68f5
Коммит
d93ef59ab0
|
@ -207,33 +207,68 @@ assertEq(testTrunc(13.37), 1);
|
|||
testTrap64('rem_s', 10, 0, /integer divide by zero/);
|
||||
testTrap64('rem_u', 10, 0, /integer divide by zero/);
|
||||
|
||||
testBinary64('and', 42, 6, 2);
|
||||
// Bitops.
|
||||
testBinary64('or', 42, 6, 46);
|
||||
testBinary64('xor', 42, 2, 40);
|
||||
testBinary64('and', "0x8765432112345678", "0xffff0000ffff0000", "0x8765000012340000");
|
||||
testBinary64('or', "0x8765432112345678", "0xffff0000ffff0000", "0xffff4321ffff5678");
|
||||
|
||||
testBinary64('xor', 42, 2, 40);
|
||||
testBinary64('xor', "0x8765432112345678", "0xffff0000ffff0000", "0x789a4321edcb5678");
|
||||
testBinary64('shl', 40, 2, 160);
|
||||
testBinary64('shr_s', -40, 2, -10);
|
||||
testBinary64('shr_u', -40, 2, "0x3ffffffffffffff6");
|
||||
testBinary64('shl', 0xff00ff, 28, "0xff00ff0000000");
|
||||
|
||||
testBinary64('shl', 0xff00ff, 28, "0x0ff00ff0000000");
|
||||
testBinary64('shl', 0xff00ff, 30, "0x3fc03fc0000000");
|
||||
testBinary64('shl', 0xff00ff, 31, "0x7f807f80000000");
|
||||
testBinary64('shl', 0xff00ff, 32, "0xff00ff00000000");
|
||||
testBinary64('shl', 1, 63, "0x8000000000000000");
|
||||
testBinary64('shl', 1, 64, 1);
|
||||
testBinary64('shr_s', "0xff00ff0000000", 28, 0xff00ff);
|
||||
testBinary64('shr_u', "0x8ffff00ff0000000", 56, 0x8f);
|
||||
testBinary64('rotl', 40, 2, 160);
|
||||
testBinary64('rotr', 40, 2, 10);
|
||||
testBinary64('rotr', "0x1234567812345678", 4, "0x8123456781234567");
|
||||
testBinary64('rotl', "0x1234567812345678", 4, "0x2345678123456781");
|
||||
testBinary64('rotl', "0x1234567812345678", 60, "0x8123456781234567");
|
||||
testBinary64('rotr', "0x1234567812345678", 60, "0x2345678123456781");
|
||||
testBinary64('rotl', "0x0000000000001000", 127, "0x0000000000000800");
|
||||
testBinary64('rotr', "0x0000000000001000", 127, "0x0000000000002000");
|
||||
testBinary64('rotr', 40, 0, 40);
|
||||
testBinary64('rotl', 40, 0, 40);
|
||||
testBinary64('and', 42, 0, 0);
|
||||
testBinary64('and', "0x0000000012345678", "0xffff0000ffff0000", "0x0000000012340000");
|
||||
testBinary64('shl', 40, 2, 160);
|
||||
|
||||
testBinary64('shr_s', -40, 2, -10);
|
||||
testBinary64('shr_s', "0xff00ff0000000", 28, 0xff00ff);
|
||||
testBinary64('shr_s', "0xff00ff0000000", 30, 0x3fc03f);
|
||||
testBinary64('shr_s', "0xff00ff0000000", 31, 0x1fe01f);
|
||||
testBinary64('shr_s', "0xff00ff0000000", 32, 0x0ff00f);
|
||||
|
||||
testBinary64('shr_u', -40, 2, "0x3ffffffffffffff6");
|
||||
testBinary64('shr_u', "0x8ffff00ff0000000", 30, "0x23fffc03f");
|
||||
testBinary64('shr_u', "0x8ffff00ff0000000", 31, "0x11fffe01f");
|
||||
testBinary64('shr_u', "0x8ffff00ff0000000", 32, "0x08ffff00f");
|
||||
testBinary64('shr_u', "0x8ffff00ff0000000", 56, 0x8f);
|
||||
|
||||
testBinary64('and', 42, 0, 0);
|
||||
testBinary64('and', 42, 6, 2);
|
||||
testBinary64('and', "0x0000000012345678", "0xffff0000ffff0000", "0x0000000012340000");
|
||||
testBinary64('and', "0x8765432112345678", "0xffff0000ffff0000", "0x8765000012340000");
|
||||
|
||||
// Rotations.
|
||||
testBinary64('rotl', 40, 0, 0x28);
|
||||
testBinary64('rotl', 40, 2, 0xA0);
|
||||
testBinary64('rotl', 40, 8, 0x2800);
|
||||
testBinary64('rotl', 40, 30, "0xA00000000");
|
||||
testBinary64('rotl', 40, 31, "0x1400000000");
|
||||
testBinary64('rotl', 40, 32, "0x2800000000");
|
||||
|
||||
testBinary64('rotl', "0x1234567812345678", 4, "0x2345678123456781");
|
||||
testBinary64('rotl', "0x1234567812345678", 30, "0x048D159E048D159E");
|
||||
testBinary64('rotl', "0x1234567812345678", 31, "0x091A2B3C091A2B3C");
|
||||
testBinary64('rotl', "0x1234567812345678", 32, "0x1234567812345678");
|
||||
|
||||
testBinary64('rotl', "0x0000000000001000", 127, "0x0000000000000800");
|
||||
|
||||
testBinary64('rotr', 40, 0, 0x28);
|
||||
testBinary64('rotr', 40, 2, 0x0A);
|
||||
testBinary64('rotr', 40, 30, "0xA000000000");
|
||||
testBinary64('rotr', 40, 31, "0x5000000000");
|
||||
testBinary64('rotr', 40, 32, "0x2800000000");
|
||||
|
||||
testBinary64('rotr', "0x1234567812345678", 4, "0x8123456781234567");
|
||||
testBinary64('rotr', "0x1234567812345678", 30, "0x48D159E048D159E0");
|
||||
testBinary64('rotr', "0x1234567812345678", 31, "0x2468ACF02468ACF0");
|
||||
testBinary64('rotr', "0x1234567812345678", 32, "0x1234567812345678");
|
||||
testBinary64('rotr', "0x1234567812345678", 60, "0x2345678123456781");
|
||||
|
||||
testBinary64('rotr', "0x0000000000001000", 127, "0x0000000000002000");
|
||||
|
||||
// Comparisons.
|
||||
testComparison64('eq', 40, 40, 1);
|
||||
testComparison64('ne', 40, 40, 0);
|
||||
testComparison64('lt_s', 40, 40, 0);
|
||||
|
|
|
@ -539,7 +539,7 @@ MacroAssembler::rotateLeft64(Imm32 count, Register64 src, Register64 dest, Regis
|
|||
MOZ_ASSERT(src == dest, "defineReuseInput");
|
||||
|
||||
int32_t amount = count.value & 0x3f;
|
||||
if (amount % 0x1f != 0) {
|
||||
if ((amount & 0x1f) != 0) {
|
||||
movl(dest.high, temp);
|
||||
shldl(Imm32(amount & 0x1f), dest.low, dest.high);
|
||||
shldl(Imm32(amount & 0x1f), temp, dest.low);
|
||||
|
|
Загрузка…
Ссылка в новой задаче