diff --git a/.gitattributes b/.gitattributes index 65bbc77b54..cbfd248422 100644 --- a/.gitattributes +++ b/.gitattributes @@ -15955,6 +15955,7 @@ tests/webtbs/tw3190.pp svneol=native#text/plain tests/webtbs/tw31945.pp svneol=native#text/pascal tests/webtbs/tw3197.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/tw32043.pp svneol=native#text/pascal tests/webtbs/tw32046.pp svneol=native#text/plain diff --git a/compiler/avr/raavr.pas b/compiler/avr/raavr.pas index d1ca57592b..9af055edaf 100644 --- a/compiler/avr/raavr.pas +++ b/compiler/avr/raavr.pas @@ -71,11 +71,11 @@ unit raavr; // 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))), // 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 (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 - (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 (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 @@ -85,11 +85,11 @@ unit raavr; // 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))), // 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 (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 - (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 (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 @@ -97,9 +97,9 @@ unit raavr; // A_NEG (numOperands: (1 shl 1); Operands: ((typ: top_reg; rt: rt_all), (typ: top_none), (typ: top_none), (typ: top_none))), // 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 - (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 (numOperands: (1 shl 1); Operands: ((typ: top_reg; rt: rt_all), (typ: top_none), (typ: top_none), (typ: top_none))), // A_DEC @@ -145,7 +145,7 @@ unit raavr; // 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))), // 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 (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 @@ -157,7 +157,7 @@ unit raavr; // 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))), // 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? // 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))), diff --git a/compiler/avr/raavrgas.pas b/compiler/avr/raavrgas.pas index c2a043f3da..a29da47348 100644 --- a/compiler/avr/raavrgas.pas +++ b/compiler/avr/raavrgas.pas @@ -343,7 +343,8 @@ Unit raavrgas; AS_INTNUM, AS_MINUS, - AS_PLUS: + AS_PLUS, + AS_NOT: Begin if (actasmtoken=AS_MINUS) and (actopcode in [A_LD,A_ST]) then diff --git a/compiler/raatt.pas b/compiler/raatt.pas index 64630b9b9c..4deeffea45 100644 --- a/compiler/raatt.pas +++ b/compiler/raatt.pas @@ -794,7 +794,7 @@ unit raatt; exit; end; - '!' : + '!', '~' : begin actasmtoken:=AS_NOT; c:=current_scanner.asmgetchar; diff --git a/tests/webtbs/tw32039.pp b/tests/webtbs/tw32039.pp new file mode 100644 index 0000000000..6c743453ec --- /dev/null +++ b/tests/webtbs/tw32039.pp @@ -0,0 +1,9 @@ +{ %cpu=avr } +{ %norun } +const + foo = %00011000; +begin + asm + andi r16, ~foo + end; +end.