]=, ^=, also *fixed variable sar in previous compilers*

This commit is contained in:
pommicket 2021-11-13 13:12:38 -05:00
parent 2eea57df8a
commit 383d1fbe27
6 changed files with 123 additions and 5 deletions

View file

@ -12240,7 +12240,7 @@ cc cc cc cc cc cc cc cc
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
03 f8 d3 f8 00 00 00 00
03 48 d3 f8 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00

View file

@ -12458,7 +12458,7 @@ the formatting changed appropriately.
;00;00;00;00;00;00;00;00
;00;00;00;00;00;00;00;00
;00;00;00;00;00;00;00;00
;03;f8;d3;f8;00;00;00;00
;03;48;d3;f8;00;00;00;00
;00;00;00;00;00;00;00;00
;00;00;00;00;00;00;00;00
;00;00;00;00;00;00;00;00

View file

@ -1,5 +1,5 @@
all: out02
out02: in02
out02: in02 ../02/out01
../02/out01
out03: out02 in03
./out02

113
03/in02
View file

@ -158,6 +158,10 @@ im
je
:-|= X|=Y
im
##5e. ascii '^'
je
:-^= X^=Y
im
##3c. ascii '<'
je
:-<= X<=C / X<=imm
@ -166,6 +170,10 @@ im
je
:->= X>=C / X>=imm
im
##5d. ascii ']'
je
:-]= X]=C / X]=imm
im
##3d. ascii '='
je
:-x= X=imm / X=:label / X=nY
@ -322,6 +330,37 @@ jm
:-rl next line
::|B
|B
// deal with bitwise xor
::^=
im
--=?
cl
// put operand 1 in rbx,
im
--B1
cl
// operand 2 in rax
im
--A2
cl
// emit 'xor rax, rbx'
im
--^B
IA
im
##3.
DA
im
--wr
cl
// put rax in operand 1
im
--1A
cl
jm
:-rl next line
::^B
^B
// deal with left shift
::<=
im
@ -434,6 +473,62 @@ jm
:-rl next line
::>I
>I
// deal with arithmetic right shift
::]=
im
--=?
cl
im
--A1 put operand 1 in rax
cl
// look at 2nd operand (line[3])
im
##3.
BA
im
--LI
+B
BA
zA
lb
BA
im
##43. ascii 'C'
je
:-]c non-constant shift
// write sar rax,
im
--]I
IA
im
##3.
DA
im
--wr
cl
// now write immediate. calculate number
im
##3.
BA
im
--LI
+B
BA
im
--nu
cl
// we now have the shift amount in rax. write it to the file
BA
im
--wb
cl
im
--1A put rax back in operand 1
cl
jm
:-rl next line
::]I
]I
// left shift by cl
::<c
im
@ -470,6 +565,24 @@ jm
:-rl next line
::>C
>C
// arithmetic right shift by cl
::]c
im
--]C
IA
im
##3.
DA
im
--wr
cl emit 'sar rax, cl'
im
--1A put rax back in operand 1
cl
jm
:-rl next line
::]C
]C
// deal with set immediate (e.g. "A=d3, B=:label, C=1B")
::x=
im

View file

@ -1,5 +1,10 @@
D|=C
D]=d7
e
D]=C
D^=C
D|=C
D&=C
~C
B|=A

View file

@ -70,7 +70,7 @@ shr rax, cl
shr rax, imm8
>48 c1 e8 IMM8
sar rax, cl
>f8 d3 f8
>48 d3 f8
sar rax, imm8
>48 c1 f8 IMM8
sub rsp, imm32