From 3b205742b65400d15255bcdfa931498b8abe66f8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?K=C3=A1roly=20Balogh?= <karoly@freepascal.org>
Date: Sun, 14 Sep 2014 12:47:07 +0000
Subject: [PATCH] m68k: also try to optimize a special case of OP_SAR using the
 SWAP instruction

git-svn-id: trunk@28657 -
---
 compiler/m68k/cgcpu.pas | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/compiler/m68k/cgcpu.pas b/compiler/m68k/cgcpu.pas
index 3ce8873ced..f17ec82a20 100644
--- a/compiler/m68k/cgcpu.pas
+++ b/compiler/m68k/cgcpu.pas
@@ -1138,6 +1138,11 @@ unit cgcpu;
                         list.concat(taicpu.op_reg(A_CLR,S_W,scratch_reg));
                         list.concat(taicpu.op_reg(A_SWAP,S_NO,scratch_reg));
                       end
+                    else if (op = OP_SAR) then
+                      begin
+                        list.concat(taicpu.op_reg(A_SWAP,S_NO,scratch_reg));
+                        list.concat(taicpu.op_reg(A_EXT,S_L,scratch_reg));
+                      end
                     else if (op = OP_ROR) or (op = OP_ROL) then
                       list.concat(taicpu.op_reg(A_SWAP,S_NO,scratch_reg))
                   end