diff options
| author | Irene Knapp <ireneista@irenes.space> | 2026-05-23 22:47:35 -0700 |
|---|---|---|
| committer | Irene Knapp <ireneista@irenes.space> | 2026-05-23 22:47:35 -0700 |
| commit | fa77a37199208fa207202e62f409e1371c5f03f3 (patch) | |
| tree | fc58aee7e0fbd3dc012277724622a75a3f4a9ff0 /amd64.e | |
| parent | d65031570a3f678b03b29ea8a2293e0b8fad7907 (diff) | |
added a couple new instructions
this turns out to be fairly involved. hex bootstrap can't come fast enough ;) Force-Push: yes Change-Id: Ide5d2207d745ad07c40d3c9f457cd6b491bfbcf0
Diffstat (limited to 'amd64.e')
| -rw-r--r-- | amd64.e | 20 |
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 |