Skip to content

Commit

Permalink
add more instructions to INSTR
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterBright committed Jan 26, 2025
1 parent af002fc commit 9b46acb
Showing 1 changed file with 82 additions and 5 deletions.
87 changes: 82 additions & 5 deletions compiler/src/dmd/backend/arm/instr.d
Original file line number Diff line number Diff line change
Expand Up @@ -543,10 +543,60 @@ struct INSTR
* Advanced SIMD three same (FP16)
* Advanced SIMD two-register miscellaneous (FP16)
* Advanced SIMD three-register extension
* Advanced SIMD two-register miscellaneous
* Advanced SIMD across lanes
* Advanced SIMD three different
*/

/* Advanced SIMD two-register miscellaneous
* https://www.scs.stanford.edu/~zyedidia/arm64/encodingindex.html#asimdmisc
*/
static uint asimdmisc(uint Q, uint U, uint size, uint opcode, reg_t Rn, reg_t Rd)
{
uint ins = (0 << 31) |

Check warning on line 553 in compiler/src/dmd/backend/arm/instr.d

View check run for this annotation

Codecov / codecov/patch

compiler/src/dmd/backend/arm/instr.d#L553

Added line #L553 was not covered by tests
(Q << 30) |
(U << 29) |
(0xE << 24) |
(size << 22) |
(0x10 << 17) |
(opcode << 12) |
(2 << 10) |
(Rn << 5) |
Rd;
return ins;

Check warning on line 563 in compiler/src/dmd/backend/arm/instr.d

View check run for this annotation

Codecov / codecov/patch

compiler/src/dmd/backend/arm/instr.d#L563

Added line #L563 was not covered by tests
}

/* CNT <Vd>.<T>, <Vn>.<T>
* https://www.scs.stanford.edu/~zyedidia/arm64/cnt_advsimd.html
*/
static uint cnt_advsimd(uint Q, uint size, reg_t Rn, reg_t Rd) { return asimdmisc(Q, 0, size, 5, Rn, Rd); }

Check warning on line 569 in compiler/src/dmd/backend/arm/instr.d

View check run for this annotation

Codecov / codecov/patch

compiler/src/dmd/backend/arm/instr.d#L569

Added line #L569 was not covered by tests

/* Advanced SIMD across lanes
* https://www.scs.stanford.edu/~zyedidia/arm64/encodingindex.html#asimdall
*/
static uint asimdall(uint Q, uint U, uint size, uint opcode, reg_t Rn, reg_t Rd)
{
uint ins = (0 << 31) |

Check warning on line 576 in compiler/src/dmd/backend/arm/instr.d

View check run for this annotation

Codecov / codecov/patch

compiler/src/dmd/backend/arm/instr.d#L576

Added line #L576 was not covered by tests
(Q << 30) |
(U << 29) |
(0xE << 24) |
(size << 22) |
(0x18 << 17) |
(opcode << 12) |
(2 << 10) |
(Rn << 5) |
Rd;
return ins;

Check warning on line 586 in compiler/src/dmd/backend/arm/instr.d

View check run for this annotation

Codecov / codecov/patch

compiler/src/dmd/backend/arm/instr.d#L586

Added line #L586 was not covered by tests
}

/* ADDV <V><d>, <Vn>.<T> https://www.scs.stanford.edu/~zyedidia/arm64/addv_advsimd.html
*/
static uint addv_advsimd(uint Q, uint size, reg_t Rn, reg_t Rd) { return asimdall(Q, 0, size, 0x1B, Rn, Rd); }

Check warning on line 591 in compiler/src/dmd/backend/arm/instr.d

View check run for this annotation

Codecov / codecov/patch

compiler/src/dmd/backend/arm/instr.d#L591

Added line #L591 was not covered by tests

/* UADDLV <V><d>, <Vn>.<T> https://www.scs.stanford.edu/~zyedidia/arm64/uaddlv_advsimd.html
*/
static uint uaddlv_advsimd(uint Q, uint size, reg_t Rn, reg_t Rd) { return asimdall(Q, 1, size, 3, Rn, Rd); }

Check warning on line 595 in compiler/src/dmd/backend/arm/instr.d

View check run for this annotation

Codecov / codecov/patch

compiler/src/dmd/backend/arm/instr.d#L595

Added line #L595 was not covered by tests

/* Advanced SIMD three different
* Advanced SIMD three same
*/

/* Advanced SIMD modified immediate
* http://www.scs.stanford.edu/~zyedidia/arm64/encodingindex.html#asimdimm
Expand All @@ -562,9 +612,36 @@ struct INSTR
* Cryptographic four-register
* XAR
* Cryptographic twp=register SHA 512
* Converstion between floating-point and fixed-point
* Converstion between floating-point and integer
* Conversion between floating-point and fixed-point
*/

/* Converstion between floating-point and integer https://www.scs.stanford.edu/~zyedidia/arm64/encodingindex.html#float2int
*/
static uint float2int(uint sf, uint S, uint ftype, uint rmode, uint opcode, reg_t Rn, reg_t Rd)
{
return (sf << 31) | (S << 29) | (0x1E << 24) | (ftype << 22) | (1 << 21) | (rmode << 19) | (opcode << 16) | (Rn << 5) | Rd;

Check warning on line 622 in compiler/src/dmd/backend/arm/instr.d

View check run for this annotation

Codecov / codecov/patch

compiler/src/dmd/backend/arm/instr.d#L622

Added line #L622 was not covered by tests
}

/* FMOV (general) https://www.scs.stanford.edu/~zyedidia/arm64/fmov_float_gen.html
*/
static uint fmov_float_gen(uint sf, uint ftype, uint rmode, uint opcode, reg_t Rn, reg_t Rd)
{
return float2int(sf, 0, ftype, rmode, opcode, Rn, Rd);

Check warning on line 629 in compiler/src/dmd/backend/arm/instr.d

View check run for this annotation

Codecov / codecov/patch

compiler/src/dmd/backend/arm/instr.d#L629

Added line #L629 was not covered by tests
}

/* FCVTNS (scalar) https://www.scs.stanford.edu/~zyedidia/arm64/fcvtns_float.html
*/
static uint fcvtns(uint sf, uint ftype, reg_t Rn, reg_t Rd)
{
return float2int(sf, 0, ftype, 0, 0, Rn, Rd);

Check warning on line 636 in compiler/src/dmd/backend/arm/instr.d

View check run for this annotation

Codecov / codecov/patch

compiler/src/dmd/backend/arm/instr.d#L636

Added line #L636 was not covered by tests
}

/* FCVTNU (scalar) https://www.scs.stanford.edu/~zyedidia/arm64/fcvtnu_float.html
*/
static uint fcvtnu(uint sf, uint ftype, reg_t Rn, reg_t Rd)
{
return float2int(sf, 0, ftype, 0, 1, Rn, Rd);

Check warning on line 643 in compiler/src/dmd/backend/arm/instr.d

View check run for this annotation

Codecov / codecov/patch

compiler/src/dmd/backend/arm/instr.d#L643

Added line #L643 was not covered by tests
}

/* Floating-point data-processing (1 source)
* https://www.scs.stanford.edu/~zyedidia/arm64/encodingindex.html#floatdp1
Expand Down

0 comments on commit 9b46acb

Please sign in to comment.