[valgrind] [Bug 447989] Support Armv8.2 SHA-512 instructions

2024-05-21 Thread David Benjamin
https://bugs.kde.org/show_bug.cgi?id=447989

--- Comment #17 from David Benjamin  ---
Ah whoops, yeah. TBH we probably don't strictly need to build the test with
-march=armv8.2-a+sha3, since it's all in inline assembly anyway. I just carried
that over from the other tests. But we do need the assembler to recognize the
new instructions, which is probably analogous to checking if
-march=armv8.2-a+sha3 works.

-- 
You are receiving this mail because:
You are watching all bug changes.

[valgrind] [Bug 447989] Support Armv8.2 SHA-512 instructions

2024-05-19 Thread David Benjamin
https://bugs.kde.org/show_bug.cgi?id=447989

--- Comment #14 from David Benjamin  ---
(In reply to Paul Floyd from comment #13)
> Thanks for the patches. I've applied, tested and pushed the first one. The
> second patch looks OK so far but I'd like to check it on FreeBSD before
> pushing the change. It might take me a little while to see if I can get my
> hands on a suitable machine.

Sounds good. Let me know if there's any way I can help! (I've been testing on a
Linux VM on one an M1 Mac, which have the extension available. QEMU probably
knows how to emulate it too.)

-- 
You are receiving this mail because:
You are watching all bug changes.

[valgrind] [Bug 447989] Support Armv8.2 SHA-512 instructions

2024-05-16 Thread David Benjamin
https://bugs.kde.org/show_bug.cgi?id=447989

David Benjamin  changed:

   What|Removed |Added

 Attachment #169538|0   |1
is obsolete||

--- Comment #12 from David Benjamin  ---
Created attachment 169540
  --> https://bugs.kde.org/attachment.cgi?id=169540=edit
[PATCH 1/2] Extract common arm64 SIMD helpers into a single header

(Reattaching the first one with the right content type.)

-- 
You are receiving this mail because:
You are watching all bug changes.

[valgrind] [Bug 447989] Support Armv8.2 SHA-512 instructions

2024-05-16 Thread David Benjamin
https://bugs.kde.org/show_bug.cgi?id=447989

David Benjamin  changed:

   What|Removed |Added

 Attachment #145140|0   |1
is obsolete||

--- Comment #11 from David Benjamin  ---
Created attachment 169539
  --> https://bugs.kde.org/attachment.cgi?id=169539=edit
[PATCH 2/2] Add support for Armv8.2 SHA-512 instructions

And here's the second one. Test expectations generated by running the test
program uninstrumented, so it's unlikely that we're baking in any bugs.

Think that's everything. Let me know if you'd like any more changeS!

-- 
You are receiving this mail because:
You are watching all bug changes.

[valgrind] [Bug 447989] Support Armv8.2 SHA-512 instructions

2024-05-16 Thread David Benjamin
https://bugs.kde.org/show_bug.cgi?id=447989

--- Comment #10 from David Benjamin  ---
Created attachment 169538
  --> https://bugs.kde.org/attachment.cgi?id=169538=edit
[PATCH 1/2] Extract common arm64 SIMD helpers into a single header

Alright, here's the first of the two patches. This one pulls out some common
code for testing SIMD stuff. Git commit message in the patch has some notes.

-- 
You are receiving this mail because:
You are watching all bug changes.

[valgrind] [Bug 447989] Support Armv8.2 SHA-512 instructions

2024-05-15 Thread David Benjamin
https://bugs.kde.org/show_bug.cgi?id=447989

--- Comment #8 from David Benjamin  ---
(In reply to Paul Floyd from comment #7)
> I think that in this case I would just add sha512 tests to
> none/tests/fp_and_simd (or fp_and_simd_v82 - I'm not sure what the minimum
> version is for sha512).
> 
> Otherwise I just added a section to README_DEVELOPERS on writing regression
> tests.

Ah, perfect! Thanks, that's all really helpful! I think I've gotten the start
of it working. A couple questions before I finish this up:

Regarding the generating the expected files by running the test, I assume those
just record what my patch does. I.e. if my patch were wrong, the wrong things
would get recorded in expectations. I've run my test against BoringSSL's use of
these instructions, so I'm fairly confident it's correct. But it seems to me we
can do better: just synthesize the expected output by running the instructions
directly, without involving valgrind at all.

I don't suppose this exists? (If not, no big deal. Like I said, I've already
manually tested this against BoringSSL.)

Regarding where to put the tests, these are indeed Armv8.2 instructions, but I
noticed fp_and_simd_v82's prerequisite is actually the fphp (floating point
half-precision) extension. These instructions are from a separate extension. My
test device happens to have both but, in principle, they're orthogonal.

Should I still put them in fp_and_simd_v82 or make a new one? I'm guessing a
new one would be preferable, though this would get pretty large fast. Arm,
alas, has lots and lots of extensions. E.g. I noticed that the Armv8.0
cryptography instructions are just in the plain fp_and_simd test, with no
prereq, but not all Armv8.0 chips have those instructions. (It's pretty rare to
omit them, but I think the Raspberry Pis don't?)

If I make a new one, should I just copy all the various helper macros at the
top of that file, or try to extract them somewhere? Seems they're in a few
places already.

-- 
You are receiving this mail because:
You are watching all bug changes.

[valgrind] [Bug 447989] Support Armv8.2 SHA-512 instructions

2024-05-15 Thread David Benjamin
https://bugs.kde.org/show_bug.cgi?id=447989

--- Comment #6 from David Benjamin  ---
This was quite some time ago, so I'll have to page this back in and remind
myself how I tested this. :-)

> This will also need a change in arm64g_dirtyhelper_MRS_ID_AA64ISAR0_EL1

I don't believe that code was there when I first uploaded the patch, but yeah,
I can update that.

> And at least one testcase would also be good!

Yup. See the initial comment. :-P

> I wasn't sure how adding tests worked, so it's missing those. Happy to fill 
> those in with some pointers.

Do you have any pointers?

-- 
You are receiving this mail because:
You are watching all bug changes.

[valgrind] [Bug 447989] Support Armv8.2 SHA-512 instructions

2023-02-01 Thread David Benjamin
https://bugs.kde.org/show_bug.cgi?id=447989

--- Comment #2 from David Benjamin  ---
Anything needed before this patch is submittable?

-- 
You are receiving this mail because:
You are watching all bug changes.

[valgrind] [Bug 462958] ARMv8: Unrecognised instruction: _armv8_sha512_probe

2023-02-01 Thread David Benjamin
https://bugs.kde.org/show_bug.cgi?id=462958

David Benjamin  changed:

   What|Removed |Added

 CC||david...@google.com

--- Comment #1 from David Benjamin  ---
I suspect the patch at https://bugs.kde.org/show_bug.cgi?id=447989 will resolve
this issue.

-- 
You are receiving this mail because:
You are watching all bug changes.

[valgrind] [Bug 447989] Support Armv8.2 SHA-512 instructions

2022-01-05 Thread David Benjamin
https://bugs.kde.org/show_bug.cgi?id=447989

David Benjamin  changed:

   What|Removed |Added

 Attachment #145139|0   |1
is obsolete||

--- Comment #1 from David Benjamin  ---
Created attachment 145140
  --> https://bugs.kde.org/attachment.cgi?id=145140=edit
Reattached with the right content type

-- 
You are receiving this mail because:
You are watching all bug changes.

[valgrind] [Bug 447989] New: Support Armv8.2 SHA-512 instructions

2022-01-05 Thread David Benjamin
https://bugs.kde.org/show_bug.cgi?id=447989

Bug ID: 447989
   Summary: Support Armv8.2 SHA-512 instructions
   Product: valgrind
   Version: 3.19 GIT
  Platform: unspecified
OS: Unspecified
Status: REPORTED
  Severity: normal
  Priority: NOR
 Component: vex
  Assignee: jsew...@acm.org
  Reporter: david...@google.com
  Target Milestone: ---

Created attachment 145139
  --> https://bugs.kde.org/attachment.cgi?id=145139=edit
Patch to implement SHA-512 instructions

Armv8.2 adds a number of new cryptography extensions, including SHA-512
instructions (FEAT_SHA512, which covers SHA512H, SHA512H2, SHA512SU0, and
SHA512SU1). I was trying to test some SHA-512 assembly with Valgrind and ran
into this.

I've attached a patch which implements them, mostly by adapting surrounding
code. I wasn't sure how adding tests worked, so it's missing those. Happy to
fill those in with some pointers.

-- 
You are receiving this mail because:
You are watching all bug changes.