Skip to content

Instantly share code, notes, and snippets.

View JJJollyjim's full-sized avatar

Jamie JJJollyjim

View GitHub Profile
@JJJollyjim
JJJollyjim / 0-readme.txt
Created February 21, 2023 09:24 — forked from dougallj/0-readme.txt
Intel/AGX ternary logic optimisation tables (VPTERNLOGD -> AGX/x86/BMI/SSE2)
Usage: evaluate a ternary bitwise function with the values a=0xf0, b=0xcc, c=0xaa.
On AVX-512 you can pass the result directly to VPTERNLOGD. On other platforms,
look up the value in the following tables to find a short, equivalent sequence of
operations.
For A64/SVE/Neon see https://gist.github.com/dougallj/10c3ffdbd07229db2cc8b0430d7ccd39
The tables here are:
* agx: "not" and all binary operations (as used in Apple GPUs, but possibly useful elsewhere):