Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i#2626 AArch64 encoder: Add isz operand and vector ADD to encoder. #3016

Merged
merged 5 commits into from
May 24, 2018

Conversation

fhahn
Copy link
Contributor

@fhahn fhahn commented May 21, 2018

This patch adds an isz operand to encode the vector element width for
non-FP vector instructions. It also adds support for vector ADD to the
encoder/decoder. Additional tests and macros should be added once the
script in the project-aarch64-generate-patterns branch gets updated.

Issue #2626

fhahn added 3 commits May 21, 2018 10:34
This patch adds an isz operand to encode the vector element width for
non-FP vector instructions. It also adds support for vector ADD to the
encoder/decoder. Additional tests and macros should be added once the
script in the project-aarch64-generate-patterns branch gets updated.

Issue #2626

Change-Id: I2bca21610205c3b2ba7bb67f990fe108d210001c
…ctor-add

Change-Id: Ie8adf4f164d83f7bdcf85cb9e9f44b487c1de5d7
Change-Id: I7414163022cb784fdd4d7af29cb6c184e7394c45
@fhahn fhahn requested a review from egrimley May 23, 2018 14:19
@egrimley
Copy link
Contributor

Does it make sense to refer to "the project-aarch64-generate-patterns branch" in the commit message? Shall I assume that the last sentence of the commit message will be something like "Additional tests and macros will be added by a later commit"?

static inline bool
encode_opnd_isz(uint enc, int opcode, byte *pc, opnd_t opnd, OUT uint *enc_out)
{
if (opnd_get_immed_int(opnd) < ISZ_BYTE || opnd_get_immed_int(opnd) > ISZ_DOUBLE)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since opnd_get_immed_int might be a function, I would avoid using it three times here and instead put uint bits = opnd_get_immed_int(opnd).

Also, since line 1984 wants bits to be 0, 1, 2 or 3, I'm not sure the use of ISZ_BYTE and ISZ_DOUBLE is helpful here, so I would have put if (bits > 3), but that's just my opinion and I wouldn't be surprised if some people would disagree.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since opnd_get_immed_int might be a function, I would avoid using it three times here and instead put uint bits = opnd_get_immed_int(opnd).

Sometimes I tend to have too much faith in compilers. I've changed it.

Also, since line 1984 wants bits to be 0, 1, 2 or 3, I'm not sure the use of ISZ_BYTE and ISZ_DOUBLE is helpful here, so I would have put if (bits > 3), but that's just my opinion and I wouldn't be surprised if some people would disagree.

I wasn't sure, but yes, they don't add too much value I think. Ideally, I think there would be an enum, shared with the FP ops. I could do that as a follow up.

@@ -131,6 +131,8 @@
---------?x---------x----------- vindex_SD # Index for vector with single or double
# elements, depending on bit 22 (sz)
?--------xx--------------------- imm16sh # shift for MOVK/... (immediate); checks 31
--------xx---------------------- isz # element size of a vector register (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you wanted to get the comment into one line you could put something like: # element size of vector reg (8<<x bits)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@@ -957,6 +959,10 @@ x101101011000000000101xxxxxxxxxx cls wx0 : wx5
1101101011000000000011xxxxxxxxxx rev x0 : x5

# Data Processing - Scalar Floating-Point and Advanced SIMD

# ADD
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a rule for how the instructions are ordered in this file? (I think I was following the "Index by Encoding" in our internal web pages at some point...) If it's feasible, it might be good to follow some canonical ordering and mark omissions with a comment. (But perhaps it isn't feasible.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The neon patterns should currently follow alphabetic order (as on the A64 -- SIMD and Floating-point Instructions (alphabetic order) index page of the public XML ISA spec). That's how the generator script happens to process them, but IMO that makes it easier to read. On second thought, it might be easier to extend to generator script to work by the index page in the future.

@@ -1561,6 +1561,16 @@ fd3fffff : str d31, [sp,#32760] : str %d31 -> +0x7ff8(%sp)[8byte]
fd481041 : ldr d1, [x2,#4128] : ldr +0x1020(%x2)[8byte] -> %d1
fd7fffff : ldr d31, [sp,#32760] : ldr +0x7ff8(%sp)[8byte] -> %d31


# ADD (vector)
4e2c856a : add v10.16b, v11.16b, v12.16b : add %q11 %q12 $0x00 -> %q10
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script dis-a64.pl contains a format specification that would attempt to make these colons line up. In fact, I think at some point dis-a64.txt could survive reformatting by dis-a64.pl. Perhaps worth thinking about getting that to work again, but not as part of this commit.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, I've aligned the ADD lines. It should be easy to update the generator script to align on a per-opcode basis.

fhahn added 2 commits May 24, 2018 13:57
Change-Id: I4c017e16910f18a3b56bb1fc59df743aea908e40
@fhahn
Copy link
Contributor Author

fhahn commented May 24, 2018

Does it make sense to refer to "the project-aarch64-generate-patterns branch" in the commit message? Shall I assume that the last sentence of the commit message will be something like "Additional tests and macros will be added by a later commit"?

Probably not. I'll make sure to update that in the final message.

Copy link
Contributor

@egrimley egrimley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@fhahn fhahn merged commit 3e1182e into master May 24, 2018
@fhahn fhahn deleted the i2626-vector-add branch May 24, 2018 14:36
@fhahn
Copy link
Contributor Author

fhahn commented May 24, 2018

Thanks Edmund!

fhahn added a commit that referenced this pull request Jun 18, 2018
This patch adds an isz operand to encode the vector element width for
non-FP vector instructions. It also adds support for vector ADD to the
encoder/decoder. Additional tests and macros will be added by a later
commit.

Issue #2626
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants