From 99ee6326d37c7368d94f71c142d854bcb7005dd3 Mon Sep 17 00:00:00 2001 From: Stas Boukarev Date: Tue, 23 Feb 2016 23:29:34 +0300 Subject: [PATCH] Ensure registers are moved into stack locations directly. Without using an intermediate register. Which was the case on ARM, ARM64, PPC, SPARC. Their MOVE VOPs didn't accept CONTROL-STACK as a result SC requiring an extra move through a load register. --- src/compiler/arm/move.lisp | 8 ++++++-- src/compiler/arm64/move.lisp | 16 +++++++++++++--- src/compiler/ppc/move.lisp | 8 ++++++-- src/compiler/sparc/move.lisp | 8 ++++++-- 4 files changed, 31 insertions(+), 9 deletions(-) diff --git a/src/compiler/arm/move.lisp b/src/compiler/arm/move.lisp index 95684c46c..4f49e97d8 100644 --- a/src/compiler/arm/move.lisp +++ b/src/compiler/arm/move.lisp @@ -115,12 +115,16 @@ (:args (x :target y :scs (any-reg descriptor-reg null) :load-if (not (location= x y)))) - (:results (y :scs (any-reg descriptor-reg) + (:results (y :scs (any-reg descriptor-reg control-stack) :load-if (not (location= x y)))) (:effects) (:affected) (:generator 0 - (move y x))) + (cond ((location= x y)) + ((sc-is y control-stack) + (store-stack-tn y x)) + (t + (move y x))))) (define-move-vop move :move (any-reg descriptor-reg) diff --git a/src/compiler/arm64/move.lisp b/src/compiler/arm64/move.lisp index 220f871e2..93c67d5c4 100644 --- a/src/compiler/arm64/move.lisp +++ b/src/compiler/arm64/move.lisp @@ -118,13 +118,23 @@ (define-vop (move) (:args (x :target y :scs (any-reg descriptor-reg null) - :load-if (not (location= x y)))) - (:results (y :scs (any-reg descriptor-reg) + :load-if (not (or (location= x y) + (and (sc-is x immediate) + (eql (tn-value x) 0)))))) + (:results (y :scs (any-reg descriptor-reg control-stack) :load-if (not (location= x y)))) (:effects) (:affected) (:generator 0 - (move y x))) + (let ((x (if (and (sc-is x immediate) + (eql (tn-value x) 0)) + zr-tn + x))) + (cond ((location= x y)) + ((sc-is y control-stack) + (store-stack-tn y x)) + (t + (move y x)))))) (define-move-vop move :move (any-reg descriptor-reg) diff --git a/src/compiler/ppc/move.lisp b/src/compiler/ppc/move.lisp index 101de2bae..811be3f30 100644 --- a/src/compiler/ppc/move.lisp +++ b/src/compiler/ppc/move.lisp @@ -73,12 +73,16 @@ (:args (x :target y :scs (any-reg descriptor-reg zero null) :load-if (not (location= x y)))) - (:results (y :scs (any-reg descriptor-reg) + (:results (y :scs (any-reg descriptor-reg control-stack) :load-if (not (location= x y)))) (:effects) (:affected) (:generator 0 - (move y x))) + (cond ((location= x y)) + ((sc-is y control-stack) + (store-stack-tn y x)) + (t + (move y x))))) (define-move-vop move :move (any-reg descriptor-reg) diff --git a/src/compiler/sparc/move.lisp b/src/compiler/sparc/move.lisp index 947a1de71..b4a9edeb1 100644 --- a/src/compiler/sparc/move.lisp +++ b/src/compiler/sparc/move.lisp @@ -98,12 +98,16 @@ (:args (x :target y :scs (any-reg descriptor-reg zero null) :load-if (not (location= x y)))) - (:results (y :scs (any-reg descriptor-reg) + (:results (y :scs (any-reg descriptor-reg control-stack) :load-if (not (location= x y)))) (:effects) (:affected) (:generator 0 - (move y x))) + (cond ((location= x y)) + ((sc-is y control-stack) + (store-stack-tn y x)) + (t + (move y x))))) (define-move-vop move :move (any-reg descriptor-reg) -- 2.11.4.GIT