Cranelift(Aarch64): Optimize lowering of icmps with immediates (#5252)

We can encode more constants into 12-bit immediates if we do the following
rewrite for comparisons with odd constants:

        A >= B + 1
    ==> A - 1 >= B
    ==> A > B
This commit is contained in:
Nick Fitzgerald
2022-11-15 09:18:55 -08:00
committed by GitHub
parent 6dcdabf37e
commit 9967782726
7 changed files with 236 additions and 51 deletions

View File

@@ -137,6 +137,9 @@
(decl u64_nonzero (u64) u64)
(extractor (u64_nonzero x) (and (u64_is_zero $false) x))
(decl pure u64_is_odd (u64) bool)
(extern constructor u64_is_odd u64_is_odd)
;;;; `cranelift_codegen::ir::Type` ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(extern const $I8 Type)