about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--mu.md3
-rw-r--r--mu_instructions4
2 files changed, 7 insertions, 0 deletions
diff --git a/mu.md b/mu.md
index c3b456bf..34054aa9 100644
--- a/mu.md
+++ b/mu.md
@@ -185,6 +185,9 @@ xor-with var1, var2/reg
 var/reg <- xor n
 xor-with var, n
 
+var1/reg1 <- negate
+negate var
+
 var/reg <- copy var2/reg2
 copy-to var1, var2/reg
 var/reg <- copy var2
diff --git a/mu_instructions b/mu_instructions
index 9c16607e..4248f680 100644
--- a/mu_instructions
+++ b/mu_instructions
@@ -81,6 +81,10 @@ var/reg <- xor n                  => "81 6/subop/xor %" reg " " n "/imm32"
 xor-with var, n                   => "81 6/subop/xor *(ebp+" var.stack-offset ") " n "/imm32"
 xor-with *var/reg, n              => "81 6/subop/xor *" reg " " n "/imm32"
 
+var/reg <- negate                 => "f7 3/subop/negate %" reg
+negate var                        => "f7 3/subop/negate *(ebp+" var.stack-offset ")"
+negate *var/reg                   => "f7 3/subop/negate *" reg
+
 var/reg <- shift-left n           => "c1/shift 4/subop/left %" reg " " n "/imm32"
 var/reg <- shift-right n          => "c1/shift 5/subop/right %" reg " " n "/imm32"
 var/reg <- shift-right-signed n   => "c1/shift 7/subop/right-signed %" reg " " n "/imm32"