summary refs log tree commit diff
path: root/amd64.e
diff options
context:
space:
mode:
Diffstat (limited to 'amd64.e')
-rw-r--r--amd64.e20
1 files changed, 17 insertions, 3 deletions
diff --git a/amd64.e b/amd64.e
index 8e53822..4b4a2bd 100644
--- a/amd64.e
+++ b/amd64.e
@@ -105,7 +105,7 @@ s" :bh" keyword
 ~   The condition codes. Yes, there sure is a lot of duplication in these
 ~ names. The names are based on Intel's documented mnemonics...
 ~
-~   "Above" and "below" are for unsigned comparisons. "Greater" and "less"  are
+~   "Above" and "below" are for unsigned comparisons. "Greater" and "less" are
 ~ for signed comparisons.
 ~
 ~   This is documented on the individual opcode pages, and also in B.1.4.7.
@@ -475,9 +475,15 @@ s" :cc-greater" keyword
 
 ~ (output point, source register -- output point)
 : push-reg64 reg64 0x50 opcodereg ;
+: push-extrareg64 swap rex-b swap extrareg64 0x50 opcodereg ;
+  ~   Note the use of the B rex bit here; this instruction puts the register
+  ~ number in the opcode field, so it uses Table 3-1.
 
 ~ (output point, target register -- output point)
 : pop-reg64 reg64 0x58 opcodereg ;
+: pop-extrareg64 swap rex-b swap extrareg64 0x58 opcodereg ;
+  ~   Note the use of the B rex bit here; this instruction puts the register
+  ~ number in the opcode field, so it uses Table 3-1.
 
 ~ (output point, immediate value -- output point)
 : push-imm32-extended64 swap 0x68 pack8 swap pack32 ;
@@ -859,8 +865,16 @@ s" :cc-greater" keyword
   3roll rex-w 0x3B pack8 3unroll
   reg64 swap addressing-reg64 ;
 
-~   Pretend to xor left with right, and set the flags the same way as if we
-~ actually had.
+~ (output point, left register, right value -- output point)
+: cmp-reg64-imm8
+  3roll rex-w 0x83 pack8
+  ~ (left register, right value, output point)
+  3roll 7 swap addressing-reg64
+  ~ ( output point, right value)
+  pack8 ;
+
+~   Pretend to bitwise-and left with right, and set the flags the same way as
+~ if we actually had.
 ~
 ~   The names of the condition codes can be a little confusing when using them
 ~ after "test", because they're really premised on the idea that you did