From 0979456711930a9330f6f1796af959cbac09251d Mon Sep 17 00:00:00 2001 From: Douglas Katzman Date: Wed, 15 Jun 2016 12:18:48 -0400 Subject: [PATCH] x86: Remove one instruction from unsigned-{word}-p --- src/compiler/x86-64/type-vops.lisp | 12 ++++++------ src/compiler/x86/type-vops.lisp | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/compiler/x86-64/type-vops.lisp b/src/compiler/x86-64/type-vops.lisp index 6731ddf4d..5dcc3fe20 100644 --- a/src/compiler/x86-64/type-vops.lisp +++ b/src/compiler/x86-64/type-vops.lisp @@ -293,13 +293,13 @@ (inst cmp rax-tn (+ (ash 1 n-widetag-bits) bignum-widetag)) (inst jmp :e single-word) ;; If it's other than two, we can't be an (unsigned-byte 64) - (inst cmp rax-tn (+ (ash 2 n-widetag-bits) bignum-widetag)) + ;: Leave RAX holding 0 in the affirmative case. + (inst sub rax-tn (+ (ash 2 n-widetag-bits) bignum-widetag)) (inst jmp :ne nope) - ;; Get the second digit. - (loadw rax-tn value (1+ bignum-digits-offset) other-pointer-lowtag) - ;; All zeros, its an (unsigned-byte 64). - (inst test rax-tn rax-tn) - (inst jmp :z yep) + ;; Compare the second digit to zero (in RAX). + (inst cmp (make-ea-for-object-slot value (1+ bignum-digits-offset) + other-pointer-lowtag) rax-tn) + (inst jmp :z yep) ; All zeros, its an (unsigned-byte 64). (inst jmp nope) (emit-label single-word) diff --git a/src/compiler/x86/type-vops.lisp b/src/compiler/x86/type-vops.lisp index 01eb83f74..50d0af652 100644 --- a/src/compiler/x86/type-vops.lisp +++ b/src/compiler/x86/type-vops.lisp @@ -241,13 +241,13 @@ (inst cmp eax-tn (+ (ash 1 n-widetag-bits) bignum-widetag)) (inst jmp :e single-word) ;; If it's other than two, we can't be an (unsigned-byte 32) - (inst cmp eax-tn (+ (ash 2 n-widetag-bits) bignum-widetag)) + ;: Leave EAX holding 0 in the affirmative case. + (inst sub eax-tn (+ (ash 2 n-widetag-bits) bignum-widetag)) (inst jmp :ne nope) - ;; Get the second digit. - (loadw eax-tn value (1+ bignum-digits-offset) other-pointer-lowtag) - ;; All zeros, its an (unsigned-byte 32). - (inst test eax-tn eax-tn) - (inst jmp :z yep) + ;; Compare the second digit to zero (in EAX). + (inst cmp (make-ea-for-object-slot value (1+ bignum-digits-offset) + other-pointer-lowtag) eax-tn) + (inst jmp :z yep) ; All zeros, its an (unsigned-byte 32). (inst jmp nope) (emit-label single-word) -- 2.11.4.GIT