mirrored from https://chromium.googlesource.com/v8/v8.git
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[compiler][arm64] Pattern matching ccmp
Combine chains of Word32And, Word32Or and comparison nodes into the new ConditionalSet and ConditionalBranch FlagsContinuations. We begin the search from Word32And and Word32Or nodes. The AArch64 ccmp instruction conditionally executes a comparison: - If the instruction is predicated true, it performs a comparison of two inputs operands. - If the instruction is predicated false, it passes along a predefined value for nzcv. So, for a sequence (Word32And (CompareA) (CompareB)), CompareA would become a normal cmp, and CompareB would become a ccmp. The logical combining of the boolean results is achieved by predicating the ccmp and providing a default 'false' flag result: cmp ccmp not(CondB), CondA cset CondB The ccmp is predicated on CondA - so the ccmp will only execute iff cmp is true, and cset will produce 1 iff the ccmp produces a true value based on CondB. By having the ccmp provide not(CondB) as the default value, the cset will produce a zero if ccmp doesn't execute. These default nzcv values are chosen arbitrarily, each code just needs to set the right bit for the desired 'condition'. As a concrete example: (Word32And (Int32LessThan a, b), (Word32Equal c, d)) The default 'false' nzcv needs to represent signed greater than or equal, ge, which is represented by N==V and we choose to use 'NoFlag' but NzcV would be equally valid: cmp a, b ccmp c, d, nzcv, eq cset lt Combining comparisons with OR is a little more complicated, as sequentially executing a ccmp converts the logic to an AND. So, for a sequence (Word32Or (CompareA) (CompareB)) we create an equivalent chain using AND: (not (Word32And (not CompareA) (not CompareB))) and generate the chain as we did before: cmp ccmp CondB, not(CondA) cset CondB Change-Id: I73255e5f349ce6bcc351b18bd38ac409a4f368be Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5317579 Reviewed-by: Darius Mercadier <dmercadier@chromium.org> Commit-Queue: Rodolph Perfetta <rodolph.perfetta@arm.com> Cr-Commit-Position: refs/heads/main@{#93647}
- Loading branch information
1 parent
07ee5d4
commit 4421c36
Showing
23 changed files
with
1,783 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.