Optimize immediates and compare and branch sequences (#286)
* Add a pre-opt optimization to change constants into immediates. This converts 'iadd' + 'iconst' into 'iadd_imm', and so on. * Optimize away redundant `bint` instructions. Cretonne has a concept of "Testable" values, which can be either boolean or integer. When the an instruction needing a "Testable" value receives the result of a `bint`, converting boolean to integer, eliminate the `bint`, as it's redundant. * Postopt: Optimize using CPU flags. This introduces a post-legalization optimization pass which converts compare+branch sequences to use flags values on CPUs which support it. * Define a form of x86's `urm` that doesn't clobber FLAGS. movzbl/movsbl/etc. don't clobber FLAGS; define a form of the `urm` recipe that represents this. * Implement a DCE pass. This pass deletes instructions with no side effects and no results that are used. * Clarify ambiguity about "32-bit" and "64-bit" in comments. * Add x86 encodings for icmp_imm. * Add a testcase for postopt CPU flags optimization. This covers the basic functionality of transforming compare+branch sequences to use CPU flags. * Pattern-match irsub_imm in preopt.
This commit is contained in:
@@ -21,7 +21,7 @@ function %pr227(i32 [%rdi], i32 [%rsi], i32 [%rdx], i32 [%rcx], i64 vmctx [%r8])
|
||||
@0011 [RexOp1puid#b8] v9 = iconst.i32 0
|
||||
@0015 [RexOp1puid#b8] v11 = iconst.i32 0
|
||||
@0017 [RexOp1icscc#39] v12 = icmp.i32 eq v15, v11
|
||||
@0017 [RexOp2urm#4b6] v13 = bint.i32 v12
|
||||
@0017 [RexOp2urm_noflags#4b6] v13 = bint.i32 v12
|
||||
@001a [RexOp1rr#21] v14 = band v9, v13
|
||||
@001b [RexOp1tjccb#75] brnz v14, ebb6
|
||||
@001d [RexOp1jmpb#eb] jump ebb7
|
||||
|
||||
Reference in New Issue
Block a user