From 038a0c2eea2d946d0fa467e9cd6dc14e0a5b5020 Mon Sep 17 00:00:00 2001
From: Taylor R Campbell <campbell@mumble.net>
Date: Mon, 21 Jan 2019 19:05:51 +0000
Subject: [PATCH] Fix case.

---
 src/compiler/machines/aarch64/instr1.scm | 4 ++--
 src/compiler/machines/aarch64/rulfix.scm | 9 +++++----
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/compiler/machines/aarch64/instr1.scm b/src/compiler/machines/aarch64/instr1.scm
index 16a5b5080..0ac693a43 100644
--- a/src/compiler/machines/aarch64/instr1.scm
+++ b/src/compiler/machines/aarch64/instr1.scm
@@ -1660,8 +1660,8 @@ USA.
                      (5 Ra)
                      (5 Rn)
                      (5 Rd)))))))))
-  (define-muladdsub-instruction madd #b000 0) ;Multiply-Add
-  (define-muladdsub-instruction msub #b000 1)) ;Multiply-Subtract
+  (define-muladdsub-instruction MADD #b000 0) ;Multiply-Add
+  (define-muladdsub-instruction MSUB #b000 1)) ;Multiply-Subtract
 
 (let-syntax
     ((define-widemul-instruction
diff --git a/src/compiler/machines/aarch64/rulfix.scm b/src/compiler/machines/aarch64/rulfix.scm
index 82349f134..ae0930d79 100644
--- a/src/compiler/machines/aarch64/rulfix.scm
+++ b/src/compiler/machines/aarch64/rulfix.scm
@@ -197,6 +197,8 @@ USA.
     (if (= source1 source2)             ;XXX Avoid this earlier on.
         (load-fixnum-constant target 1)
         (LAP (SDIV X ,target ,source1 ,source2)
+             ;; source1 = n 2^t, source2 = d 2^t, target = q
+             ;; target := q 2^t
              (LSL X ,target ,target (&U ,scheme-type-width))))))
 
 (define-arithmetic-method 'FIXNUM-REMAINDER fixnum-methods/2-args
@@ -205,10 +207,9 @@ USA.
     (if (= source1 source2)             ;XXX Avoid this earlier on.
         (load-fixnum-constant target 0)
         (LAP (SDIV X ,target ,source1 ,source2)
-             ;; source1 = n, source2 = d, target = q
-             ;; target := n - d*q
-             (MSUB X ,target ,source1 ,source2 ,target)
-             (LSL X ,target ,target (&U ,scheme-type-width))))))
+             ;; source1 = n 2^t, source2 = d 2^t, target = q
+             ;; target := (n - d*q) 2^t
+             (MSUB X ,target ,source2 ,target ,source1)))))
 
 ;; XXX Constant operands.
 ;; XXX Fast division by multiplication.
-- 
2.25.1