A lightweight WebAssembly runtime that is fast, secure, and standards-compliant
x64: Shrink size of `x64_not` in `icmp` peephole optimization (#12876)
Alex Crichton8da1acec7e5e
diff --git a/cranelift/codegen/src/isa/x64/lower.isle b/cranelift/codegen/src/isa/x64/lower.isleindex 1ce3df5753..2cea2d5511 100644--- a/cranelift/codegen/src/isa/x64/lower.isle+++ b/cranelift/codegen/src/isa/x64/lower.isle@@ -1978,11 +1978,11 @@;; Peephole optimization for `0 <= x`, when x is a signed 32 bit value(rule 2 (lower (has_type $I8 (icmp _ (IntCC.SignedLessThanOrEqual) (u64_from_iconst 0) x @ (value_type $I32))))- (x64_shrl_mi (x64_not $I64 x) 31))+ (x64_shrl_mi (x64_not $I32 x) 31));; Peephole optimization for `x >= 0`, when x is a signed 32 bit value(rule 2 (lower (has_type $I8 (icmp _ (IntCC.SignedGreaterThanOrEqual) x @ (value_type $I32) (u64_from_iconst 0))))- (x64_shrl_mi (x64_not $I64 x) 31))+ (x64_shrl_mi (x64_not $I32 x) 31));; For XMM-held values, we lower to `PCMP*` instructions, sometimes more than;; one. To note: what is different here about the output values is that eachdiff --git a/cranelift/filetests/filetests/isa/x64/conditional-values.clif b/cranelift/filetests/filetests/isa/x64/conditional-values.clifindex 231cbd8d90..24f048c1e2 100644--- a/cranelift/filetests/filetests/isa/x64/conditional-values.clif+++ b/cranelift/filetests/filetests/isa/x64/conditional-values.clif@@ -377,7 +377,7 @@ block0(v0: i32):; pushq %rbp; movq %rsp, %rbp; block0:-; notq %rdi+; notl %edi; movq %rdi, %rax; shrl $0x1f, %eax; movq %rbp, %rsp@@ -389,7 +389,7 @@ block0(v0: i32):; pushq %rbp; movq %rsp, %rbp; block1: ; offset 0x4-; notq %rdi+; notl %edi; movq %rdi, %rax; shrl $0x1f, %eax; movq %rbp, %rsp@@ -437,7 +437,7 @@ block0(v0: i32):; pushq %rbp; movq %rsp, %rbp; block0:-; notq %rdi+; notl %edi; movq %rdi, %rax; shrl $0x1f, %eax; movq %rbp, %rsp@@ -449,7 +449,7 @@ block0(v0: i32):; pushq %rbp; movq %rsp, %rbp; block1: ; offset 0x4-; notq %rdi+; notl %edi; movq %rdi, %rax; shrl $0x1f, %eax; movq %rbp, %rsp