14 Commits

Author SHA1 Message Date
Pierre van Houtryve
fa3d789df1
[RFC][TableGen] Restructure TableGen Source (#80847)
Refactor of the llvm-tblgen source into:
- a "Basic" library, which contains the bare minimum utilities to build
`llvm-min-tablegen`
- a "Common" library which contains all of the helpers for TableGen
backends. Such helpers can be shared by more than one backend, and even
unit tested (e.g. CodeExpander is, maybe we can add more over time)

Fixes #80647
2024-03-25 09:40:35 +01:00
Argyrios Kyrtzidis
d2353ae00c
[utils/TableGen/X86CompressEVEXTablesEmitter.cpp] Make sure the tablegen output for the checkPredicate function is deterministic (#84533)
The output for the `checkPredicate` function was depending on a
`std::map` iteration that was non-deterministic from run to run, because
the keys were pointer values.
    
Make a change so that the keys are `StringRef`s so the ordering is
stable.
2024-03-09 22:34:18 -08:00
Jay Foad
f723260a80
[TableGen] Stop using make_pair and make_tuple. NFC. (#81730)
These are unnecessary since C++17.
2024-02-14 13:16:20 +00:00
Pierre van Houtryve
b9079baadd
[NFC] clang-format utils/TableGen (#80973)
```
find llvm/utils/TableGen -iname "*.h" -o -iname "*.cpp" | xargs clang-format-16 -i
```

Split from #80847
2024-02-09 09:27:04 +01:00
Shengchen Kan
381f585198 [X86] Fix Werror X86GenCompressEVEXTables.inc:1627:2: error: extra ';' outside of a function 2024-01-22 12:24:41 +08:00
Shengchen Kan
c2bef33c5e [X86][NFC] Auto-generate the function to check predicate for EVEX compression 2024-01-22 11:49:24 +08:00
Shengchen Kan
fb72a445c1 [X86] Emit NDD2NonNDD entris in the EVEX comprerssion table, NFCI
This patch is a straightfoward change based on the design in #77202.
It does not have any effect since we haven't supported compressing ND
to non-ND in X86CompressEVEX.cpp.
2024-01-08 19:50:28 +08:00
Shengchen Kan
1c674666fa
[X86] Support EVEX compression for EGPR (#77202)
Compress promoted instruction (EVEX) to pre-promotion instruction
(legacy/VEX) when R16-R31 is not used.

Alternative of #77065
2024-01-08 16:50:23 +08:00
Shengchen Kan
61bb3d499a [X86][NFC] Avoid uselss iterations when emitting EVEX compression table
BTW, we relax the condition for EVEX compression from
ST.hasAVX512() to ST.hasEGPR() || ST.hasAVX512(). It does not have any
effect now b/c no APX instruction is in the EVEX compression table so
far.

This patch is to extract NFC in #77065 into a separate commit.
2024-01-06 23:53:57 +08:00
Shengchen Kan
4b9bbd3868 [X86][NFC] Refine code in X86CompressEVEXTablesEmitter.cpp
1. Simplify getValueFromBitsInit about cast and return type
2. Remove out-of-date comments and allow memory ops in function
   object `IsMatch` so that we can reuse it for EVEX2Legacy compression.

This patch is to extract NFC in #77065 into a separate commit.
2024-01-06 21:48:19 +08:00
Shengchen Kan
0abf3a93a3 [X86][NFC] Use single table for EVEX compression
This patch is to address my review comments in #77065 to simplify the
implemention of EVEX2Legacy compression.
2024-01-06 18:55:24 +08:00
Shengchen Kan
04a7ec610e [X86][NFC] Remove VEX_W1X after 80dbf60 2024-01-06 17:07:39 +08:00
Shengchen Kan
80dbf601d1 [X86][NFC] Remove EVEX2VEXOverride/NotEVEX2VEXConvertible
Remove these two classes and put all the entries in X86 EVEX compression tables
that need special handling in .def file.

PR #77065 tries to add entries that need special handling for APX in
.def file. Compared to setting fields in td files, that method looks
cleaner. This patch is to unify the addition of manual entries.
2024-01-06 15:43:25 +08:00
Shengchen Kan
a5902a4d24 [X86][NFC] Rename variables/passes for EVEX compression optimization
RFC: https://discourse.llvm.org/t/rfc-design-for-apx-feature-egpr-and-ndd-support/73031

APX introduces EGPR, NDD and NF instructions. In addition to compressing
EVEX encoded AVX512 instructions into VEX encoding, we also have several
more possible optimizations.

a. Promoted instruction (EVEX space) -> pre-promotion instruction (legacy space)
b. NDD (EVEX space) -> non-NDD (legacy space)
c. NF_ND (EVEX space) -> NF (EVEX space)

The first two types of compression can usually reduce code size, while
the third type of compression can help hardware decode although the
instruction length remains unchanged.

So we do the renaming for the upcoming APX optimizations.

BTW, I clang-format the code in X86CompressEVEX.cpp,
X86CompressEVEXTablesEmitter.cpp.

This patch also extracts the NFC in #77065 into a separate commit.
2024-01-06 12:41:09 +08:00