Skip to content

Commit bb9e14c

Browse files
committed
Added PREFETCHW and improved README
1 parent eef73b7 commit bb9e14c

File tree

3 files changed

+42
-6
lines changed

3 files changed

+42
-6
lines changed

README.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[assembler] provides a fast, run-time assembler for x86-64 long mode instructions using function calls for Rust. In using a design that Rust's release build optimizations can work effectively with, it provides the ability to embed the assembled machine code instructions as templates inside Rust code, so as to make specialized code generation as fast as possible. It is particularly suited to being the backend to a JIT.
44

5-
This technique differs to that used in [dynasm], but was driven by the need to programmatically generate complex assembler to optimize message filters at runtime. The code for instruction generation is inspired by that from Stanford's [x64asm].
5+
This technique differs to that used in [dynasm], but was driven by the need to programmatically generate complex assembler to optimize message filter functions at runtime. The code for the instruction generation is inspired by that from Stanford's [x64asm].
66

77
As a consequence, jump (and similar) instruction relaxation is not performed, ie all jumps use 32-bit displacements instead of being optimized for 8-bit displacements. Additional dedicated support is also included (eg `BitMemory`) to work with code that might be placed outside of the first 2Gb (eg on Mac OS X).
88

@@ -33,18 +33,23 @@ Add the crate `assembler` to your Cargo.toml file as usual and add an `extern cr
3333

3434
Pull requests implementing these would be much appreciated\*.
3535
* Any support at all of the AVX512 instructions and associated memory operands.
36-
* 3D Now! (eg `PREFETCHW`).
36+
* 3D Now!'s `PREFETCH`.
3737
* Support for using the debug, control and bound registers.
3838
* `if` clauses inside some instruction generation sequences to output more efficient known register forms, eg those that default to `RAX`.
3939

4040

4141
<sup>\* With copyright assignment to the project, of course!</sup>
4242

4343

44+
## Possible
45+
46+
* The instruction pointer should be an `u64` rather than `usize` so that assembling 64-bit code on 32-bit platforms is possible. That said, the main use of this project is to generate assembler to be used at runtime.
47+
48+
4449
### Unlikely to be added
4550

46-
* XOP (deprecated)
47-
* AMD's bit manipulation
51+
* Intel Xeon Phi specific instructions.
52+
* AMD's deprecated bit manipulation instructions and `XOP` encoding prefix.
4853
* Instruction relaxation; requires using a linked list to manage 'bundles' of instructions
4954
* Dynamic relocation
5055
* 32-bit compatibility mode
@@ -53,7 +58,7 @@ Pull requests implementing these would be much appreciated\*.
5358

5459
## Licensing
5560

56-
The license for this project is Affero GNU Public License 3.0 (AGPL-3.0). Note that very early, unreleased versions of used source code forked from the [dynasm] project; this code is no longer in use within the code base. However, the authors of [assembler] are grateful to the authors of [dynasm] for the inspiration behind this work.
61+
The license for this project is Affero GNU Public License 3.0 (AGPL-3.0). Note that very early, unreleased versions used source code forked from the [dynasm] project; this code is no longer in use within the code base. However, the authors of [assembler] are grateful to the authors of [dynasm] for the inspiration behind this work.
5762

5863

5964
[assembler]: https://github.com/lemonrock/assembler "assembler GitHub page"

workspace/assembler/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ exclude = ["*"]
1515
include = ["README.md", "LICENSE", "COPYRIGHT", "src/**/*.rs", "Cargo.toml", "rustfmt.toml", "clippy.toml"]
1616
readme = "README.md"
1717
publish = true
18-
version = "0.7.1"
18+
version = "0.7.2"
1919

2020
[dependencies]
2121
libc = "^0.2"

workspace/assembler/src/InstructionStream.instructions.rs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51969,6 +51969,37 @@ impl<'a> InstructionStream<'a>
5196951969
// No label displacement.
5197051970
}
5197151971

51972+
/// Move data from `m8` closer to the processor in anticipation of a write.
51973+
///
51974+
/// Introduced with AMD's 3DNow! instructions.
51975+
#[inline(always)]
51976+
pub fn prefetchw_Any8BitMemory(&mut self, arg0: Any8BitMemory)
51977+
{
51978+
self.reserve_space_for_instruction();
51979+
51980+
// This is not a VEX encoded instruction.
51981+
51982+
// No `FWAIT` Prefix.
51983+
51984+
self.prefix_group2(arg0);
51985+
51986+
self.prefix_group4(arg0);
51987+
51988+
// No prefix group 3.
51989+
51990+
// No prefix group 1.
51991+
51992+
self.rex_2(arg0, 0x00);
51993+
51994+
self.opcode_2(0x0F, 0x0D);
51995+
51996+
self.mod_rm_sib(arg0, Register64Bit::RCX);
51997+
51998+
// No displacement or immediate.
51999+
52000+
// No label displacement.
52001+
}
52002+
5197252003
/// Computes the absolute differences of the packed unsigned byte integers from `mm2/m64` and `mm1`; differences are then summed to produce an unsigned word integer result.
5197352004
#[inline(always)]
5197452005
pub fn psadbw_MMRegister_Any64BitMemory(&mut self, arg0: MMRegister, arg1: Any64BitMemory)

0 commit comments

Comments
 (0)