mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 09:09:19 +02:00
* patch by Christo Crause to support ~ in att assembler
* allow -128 to 255 as a constant for instructions taking a byte sized constants (this is also what GNU As accepts), resolves #32039 git-svn-id: trunk@38316 -
This commit is contained in:
parent
2b2d41aa27
commit
d0dd3bd74e
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -15955,6 +15955,7 @@ tests/webtbs/tw3190.pp svneol=native#text/plain
|
|||||||
tests/webtbs/tw31945.pp svneol=native#text/pascal
|
tests/webtbs/tw31945.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw3197.pp svneol=native#text/plain
|
tests/webtbs/tw3197.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw32019.pp svneol=native#text/plain
|
tests/webtbs/tw32019.pp svneol=native#text/plain
|
||||||
|
tests/webtbs/tw32039.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw32040.pp svneol=native#text/pascal
|
tests/webtbs/tw32040.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw32043.pp svneol=native#text/pascal
|
tests/webtbs/tw32043.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw32046.pp svneol=native#text/plain
|
tests/webtbs/tw32046.pp svneol=native#text/plain
|
||||||
|
@ -71,11 +71,11 @@ unit raavr;
|
|||||||
// A_SUB
|
// A_SUB
|
||||||
(numOperands: (1 shl 2); Operands: ((typ: top_reg; rt: rt_all), (typ: top_reg; rt: rt_all), (typ: top_none), (typ: top_none))),
|
(numOperands: (1 shl 2); Operands: ((typ: top_reg; rt: rt_all), (typ: top_reg; rt: rt_all), (typ: top_none), (typ: top_none))),
|
||||||
// A_SUBI
|
// A_SUBI
|
||||||
(numOperands: (1 shl 2); Operands: ((typ: top_reg; rt: rt_16_31), (typ: top_const; max: 255; min: 0), (typ: top_none), (typ: top_none))),
|
(numOperands: (1 shl 2); Operands: ((typ: top_reg; rt: rt_16_31), (typ: top_const; max: 255; min: -128), (typ: top_none), (typ: top_none))),
|
||||||
// A_SBC
|
// A_SBC
|
||||||
(numOperands: (1 shl 2); Operands: ((typ: top_reg; rt: rt_all), (typ: top_reg; rt: rt_all), (typ: top_none), (typ: top_none))),
|
(numOperands: (1 shl 2); Operands: ((typ: top_reg; rt: rt_all), (typ: top_reg; rt: rt_all), (typ: top_none), (typ: top_none))),
|
||||||
// A_SBCI
|
// A_SBCI
|
||||||
(numOperands: (1 shl 2); Operands: ((typ: top_reg; rt: rt_16_31), (typ: top_const; max: 255; min: 0), (typ: top_none), (typ: top_none))),
|
(numOperands: (1 shl 2); Operands: ((typ: top_reg; rt: rt_16_31), (typ: top_const; max: 255; min: -128), (typ: top_none), (typ: top_none))),
|
||||||
// A_SBRC
|
// A_SBRC
|
||||||
(numOperands: (1 shl 2); Operands: ((typ: top_reg; rt: rt_all), (typ: top_const; max: 7; min: 0), (typ: top_none), (typ: top_none))),
|
(numOperands: (1 shl 2); Operands: ((typ: top_reg; rt: rt_all), (typ: top_const; max: 7; min: 0), (typ: top_none), (typ: top_none))),
|
||||||
// A_SBRS
|
// A_SBRS
|
||||||
@ -85,11 +85,11 @@ unit raavr;
|
|||||||
// A_AND
|
// A_AND
|
||||||
(numOperands: (1 shl 2); Operands: ((typ: top_reg; rt: rt_all), (typ: top_reg; rt: rt_all), (typ: top_none), (typ: top_none))),
|
(numOperands: (1 shl 2); Operands: ((typ: top_reg; rt: rt_all), (typ: top_reg; rt: rt_all), (typ: top_none), (typ: top_none))),
|
||||||
// A_ANDI
|
// A_ANDI
|
||||||
(numOperands: (1 shl 2); Operands: ((typ: top_reg; rt: rt_16_31), (typ: top_const; max: 255; min: 0), (typ: top_none), (typ: top_none))),
|
(numOperands: (1 shl 2); Operands: ((typ: top_reg; rt: rt_16_31), (typ: top_const; max: 255; min: -128), (typ: top_none), (typ: top_none))),
|
||||||
// A_OR
|
// A_OR
|
||||||
(numOperands: (1 shl 2); Operands: ((typ: top_reg; rt: rt_all), (typ: top_reg; rt: rt_all), (typ: top_none), (typ: top_none))),
|
(numOperands: (1 shl 2); Operands: ((typ: top_reg; rt: rt_all), (typ: top_reg; rt: rt_all), (typ: top_none), (typ: top_none))),
|
||||||
// A_ORI
|
// A_ORI
|
||||||
(numOperands: (1 shl 2); Operands: ((typ: top_reg; rt: rt_16_31), (typ: top_const; max: 255; min: 0), (typ: top_none), (typ: top_none))),
|
(numOperands: (1 shl 2); Operands: ((typ: top_reg; rt: rt_16_31), (typ: top_const; max: 255; min: -128), (typ: top_none), (typ: top_none))),
|
||||||
// A_EOR
|
// A_EOR
|
||||||
(numOperands: (1 shl 2); Operands: ((typ: top_reg; rt: rt_all), (typ: top_reg; rt: rt_all), (typ: top_none), (typ: top_none))),
|
(numOperands: (1 shl 2); Operands: ((typ: top_reg; rt: rt_all), (typ: top_reg; rt: rt_all), (typ: top_none), (typ: top_none))),
|
||||||
// A_COM
|
// A_COM
|
||||||
@ -97,9 +97,9 @@ unit raavr;
|
|||||||
// A_NEG
|
// A_NEG
|
||||||
(numOperands: (1 shl 1); Operands: ((typ: top_reg; rt: rt_all), (typ: top_none), (typ: top_none), (typ: top_none))),
|
(numOperands: (1 shl 1); Operands: ((typ: top_reg; rt: rt_all), (typ: top_none), (typ: top_none), (typ: top_none))),
|
||||||
// A_SBR
|
// A_SBR
|
||||||
(numOperands: (1 shl 2); Operands: ((typ: top_reg; rt: rt_16_31), (typ: top_const; max: 255; min: 0), (typ: top_none), (typ: top_none))),
|
(numOperands: (1 shl 2); Operands: ((typ: top_reg; rt: rt_16_31), (typ: top_const; max: 255; min: -128), (typ: top_none), (typ: top_none))),
|
||||||
// A_CBR
|
// A_CBR
|
||||||
(numOperands: (1 shl 2); Operands: ((typ: top_reg; rt: rt_16_31), (typ: top_const; max: 255; min: 0), (typ: top_none), (typ: top_none))),
|
(numOperands: (1 shl 2); Operands: ((typ: top_reg; rt: rt_16_31), (typ: top_const; max: 255; min: -128), (typ: top_none), (typ: top_none))),
|
||||||
// A_INC
|
// A_INC
|
||||||
(numOperands: (1 shl 1); Operands: ((typ: top_reg; rt: rt_all), (typ: top_none), (typ: top_none), (typ: top_none))),
|
(numOperands: (1 shl 1); Operands: ((typ: top_reg; rt: rt_all), (typ: top_none), (typ: top_none), (typ: top_none))),
|
||||||
// A_DEC
|
// A_DEC
|
||||||
@ -145,7 +145,7 @@ unit raavr;
|
|||||||
// A_CPC
|
// A_CPC
|
||||||
(numOperands: (1 shl 2); Operands: ((typ: top_reg; rt: rt_all), (typ: top_reg; rt: rt_all), (typ: top_none), (typ: top_none))),
|
(numOperands: (1 shl 2); Operands: ((typ: top_reg; rt: rt_all), (typ: top_reg; rt: rt_all), (typ: top_none), (typ: top_none))),
|
||||||
// A_CPI
|
// A_CPI
|
||||||
(numOperands: (1 shl 2); Operands: ((typ: top_reg; rt: rt_16_31), (typ: top_const; max: 255; min: 0), (typ: top_none), (typ: top_none))),
|
(numOperands: (1 shl 2); Operands: ((typ: top_reg; rt: rt_16_31), (typ: top_const; max: 255; min: -128), (typ: top_none), (typ: top_none))),
|
||||||
// A_SBIC
|
// A_SBIC
|
||||||
(numOperands: (1 shl 2); Operands: ((typ: top_const; max: 31; min: 0), (typ: top_const; max: 7; min: 0), (typ: top_none), (typ: top_none))),
|
(numOperands: (1 shl 2); Operands: ((typ: top_const; max: 31; min: 0), (typ: top_const; max: 7; min: 0), (typ: top_none), (typ: top_none))),
|
||||||
// A_SBIS
|
// A_SBIS
|
||||||
@ -157,7 +157,7 @@ unit raavr;
|
|||||||
// A_MOVW
|
// A_MOVW
|
||||||
(numOperands: (1 shl 2); Operands: ((typ: top_reg; rt: rt_even), (typ: top_reg; rt: rt_even), (typ: top_none), (typ: top_none))),
|
(numOperands: (1 shl 2); Operands: ((typ: top_reg; rt: rt_even), (typ: top_reg; rt: rt_even), (typ: top_none), (typ: top_none))),
|
||||||
// A_LDI
|
// A_LDI
|
||||||
(numOperands: (1 shl 2); Operands: ((typ: top_reg; rt: rt_16_31), (typ: top_const; max: 255; min: 0), (typ: top_none), (typ: top_none))),
|
(numOperands: (1 shl 2); Operands: ((typ: top_reg; rt: rt_16_31), (typ: top_const; max: 255; min: -128), (typ: top_none), (typ: top_none))),
|
||||||
// A_LDS TODO: There are 2 versions with different machine codes and constant ranges. Could possibly distinguish based on size of PC?
|
// A_LDS TODO: There are 2 versions with different machine codes and constant ranges. Could possibly distinguish based on size of PC?
|
||||||
// Perhaps handle separately with a check on sub-architecture? Range check only important if smaller instruction code selected on larger arch
|
// Perhaps handle separately with a check on sub-architecture? Range check only important if smaller instruction code selected on larger arch
|
||||||
(numOperands: (1 shl 2); Operands: ((typ: top_reg; rt: rt_all), (typ: top_const; max: 65535; min: 0), (typ: top_none), (typ: top_none))),
|
(numOperands: (1 shl 2); Operands: ((typ: top_reg; rt: rt_all), (typ: top_const; max: 65535; min: 0), (typ: top_none), (typ: top_none))),
|
||||||
|
@ -343,7 +343,8 @@ Unit raavrgas;
|
|||||||
|
|
||||||
AS_INTNUM,
|
AS_INTNUM,
|
||||||
AS_MINUS,
|
AS_MINUS,
|
||||||
AS_PLUS:
|
AS_PLUS,
|
||||||
|
AS_NOT:
|
||||||
Begin
|
Begin
|
||||||
if (actasmtoken=AS_MINUS) and
|
if (actasmtoken=AS_MINUS) and
|
||||||
(actopcode in [A_LD,A_ST]) then
|
(actopcode in [A_LD,A_ST]) then
|
||||||
|
@ -794,7 +794,7 @@ unit raatt;
|
|||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
'!' :
|
'!', '~' :
|
||||||
begin
|
begin
|
||||||
actasmtoken:=AS_NOT;
|
actasmtoken:=AS_NOT;
|
||||||
c:=current_scanner.asmgetchar;
|
c:=current_scanner.asmgetchar;
|
||||||
|
9
tests/webtbs/tw32039.pp
Normal file
9
tests/webtbs/tw32039.pp
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{ %cpu=avr }
|
||||||
|
{ %norun }
|
||||||
|
const
|
||||||
|
foo = %00011000;
|
||||||
|
begin
|
||||||
|
asm
|
||||||
|
andi r16, ~foo
|
||||||
|
end;
|
||||||
|
end.
|
Loading…
Reference in New Issue
Block a user