;
>>
-HELP: double-2-rep
-{ $var-description "Representation for a pair of doubles." } ;
-
-HELP: signed-rep
-{ $values { "rep" representation } { "rep'" representation } }
-{ $description "Maps any representation to its signed counterpart, if it has one." } ;
-
-HELP: rep-size
-{ $values { "rep" representation } { "n" integer } }
-{ $description "Size in bytes of a representation." } ;
-
-HELP: immediate-arithmetic?
-{ $values { "n" number } { "?" boolean } }
-{ $description
- "Can this value be an immediate operand for " { $link %add-imm } ", "
- { $link %sub-imm } ", or " { $link %mul-imm } "?"
-} ;
-
-HELP: machine-registers
-{ $values { "assoc" assoc } }
-{ $description "Mapping from register class to machine registers. Only registers not reserved by the Factor VM are included." } ;
-
-HELP: vm-stack-space
-{ $values { "n" number } }
-{ $description "Parameter space to reserve in anything making VM calls." } ;
-
-HELP: complex-addressing?
-{ $values { "?" boolean } }
-{ $description "Specifies if " { $link %slot } ", " { $link %set-slot } " and " { $link %write-barrier } " accept the 'scale' and 'tag' parameters, and if %load-memory and %store-memory work." } ;
-
-HELP: param-regs
-{ $values { "abi" "a calling convention symbol" } { "regs" assoc } }
-{ $description "Retrieves the order in which machine registers are used for parameters for the given calling convention." } ;
-
HELP: %alien-invoke
{ $values
{ "reg-inputs" sequence }
{ $unchecked-example $[ ex-%allot ] }
} ;
+HELP: %and-imm
+{ $values
+ { "dst" "destination register" }
+ { "src1" "first source register" }
+ { "src2" "second source register" }
+}
+{ $description "Emits an " { $link AND } " instruction between a register and an immediate." } ;
+
HELP: %box
{ $values
{ "dst" "destination register" }
{ "src" integer }
{ "loc" loc }
}
-{ $description "Emits machine code for putting an integer on the stack." }
+{ $description "Emits machine code for putting a literal on the stack." }
{ $examples
{ $unchecked-example
"USING: cpu.architecture make ;"
}
} ;
+HELP: %shl-imm
+{ $values
+ { "dst" "register" }
+ { "src1" "register" }
+ { "src2" integer }
+} { $description "Bitshifts the value in a register left by a constant." }
+{ $see-also ##shl-imm } ;
+
HELP: %store-memory-imm
{ $values
{ "value" "source register" }
}
} ;
+HELP: %test-imm-branch
+{ $values
+ { "label" "branch destination" }
+ { "src1" "register" }
+ { "src2" "immediate" }
+ { "cc" "comparison symbol" }
+} { $description "Emits a TEST instruction with a register and an immediate, followed by a branch." } ;
+
HELP: %vector>scalar
{ $values
{ "dst" "destination register" }
{ $description "Generates code for the " { $link ##write-barrier } " instruction." }
{ $examples { $unchecked-example $[ ex-%write-barrier ] } } ;
+HELP: double-2-rep
+{ $var-description "Representation for a pair of doubles." } ;
+
+HELP: signed-rep
+{ $values { "rep" representation } { "rep'" representation } }
+{ $description "Maps any representation to its signed counterpart, if it has one." } ;
+
+HELP: rep-size
+{ $values { "rep" representation } { "n" integer } }
+{ $description "Size in bytes of a representation." } ;
+
+HELP: immediate-arithmetic?
+{ $values { "n" number } { "?" boolean } }
+{ $description
+ "Can this value be an immediate operand for " { $link %add-imm } ", "
+ { $link %sub-imm } ", or " { $link %mul-imm } "?"
+} ;
+
+HELP: machine-registers
+{ $values { "assoc" assoc } }
+{ $description "Mapping from register class to machine registers. Only registers not reserved by the Factor VM are included." } ;
+
+HELP: vm-stack-space
+{ $values { "n" number } }
+{ $description "Parameter space to reserve in anything making VM calls." } ;
+
+HELP: complex-addressing?
+{ $values { "?" boolean } }
+{ $description "Specifies if " { $link %slot } ", " { $link %set-slot } " and " { $link %write-barrier } " accept the 'scale' and 'tag' parameters, and if %load-memory and %store-memory work." } ;
+
+HELP: param-regs
+{ $values { "abi" "a calling convention symbol" } { "regs" assoc } }
+{ $description "Retrieves the order in which machine registers are used for parameters for the given calling convention." } ;
HELP: test-instruction?
{ $values { "?" boolean } }
{ $description "Does the current architecture have a test instruction? Used on x86 to rewrite some " { $link CMP } " instructions to less expensive " { $link TEST } "s." } ;
{ $values { "dst" "destination" } { "src" "source" } }
{ $description "Moves a value from one place to another." } ;
+HELP: MOVSX
+{ $values { "dst" "destination" } { "src" "source" } }
+{ $description "Moves a value with sign extension." } ;
+
+HELP: PEXTRB
+{ $values { "dest" "destination" } { "src" "source" } { "imm" "immediate" } }
+{ $description "Packed extract byte. This instruction copies the byte selected by 'imm' into the first eight bits of the selected register." } ;
+
HELP: immediate-1/4
{ $values { "dst" "dst" } { "imm" "imm" } { "reg,rex.w,opcode" sequence } }
{ $description "If imm is a byte, compile the opcode and the byte. Otherwise, set the 8-bit operand flag in the opcode, and compile the cell. The 'reg' is not really a register, but a value for the 'reg' field of the mod-r/m byte." } ;
ARTICLE: "cpu.x86.assembler" "X86 assembler"
"This vocab implements an assembler for x86 architectures."
$nl
-"Instructions:"
-{ $subsections MOV } ;
+"General instructions:"
+{ $subsections DEC INC JE MOV MOVSX }
+"SSE instructions:"
+{ $subsections PEXTRB } ;
ABOUT: "cpu.x86.assembler"