From 755f7a806f5fb5369563985e5ca00d934f885822 Mon Sep 17 00:00:00 2001 From: Raymond Toy <toy.raymond@gmail.com> Date: Mon, 11 Jan 2021 20:05:32 -0800 Subject: [PATCH] Fix #98: Use FSTP instruction with appropriate size Instead of printing `FSTP` and `FSTPD`, print `FSTP DWORD PTR` and `FSTP QWORD PTR` to store a single-float and double-float value to memory. Clang likes this form better than the original, but gcc accepts both. --- src/compiler/x86/insts.lisp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/compiler/x86/insts.lisp b/src/compiler/x86/insts.lisp index 021d6d7ff..23fab7a82 100644 --- a/src/compiler/x86/insts.lisp +++ b/src/compiler/x86/insts.lisp @@ -2636,7 +2636,8 @@ ;;; store single from st(0) and pop ;;; (define-instruction fstp (segment dest) - (:printer floating-point ((op '(#b001 #b011)))) + (:printer floating-point ((op '(#b001 #b011))) + '('fstp :tab 'dword " " 'ptr " " reg/mem)) (:emitter (cond ((fp-reg-tn-p dest) (emit-byte segment #b11011101) @@ -2648,7 +2649,8 @@ ;;; store double from st(0) and pop ;;; (define-instruction fstpd (segment dest) - (:printer floating-point ((op '(#b101 #b011)))) + (:printer floating-point ((op '(#b101 #b011))) + '('fstp :tab 'qword " " 'ptr " " reg/mem)) (:printer floating-point-fp ((op '(#b101 #b011)))) (:emitter (cond ((fp-reg-tn-p dest) -- GitLab