summaryrefslogtreecommitdiff
path: root/compiler/arm/cpubase.pas
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/arm/cpubase.pas')
-rw-r--r--compiler/arm/cpubase.pas35
1 files changed, 25 insertions, 10 deletions
diff --git a/compiler/arm/cpubase.pas b/compiler/arm/cpubase.pas
index afb8ebd895..2f0b715264 100644
--- a/compiler/arm/cpubase.pas
+++ b/compiler/arm/cpubase.pas
@@ -503,16 +503,31 @@ unit cpubase;
var
i : longint;
begin
- for i:=0 to 15 do
- begin
- if (dword(d) and not(rotl($ff,i*2)))=0 then
- begin
- imm_shift:=i*2;
- result:=true;
- exit;
- end;
- end;
- result:=false;
+ if current_settings.cputype in cpu_thumb2 then
+ begin
+ for i:=0 to 24 do
+ begin
+ if (dword(d) and not($ff shl i))=0 then
+ begin
+ imm_shift:=i;
+ result:=true;
+ exit;
+ end;
+ end;
+ end
+ else
+ begin
+ for i:=0 to 15 do
+ begin
+ if (dword(d) and not(rotl($ff,i*2)))=0 then
+ begin
+ imm_shift:=i*2;
+ result:=true;
+ exit;
+ end;
+ end;
+ end;
+ result:=false;
end;