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
Shengchen Kan
c82a645ef2
[X86][NFC] Simplify the code for memory fold
2024-02-01 13:43:25 +08:00
Shengchen Kan
7c3ee7cbe6
[X86][tablgen] Fix the broadcast tables ( #79675 )
2024-01-28 09:06:27 +08:00
Shengchen Kan
04a7ec610e
[X86][NFC] Remove VEX_W1X after 80dbf60
2024-01-06 17:07:39 +08:00
Shengchen Kan
d79ccee8dc
[X86][MC] Support encoding/decoding for APX variant ADD/SUB/ADC/SBB/OR/XOR/NEG/NOT instructions ( #76319 )
...
Four variants: promoted legacy, ND (new data destination), NF (no flags
update) and NF_ND (NF + ND).
The syntax of NF instructions is aligned with GNU binutils.
https://sourceware.org/pipermail/binutils/2023-September/129545.html
2023-12-28 21:22:03 +08:00
XinWang10
037c220702
[X86][MC] Support Enc/Dec for EGPR for promoted SHA instruction ( #75582 )
...
R16-R31 was added into GPRs in
https://github.com/llvm/llvm-project/pull/70958 ,
This patch supports the encoding/decoding for promoted SHA instruction
in EVEX space.
RFC:
https://discourse.llvm.org/t/rfc-design-for-apx-feature-egpr-and-ndd-support/73031/4
2023-12-20 13:54:50 +08:00
Simon Pilgrim
bcee4a9363
[X86] Rename VPERMI2/VPERMT2 to VPERMI2*Z/VPERMT2*Z ( #75192 )
...
Add missing AVX512 Z prefix to conform to the standard naming convention and simplify matching in X86FoldTablesEmitter::addBroadcastEntry etc.
2023-12-14 09:55:18 +00:00
Shengchen Kan
a4e1aa256b
[X86][tablgen] Auto-gen broadcast tables ( #73654 )
...
1. Add TB_BCAST_SH for FP16
2. Auto-gen 4 broadcast tables BroadcastTable[1-4]
issue: https://github.com/llvm/llvm-project/issues/66360
2023-11-30 22:24:31 +08:00
Shengchen Kan
e78a45dd10
[X86][NFC] Refine code in X86FoldTablesEmitter.cpp
...
Split NFC in #73654 into a seperate commit.
2023-11-30 18:46:20 +08:00
Shengchen Kan
3c0f87147d
[X86][fold-table] Add an assertion in addEntryWithFlags, NFCI
2023-11-28 21:47:57 +08:00
Shengchen Kan
bafa51c8a5
[X86] Rename X86MemoryFoldTableEntry to X86FoldTableEntry, NFCI
...
b/c it's used for element that folds a load, store or broadcast.
2023-11-28 19:49:14 +08:00
Shengchen Kan
c66c15a76d
[X86] Rename some variables for memory fold and format code, NFCI
...
1. Rename the names of tables to simplify the print
2. Align the abbreviation in the same file Instr -> Inst
3. Clang-format
4. Capitalize the first char of the variable name
2023-11-28 19:07:44 +08:00
Kazu Hirata
fcb160eabc
[llvm] Stop including llvm/ADT/DenseMap.h (NFC)
...
Identified with clangd.
2023-11-11 22:46:28 -08:00
Kazu Hirata
2ca3b6f6b7
[TableGen] Include <set> (NFC)
...
This patch adds "#include <set>" to several files that are relying on
transitive includes of <set>. It in turn unblocks the removal of
unnecessary includes of llvm/ADT/SmallSet.h in several other files.
2023-11-11 12:14:24 -08:00
Simon Pilgrim
141122ece3
[TableGen] Use StringRef::starts_with/ends_with instead of startswith/endswith. NFC.
...
startswith/endswith wrap starts_with/ends_with and will eventually go away (to more closely match string_view)
2023-11-03 17:53:56 +00:00
XinWang10
2e9a04b985
[X86]Add NO_REVERSE attribute to X86 RMW instrs in memfold table ( #67288 )
...
X86 don't want to unfold RMW instrs to 1 load + 1 op + 1 store, because
RMW could save code size and benefit RA when reg pressure is high.
And from all the call position analysis, we could find we didn't unfold
RMW in current code.
2023-09-27 22:18:14 +08:00
XinWang10
744b12adb4
[X86]check that Uses, Defs are same for entries in memory folding table
...
Add expensive check that Uses, Defs are same for entries in memory folding table.
MemFolding could not change the Uses/Defs.
Reviewed By: skan
Differential Revision: https://reviews.llvm.org/D150633
2023-05-16 22:53:52 -04:00
Shengchen Kan
33e2e713c6
[X86][Tablgen] Rename IgnoresVEX_W to IgnoresW, VEX_WIG to WIG, NFCI
...
We no longer distinguish REX.W from VEX.W in .td.
2023-04-20 11:15:09 +08:00
Shengchen Kan
99adc0ac3f
[X86][mem-fold][NFC] Simplify code by transform A != 0 - > A
2023-04-09 09:29:41 +08:00
Shengchen Kan
eda14ebf6a
[X86][mem-fold] Refine the code in X86FoldTablesEmitter.cpp, NFCI
...
1. Simplify code by using conditional operator
2. Add comments for "kz" and "store" cases
3. Rename variables to match flags
2023-04-06 19:19:41 +08:00
Shengchen Kan
462f73e59f
[X86][mem-fold] Avoid nestsed if
, redundant else
and correct comments
2023-04-06 17:57:57 +08:00
Shengchen Kan
06d5b12993
[X86][mem-fold] Remove redundant variable IsAligned, NFCI
2023-04-06 17:18:03 +08:00
Shengchen Kan
92af50f41c
[X86][NFC] Fix for warning C4334: '<<': result of 32-bit shift implicitly converted to 64 bits
2023-04-06 17:13:10 +08:00
Shengchen Kan
ea91acda05
[X86][mem-fold] Simplify the logic and correct the comments for TB_ALIGN, NFCI
2023-04-06 16:38:30 +08:00
Shengchen Kan
51b5b299f9
[X86][mem-fold] Refine the code in X86FoldTablesEmitter.cpp, NFCI
...
1. Construct RecognizableInstrBase for Mem Inst only once in IsMatch
2. Correct the comments
3. Use std::make_tuple to simplify the compare
2023-04-06 13:37:02 +08:00
Shengchen Kan
211f1d2bb8
[X86][mem-fold] Refine the code in X86FoldTablesEmitter.cpp, NFCI
...
1. Avoid vulnerable assumption: the enum of reg/memory format are continous
2. Remove redundant inline keyword
3. Replace getValueFromBitsInit with byteFromBitsInit b/c both Form and
Opcode can be represented in 1 byte
2023-04-06 12:10:45 +08:00
Shengchen Kan
626348dfc3
[X86][mem-fold] Simplify code by using StringRef::drop_back, NFCI
2023-04-05 23:40:28 +08:00
Shengchen Kan
1e75ce4289
[X86][mem-fold] Remove the logic for FoldGenData, NFCI
2023-04-05 23:24:25 +08:00
Shengchen Kan
59e5ac55c5
[X86][mem-fold] Remove the logic for TB_NO_FORWARD | TB_NO_REVERSE, NFCI
2023-04-05 22:17:57 +08:00
Shengchen Kan
b80ae6548c
[X86][mem-fold] Remove definition of NotMemoryFoldable and move code into a def file, NFCI
...
The goal is to centralize the logic of the memory fold.
2023-04-05 21:28:31 +08:00
Shengchen Kan
94498950e6
[X86][mem-fold][NFC] Refine code
...
1. Use `unsigned` for `KeyOp` and `DstOp` b/c `Opcode` is of type `unsigned`.
2. Align the comparator used in X86FoldTablesEmitter.cpp with the one in
CodeGenTarget::ComputeInstrsByEnum.
2023-04-05 17:54:58 +08:00
Shengchen Kan
d10e47d732
[X86][mem-fold] Refine code, NFCI
...
1. Remove redundant definition of constructor
2. Move the array in .inc to .def file
3. Add a licence for the .def file
2023-04-04 20:45:11 +08:00
Shengchen Kan
3490345670
[X86][NFC] Combine HasVEX_W with hasREX_W to save 1 bit of TSFlags
...
Post: https://discourse.llvm.org/t/save-some-bits-in-tsflags-for-x86/69025
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D147443
2023-04-04 10:24:55 +08:00
Bing1 Yu
db8c0b295d
[X86][MemFold] Stop emitting Header for X86 fold tables
...
Reviewed By: skan
Differential Revision: https://reviews.llvm.org/D146502
2023-03-21 16:38:42 +08:00
NAKAMURA Takumi
9c93e728bf
llvm-tblgen: Rewrite emitters to use TableGen::Emitter
...
Each emitter became self-contained since it has the registration of option.
Differential Revision: https://reviews.llvm.org/D144351
2023-03-21 16:21:27 +09:00
NAKAMURA Takumi
a7e2b749b5
llvm-tblgen: Cleanup for each EmitterClass to be invoked by uniform signature.
...
Differential Revision: https://reviews.llvm.org/D144351
2023-03-21 16:21:27 +09:00
Bing1 Yu
0666c59833
[RFC][X86][MemFold] Upgrade the mechanism of auto-generated Memory Folding Table
...
1. Align ManualMapSet with X86MemoryFoldTableEntry instead of using UnfoldStrategy
2. ManualMapSet able to update the existing record in auto-generated MemFold table
Reviewed By: skan
Differential Revision: https://reviews.llvm.org/D142084
2023-03-20 14:42:52 +08:00
Vitaly Buka
bf8f684eff
Revert "[RFC][X86][MemFold] Upgrade the mechanism of auto-generated Memory Folding Table"
...
X86FoldTablesEmitter.cpp:386:26: runtime error: shift exponent -1 is negative
This reverts commit ca4c5331823755d5f7ae28a8bcaaa0fed21cf762.
2023-03-16 23:16:00 -07:00
Bing1 Yu
ca4c533182
[RFC][X86][MemFold] Upgrade the mechanism of auto-generated Memory Folding Table
...
1. Align ManualMapSet with X86MemoryFoldTableEntry instead of using UnfoldStrategy
2. ManualMapSet able to update the existing record in auto-generated MemFold table
Reviewed By: skan
Differential Revision: https://reviews.llvm.org/D142084
2023-03-16 18:44:04 +08:00
NAKAMURA Takumi
aeafcbcd75
llvm-tblgen: Add "TableGenBackends.h" to each emitter.
...
"TableGenBackends.h" has declarations of emitters.
2023-02-19 03:06:32 +09:00
NAKAMURA Takumi
afde3f549d
llvm-tblgen: Apply IWYU partially
2023-02-17 00:32:46 +09:00
Shengchen Kan
05535f3d07
[X86][tablgen] Add one entry manually into the memory folding table
...
```
{"MMX_MOVD64grr", "MMX_MOVD64mr"}
```
This pair has different opcodes.
2022-04-06 22:06:15 +08:00
Shengchen Kan
f4661b5a55
[X86] Fold MMX_MOVD64from64rr + store to MMX_MOVQ64mr instead of MMX_MOVD64from64mr in auto-generated table
...
This is a follow-up patch for D122241.
2022-04-06 21:33:57 +08:00
Shengchen Kan
eddd399c98
[X86][tablgen] Add three entries manually into the memory folding table
...
```
{X86::MOVLHPSrr,X86::MOVHPSrm}
{X86::VMOVLHPSZrr,X86::VMOVHPSZ128rm}
{X86::VMOVLHPSrr,X86::VMOVHPSrm}
```
Each of the three pairs has different mnemonic, so we have to add it
manually. This is a follow-up patch for D122477.
2022-04-06 20:37:39 +08:00
Shengchen Kan
81b10f8200
[X86][tablgen] Consider the mnemonic when auto-generating memory folding table
...
Intuitively, the memory folding pair should have the same mnemonic.
This patch removes
```
{X86::SENDUIPI,X86::VMXON}
```
in the auto-generated table.
And `NotMemoryFoldable` for `TPAUSE` and `CLWB` can be saved.
```
{X86::MOVLHPSrr,X86::MOVHPSrm}
{X86::VMOVLHPSZrr,X86::VMOVHPSZ128rm}
{X86::VMOVLHPSrr,X86::VMOVHPSrm}
```
It seems the three pairs above are mistakenly killed.
But we can add them back manually later.
Reviewed By: Amir
Differential Revision: https://reviews.llvm.org/D122477
2022-04-06 12:53:05 +08:00
Shengchen Kan
4a48742922
[X86][tablgen] Extract common functions in X86EVEX2VEXTablesEmitter.cpp and X86FoldTablesEmitter.cpp to avoid duplicated code. NFC
2022-03-27 08:47:18 +08:00
Shengchen Kan
460e1bd66e
[X86][tablgen] Remove PointerLikeRegClass from isRegisterOperand b/c getRegOperandSize crashes for it. NFCI
2022-03-27 07:35:47 +08:00
Shengchen Kan
3e41917984
[X86][tablgen] Remove useless check in X86FoldTablesEmitter.cpp. NFC
...
Any `X86Inst` has a name.
2022-03-27 00:09:29 +08:00
Shengchen Kan
a86cd3be1c
[X86][tablgen] Rename some fields for RecognizableInstrBase to align with fields in TD file. NFC
...
The comment for `HasVEX_L` is updated.
2022-03-26 23:32:50 +08:00
Shengchen Kan
dc68ca3eff
[X86][tablgen] Rename field hasREX_WPrefix to hasREX_W for X86Inst. NFC
...
To make it more like hasVEX_L and hasEVEX_K, etc.
2022-03-26 23:14:08 +08:00