From 39927bc359ccbe65371213c4559126b05dcfb117 Mon Sep 17 00:00:00 2001 From: Anton Romanov Date: Tue, 3 Sep 2024 14:43:45 +0300 Subject: riscv64: Add node Rol, fix InstructionBuilder Add new IR node Rol (rotate left). This allows to generate 1 (one) risc-v instruction from Integer(Long).rotateLeft intrinsic instead of 2 instructions (Ror+Neg). Fix InstructionBuilder: build Rol from rotateLeft instead of Ror+Neg. Add unfolding of Rol node in InstructionSimplifier(Arm, Arm64 and X86 Int64 type) to Neg+Ror. By compiling with dex2oat all the methods of applications below I got: in Facebook 1 Ror+Neg pattern, in Minecraft 5 Ror+Neg patterns. Test: art/test/testrunner/testrunner.py --target --64 --ndebug --optimizing Change-Id: Ic28610c6fab4f66386f2fbc0f7223ef2c0e644b6 --- compiler/optimizing/instruction_simplifier_shared.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'compiler/optimizing/instruction_simplifier_shared.h') diff --git a/compiler/optimizing/instruction_simplifier_shared.h b/compiler/optimizing/instruction_simplifier_shared.h index de70ec5a8a..8e61109b0e 100644 --- a/compiler/optimizing/instruction_simplifier_shared.h +++ b/compiler/optimizing/instruction_simplifier_shared.h @@ -77,6 +77,14 @@ bool TryExtractVecArrayAccessAddress(HVecMemoryOperation* access, HInstruction* // Add(c, Sub(b, a)) bool TryReplaceSubSubWithSubAdd(HSub* last_sub); +// ARM does not contain instruction ROL so replace +// ROL dest, a, distance +// with +// NEG neg, distance +// ROR dest, a, neg +// before GVN to give it a chance to deduplicate the instructions, if it's able. +void UnfoldRotateLeft(HRol* rol); + } // namespace art #endif // ART_COMPILER_OPTIMIZING_INSTRUCTION_SIMPLIFIER_SHARED_H_ -- cgit v1.2.3-59-g8ed1b