From ee6fc87e14dc88bffc77fe933419761ff62e9b23 Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Tue, 15 Jan 2019 03:20:21 +0000 Subject: [PATCH] Fix some instruction syntax bugs. - Specify target _and_ source -- we're not x86 here. - Specify operand size. - Specify multipliers correctly. --- src/compiler/machines/aarch64/rules3.scm | 12 ++++++------ src/compiler/machines/aarch64/rulfix.scm | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/compiler/machines/aarch64/rules3.scm b/src/compiler/machines/aarch64/rules3.scm index ef8f3d296..a6b8d23b2 100644 --- a/src/compiler/machines/aarch64/rules3.scm +++ b/src/compiler/machines/aarch64/rules3.scm @@ -306,14 +306,14 @@ USA. (LAP (ADD X ,regnum:stack-pointer ,regnum:stack-pointer (&U ,(* 8 frame-size))) ,@(if (odd? frame-size) - (LAP (LDR X ,temp1 (PRE+ ,regnum:stack-pointer (& (* 8 -1)))) - (STR X ,temp1 (PRE+ ,address (& (* 8 -1))))) + (LAP (LDR X ,temp1 (PRE+ ,regnum:stack-pointer (& -8))) + (STR X ,temp1 (PRE+ ,address (& -8)))) (LAP)) ,@(load-unsigned-immediate index loop-count) (LABEL ,label) - (SUB X ,index (&U #x10)) - (LDRP X ,temp1 ,temp2 (PRE+ ,regnum:stack-pointer (& (* 8 -2)))) - (STRP X ,temp1 ,temp2 (PRE+ ,address (& (* 8 -2)))) + (SUB X ,index ,index (&U #x10)) + (LDP X ,temp1 ,temp2 (PRE+ ,regnum:stack-pointer (& (* 8 -2)))) + (STP X ,temp1 ,temp2 (PRE+ ,address (& (* 8 -2)))) (CBNZ X ,index (@PCR ,label ,regnum:scratch-0)) ,@(register->register-transfer address regnum:stack-pointer)))) @@ -708,7 +708,7 @@ USA. ,@(object->datum temp1 temp1) ;temp1 := unmarked size (ADD X ,temp1 ,temp1 (&U #x10)) ;temp1 := consts offset (ADD X ,arg2 ,arg1 ,temp1) ;temp1 := consts addr - (SUB X ,counter (&U 1)) ;ctr := ctr - 1 + (SUB X ,counter ,counter (&U 1)) ;ctr := ctr - 1 (ADR X ,arg3 (@PCR ,nsects ,regnum:scratch-0)) ;arg3 := nsects (LDR B ,arg3 (+ ,arg3 ,counter)) ;arg3 := nsects[ctr] ,@(invoke-interface/call code:compiler-link continuation-label) diff --git a/src/compiler/machines/aarch64/rulfix.scm b/src/compiler/machines/aarch64/rulfix.scm index d8cf2aa20..4c8bb82aa 100644 --- a/src/compiler/machines/aarch64/rulfix.scm +++ b/src/compiler/machines/aarch64/rulfix.scm @@ -170,8 +170,8 @@ USA. ;; We have x 2^t and y 2^t, and we want x y 2^t, so divide one of ;; them first by 2^t. (if (not overflow?) - (LAP (ASR ,regnum:scratch-0 ,source1 (&U ,scheme-type-width)) - (MUL ,target ,regnum:scratch-0 ,source2)) + (LAP (ASR X ,regnum:scratch-0 ,source1 (&U ,scheme-type-width)) + (MUL X ,target ,regnum:scratch-0 ,source2)) (let* ((mask (allocate-temporary-register! 'GENERAL)) (hi (allocate-temporary-register! 'GENERAL))) ;; We're going to test whether the high 64-bits is equal to @@ -188,7 +188,7 @@ USA. (CMP X ,source2 (&U 0)) (CINV X LT ,mask ,mask) (ASR X ,regnum:scratch-0 ,source1 (&U ,scheme-type-width)) - (SMULH ,hi ,regnum:scratch-0 ,source2) + (SMULH X ,hi ,regnum:scratch-0 ,source2) (MUL X ,target ,regnum:scratch-0 ,source2) (CMP X ,mask ,hi)))))) -- 2.25.1