|
|
|
@ -30,19 +30,19 @@ pub(crate) fn parse<'a>(pos: &SourcePosition, keyword: &str, mut args: TokenPars |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
"inc" => { |
|
|
|
|
let dst = args.next_wr()?; |
|
|
|
|
let dst = args.next_rdwr()?; |
|
|
|
|
ArithOp::Add { |
|
|
|
|
dst, |
|
|
|
|
a: dst.as_rd(), |
|
|
|
|
dst: dst.wr(), |
|
|
|
|
a: dst.rd(), |
|
|
|
|
b: Rd::immediate(1), |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
"dec" => { |
|
|
|
|
let dst = args.next_wr()?; |
|
|
|
|
let dst = args.next_rdwr()?; |
|
|
|
|
ArithOp::Sub { |
|
|
|
|
dst, |
|
|
|
|
a: dst.as_rd(), |
|
|
|
|
dst: dst.wr(), |
|
|
|
|
a: dst.rd(), |
|
|
|
|
b: Rd::immediate(1), |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -57,10 +57,10 @@ pub(crate) fn parse<'a>(pos: &SourcePosition, keyword: &str, mut args: TokenPars |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
2 => { |
|
|
|
|
let dst = args.next_wr()?; |
|
|
|
|
let dst = args.next_rdwr()?; |
|
|
|
|
ArithOp::Add { |
|
|
|
|
dst, |
|
|
|
|
a: dst.as_rd(), |
|
|
|
|
dst: dst.wr(), |
|
|
|
|
a: dst.rd(), |
|
|
|
|
b: args.next_rd()?, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -80,10 +80,10 @@ pub(crate) fn parse<'a>(pos: &SourcePosition, keyword: &str, mut args: TokenPars |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
2 => { |
|
|
|
|
let dst = args.next_wr()?; |
|
|
|
|
let dst = args.next_rdwr()?; |
|
|
|
|
ArithOp::Sub { |
|
|
|
|
dst, |
|
|
|
|
a: dst.as_rd(), |
|
|
|
|
dst: dst.wr(), |
|
|
|
|
a: dst.rd(), |
|
|
|
|
b: args.next_rd()?, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -103,10 +103,10 @@ pub(crate) fn parse<'a>(pos: &SourcePosition, keyword: &str, mut args: TokenPars |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
2 => { |
|
|
|
|
let dst = args.next_wr()?; |
|
|
|
|
let dst = args.next_rdwr()?; |
|
|
|
|
ArithOp::Mul { |
|
|
|
|
dst, |
|
|
|
|
a: dst.as_rd(), |
|
|
|
|
dst: dst.wr(), |
|
|
|
|
a: dst.rd(), |
|
|
|
|
b: args.next_rd()?, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -119,13 +119,13 @@ pub(crate) fn parse<'a>(pos: &SourcePosition, keyword: &str, mut args: TokenPars |
|
|
|
|
"divr" => { |
|
|
|
|
match args.len() { |
|
|
|
|
3 => { |
|
|
|
|
let dst = args.next_wr()?; |
|
|
|
|
let dst = args.next_rdwr()?; |
|
|
|
|
let rem = args.next_wr()?; |
|
|
|
|
let div = args.next_rd()?; |
|
|
|
|
ArithOp::Div { |
|
|
|
|
dst, |
|
|
|
|
dst: dst.wr(), |
|
|
|
|
rem, |
|
|
|
|
a: dst.as_rd(), |
|
|
|
|
a: dst.rd(), |
|
|
|
|
div, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -154,12 +154,12 @@ pub(crate) fn parse<'a>(pos: &SourcePosition, keyword: &str, mut args: TokenPars |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
2 => { |
|
|
|
|
let dst = args.next_wr()?; |
|
|
|
|
let dst = args.next_rdwr()?; |
|
|
|
|
let div = args.next_rd()?; |
|
|
|
|
ArithOp::Div { |
|
|
|
|
dst, |
|
|
|
|
dst: dst.wr(), |
|
|
|
|
rem: Wr::discard(), |
|
|
|
|
a: dst.as_rd(), |
|
|
|
|
a: dst.rd(), |
|
|
|
|
div, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -179,11 +179,11 @@ pub(crate) fn parse<'a>(pos: &SourcePosition, keyword: &str, mut args: TokenPars |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
2 => { |
|
|
|
|
let dst = args.next_wr()?; |
|
|
|
|
let dst = args.next_rdwr()?; |
|
|
|
|
let div = args.next_rd()?; |
|
|
|
|
ArithOp::Mod { |
|
|
|
|
dst, |
|
|
|
|
a: dst.as_rd(), |
|
|
|
|
dst: dst.wr(), |
|
|
|
|
a: dst.rd(), |
|
|
|
|
div, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -203,10 +203,10 @@ pub(crate) fn parse<'a>(pos: &SourcePosition, keyword: &str, mut args: TokenPars |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
2 => { |
|
|
|
|
let dst = args.next_wr()?; |
|
|
|
|
let dst = args.next_rdwr()?; |
|
|
|
|
ArithOp::And { |
|
|
|
|
dst, |
|
|
|
|
a: dst.as_rd(), |
|
|
|
|
dst: dst.wr(), |
|
|
|
|
a: dst.rd(), |
|
|
|
|
b: args.next_rd()?, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -226,10 +226,10 @@ pub(crate) fn parse<'a>(pos: &SourcePosition, keyword: &str, mut args: TokenPars |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
2 => { |
|
|
|
|
let dst = args.next_wr()?; |
|
|
|
|
let dst = args.next_rdwr()?; |
|
|
|
|
ArithOp::Or { |
|
|
|
|
dst, |
|
|
|
|
a: dst.as_rd(), |
|
|
|
|
dst: dst.wr(), |
|
|
|
|
a: dst.rd(), |
|
|
|
|
b: args.next_rd()?, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -249,10 +249,10 @@ pub(crate) fn parse<'a>(pos: &SourcePosition, keyword: &str, mut args: TokenPars |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
2 => { |
|
|
|
|
let dst = args.next_wr()?; |
|
|
|
|
let dst = args.next_rdwr()?; |
|
|
|
|
ArithOp::Xor { |
|
|
|
|
dst, |
|
|
|
|
a: dst.as_rd(), |
|
|
|
|
dst: dst.wr(), |
|
|
|
|
a: dst.rd(), |
|
|
|
|
b: args.next_rd()?, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -271,10 +271,10 @@ pub(crate) fn parse<'a>(pos: &SourcePosition, keyword: &str, mut args: TokenPars |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
1 => { |
|
|
|
|
let dst = args.next_wr()?; |
|
|
|
|
let dst = args.next_rdwr()?; |
|
|
|
|
ArithOp::Cpl { |
|
|
|
|
dst, |
|
|
|
|
a: dst.as_rd(), |
|
|
|
|
dst: dst.wr(), |
|
|
|
|
a: dst.rd(), |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
_ => { |
|
|
|
@ -293,18 +293,18 @@ pub(crate) fn parse<'a>(pos: &SourcePosition, keyword: &str, mut args: TokenPars |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
2 => { |
|
|
|
|
let dst = args.next_wr()?; |
|
|
|
|
let dst = args.next_rdwr()?; |
|
|
|
|
ArithOp::Rol { |
|
|
|
|
dst, |
|
|
|
|
a: dst.as_rd(), |
|
|
|
|
dst: dst.wr(), |
|
|
|
|
a: dst.rd(), |
|
|
|
|
n: args.next_rd()?, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
1 => { |
|
|
|
|
let dst = args.next_wr()?; |
|
|
|
|
let dst = args.next_rdwr()?; |
|
|
|
|
ArithOp::Rol { |
|
|
|
|
dst, |
|
|
|
|
a: dst.as_rd(), |
|
|
|
|
dst: dst.wr(), |
|
|
|
|
a: dst.rd(), |
|
|
|
|
n: Rd::immediate(1), |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -324,18 +324,18 @@ pub(crate) fn parse<'a>(pos: &SourcePosition, keyword: &str, mut args: TokenPars |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
2 => { |
|
|
|
|
let dst = args.next_wr()?; |
|
|
|
|
let dst = args.next_rdwr()?; |
|
|
|
|
ArithOp::Ror { |
|
|
|
|
dst, |
|
|
|
|
a: dst.as_rd(), |
|
|
|
|
dst: dst.wr(), |
|
|
|
|
a: dst.rd(), |
|
|
|
|
n: args.next_rd()?, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
1 => { |
|
|
|
|
let dst = args.next_wr()?; |
|
|
|
|
let dst = args.next_rdwr()?; |
|
|
|
|
ArithOp::Ror { |
|
|
|
|
dst, |
|
|
|
|
a: dst.as_rd(), |
|
|
|
|
dst: dst.wr(), |
|
|
|
|
a: dst.rd(), |
|
|
|
|
n: Rd::immediate(1), |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -355,18 +355,18 @@ pub(crate) fn parse<'a>(pos: &SourcePosition, keyword: &str, mut args: TokenPars |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
2 => { |
|
|
|
|
let dst = args.next_wr()?; |
|
|
|
|
let dst = args.next_rdwr()?; |
|
|
|
|
ArithOp::Lsl { |
|
|
|
|
dst, |
|
|
|
|
a: dst.as_rd(), |
|
|
|
|
dst: dst.wr(), |
|
|
|
|
a: dst.rd(), |
|
|
|
|
n: args.next_rd()?, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
1 => { |
|
|
|
|
let dst = args.next_wr()?; |
|
|
|
|
let dst = args.next_rdwr()?; |
|
|
|
|
ArithOp::Lsl { |
|
|
|
|
dst, |
|
|
|
|
a: dst.as_rd(), |
|
|
|
|
dst: dst.wr(), |
|
|
|
|
a: dst.rd(), |
|
|
|
|
n: Rd::immediate(1), |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -386,18 +386,18 @@ pub(crate) fn parse<'a>(pos: &SourcePosition, keyword: &str, mut args: TokenPars |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
2 => { |
|
|
|
|
let dst = args.next_wr()?; |
|
|
|
|
let dst = args.next_rdwr()?; |
|
|
|
|
ArithOp::Lsr { |
|
|
|
|
dst, |
|
|
|
|
a: dst.as_rd(), |
|
|
|
|
dst: dst.wr(), |
|
|
|
|
a: dst.rd(), |
|
|
|
|
n: args.next_rd()?, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
1 => { |
|
|
|
|
let dst = args.next_wr()?; |
|
|
|
|
let dst = args.next_rdwr()?; |
|
|
|
|
ArithOp::Lsr { |
|
|
|
|
dst, |
|
|
|
|
a: dst.as_rd(), |
|
|
|
|
dst: dst.wr(), |
|
|
|
|
a: dst.rd(), |
|
|
|
|
n: Rd::immediate(1), |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -417,18 +417,18 @@ pub(crate) fn parse<'a>(pos: &SourcePosition, keyword: &str, mut args: TokenPars |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
2 => { |
|
|
|
|
let dst = args.next_wr()?; |
|
|
|
|
let dst = args.next_rdwr()?; |
|
|
|
|
ArithOp::Asr { |
|
|
|
|
dst, |
|
|
|
|
a: dst.as_rd(), |
|
|
|
|
dst: dst.wr(), |
|
|
|
|
a: dst.rd(), |
|
|
|
|
n: args.next_rd()?, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
1 => { |
|
|
|
|
let dst = args.next_wr()?; |
|
|
|
|
let dst = args.next_rdwr()?; |
|
|
|
|
ArithOp::Asr { |
|
|
|
|
dst, |
|
|
|
|
a: dst.as_rd(), |
|
|
|
|
dst: dst.wr(), |
|
|
|
|
a: dst.rd(), |
|
|
|
|
n: Rd::immediate(1), |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|