Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Add SMNEGL, UMNEGL, UMADDL, and UMSUBL for ARM64 and select this inst…
…ruction in Air https://bugs.webkit.org/show_bug.cgi?id=227857 Reviewed by Robin Morisset. The previous patches have already added MNEG, MADD, MSUB, SMADDL, and SMSUBL. This patch completes the corresponding signed or unsigned variants (SMNEGL, UMNEGL, UMADDL, and UMSUBL) of them. In addition, this patch refactors the implementation and the associative test cases of MADD, MSUB, and MNEG to be more readable and maintainable w.r.t their variants. ------------------------------ ### SMNEGL/UMNEGL Xd Wn Wm ### ------------------------------ Signed/Unsigned Multiply-Negate Long multiplies two 32-bit register values, negates the product, and writes the result to the 64-bit destination register. The equivalent patterns are d = -(SExt32(n) * SExt32(m)) and d = -(ZExt32(n) * ZExt32(m)) respectively. Given B3 IR: Int @0 = S/ZExt32(Trunc(ArgumentReg(%x0))) Int @1 = S/ZExt32(Trunc(ArgumentReg(%x1))) Int @2 = Mul(@0, @1) Int @3 = Neg(@2) Void@4 = Return(@3, Terminal) // Old optimized AIR Move32 %x0, %x0, @0 Move32 %x1, %x1, @1 MultiplyNeg %x0, %x1, %x0, @3 Ret %x0, @4 // New optimized AIR MultiplyNegSign/ZeroExtend %x0, %x1, %x0, @3 Ret %x0, @4 -------------------------- ### UMADDL Xd Wn Wm Xa ### -------------------------- Unsigned Multiply-Add Long multiplies two 32-bit register values, adds a 64-bit register value, and writes the result to the 64-bit destination register. The equivalent patterns are d = ZExt32(n) * ZExt32(m) + a or d = a + ZExt32(n) * ZExt32(m) Given B3 IR: Int @0 = ZExt32(Trunc(ArgumentReg(%x0))) Int @1 = ZExt32(Trunc(ArgumentReg(%x1))) Int @2 = ArgumentReg(%x2) Int @3 = Mul(@0, @1) Int @4 = Add(@3, @2) Void@5 = Return(@4, Terminal) // Old optimized AIR Move32 %x0, %x0, @1 Move32 %x1, %x1, @2 MultiplyAdd %x0, %x1, %x2, %x0, @4 Ret64 %x0, @5 // New optimized AIR MultiplyAddZeroExtend %x0, %x1, %x2, %x0, @8 Ret %x0, @9 -------------------------- ### UMSUBL Xd Wn Wm Xa ### -------------------------- Unsigned Multiply-Subtract Long multiplies two 32-bit register values, subtracts the product from a 64-bit register value, and writes the result to the 64-bit destination register. The equivalent patterns are d = a - ZExt32(n) * ZExt32(m) Given B3 IR: Int @0 = ZExt32(Trunc(ArgumentReg(%x0))) Int @1 = ZExt32(Trunc(ArgumentReg(%x1))) Int @2 = ArgumentReg(%x2) Int @3 = Mul(@0, @1) Int @4 = Sub(@2, @3) Void@5 = Return(@4, Terminal) // Old optimized AIR Move32 %x0, %x0, @1 Move32 %x1, %x1, @2 MultiplySub %x0, %x1, %x2, %x0, @4 Ret64 %x0, @5 // New optimized AIR MultiplySubZeroExtend %x0, %x1, %x2, %x0, @8 Ret %x0, @9 * assembler/MacroAssemblerARM64.h: (JSC::MacroAssemblerARM64::multiplyNeg32): (JSC::MacroAssemblerARM64::multiplyAddZeroExtend32): (JSC::MacroAssemblerARM64::multiplySubZeroExtend32): (JSC::MacroAssemblerARM64::multiplyNeg64): (JSC::MacroAssemblerARM64::multiplyNegSignExtend32): (JSC::MacroAssemblerARM64::multiplyNegZeroExtend32): * assembler/testmasm.cpp: (JSC::testMultiplyAddSignExtend32): (JSC::testMultiplyAddZeroExtend32): (JSC::testMultiplySubSignExtend32): (JSC::testMultiplySubZeroExtend32): (JSC::testMultiplyNegSignExtend32): (JSC::testMultiplyNegZeroExtend32): (JSC::testMultiplyAddSignExtend32Left): Deleted. (JSC::testMultiplyAddSignExtend32Right): Deleted. * b3/B3LowerToAir.cpp: * b3/air/AirOpcode.opcodes: * b3/testb3.h: * b3/testb3_2.cpp: (testMulAddArgsLeft): (testMulAddArgsRight): (testMulAddSignExtend32ArgsLeft): (testMulAddZeroExtend32ArgsLeft): (testMulAddZeroExtend32ArgsRight): (testMulSubArgsLeft): (testMulSubArgsRight): (testMulSubArgsRight32): (testMulSubSignExtend32): (testMulSubZeroExtend32): (testMulNegArgArg): (testMulNegArgs): (testMulNegArgs32): (testMulNegSignExtend32): (testMulNegZeroExtend32): (testMulSubSignExtend32Args): Deleted. * b3/testb3_3.cpp: (addArgTests): Canonical link: https://commits.webkit.org/239605@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@279850 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information