summaryrefslogtreecommitdiff
path: root/llvm/lib/Target/X86/X86InstrSystem.td
AgeCommit message (Collapse)Author
2024-11-09[TableGen][SelectionDAG] Remove the `implicit` DAG node (#115295)Sergei Barannikov
The node was introduced in 59c39dc1 and was intended to allow writing patterns like this: `[(set AL, (mul AL, GR8:$src1)), (implicit EFLAGS)]` However, it does not introduce new functionality because the same pattern can be equivalently expressed as: `[(set AL, EFLAGS, (mul AL, GR8:$src1))]` The latter form is also more flexible as it allows reordering output operands. In most places uses of `implicit` were redundant -- removing them didn't change anything in the generated DAG tables. The only three cases where it did have effect are in X86InstrArithmetic.td and X86InstrSystem.td -- those were rewritten to use `set` node. Removing `implicit` from some patterns made them importable by GISel, hence the change in a test.
2024-10-28[X86][MC] Support instructions of MSR_IMM (#113524)Freddy Ye
Ref.: https://cdrdv2.intel.com/v1/dl/getContent/671368
2024-05-15[X86][MC] Support Intel FRED and LKGS instructions. (#91909)Freddy Ye
Spec reference: https://cdrdv2.intel.com/v1/dl/getContent/678938
2024-02-29[X86][MC] Teach disassembler to recognize apx instructions which ignores W ↵XinWang10
bit (#82747) Extended VMX instructions and 8 bit apx extended instructions don't need W bit, they are marked as W ignored in spec. RFC: https://discourse.llvm.org/t/rfc-design-for-apx-feature-egpr-and-ndd-support/73031/4
2024-02-15[LLVM][X86] Add EFLAGS Defs for VERR/VERW instructions (#81824)riChar
VERR/VERW instructions will define ZF flag.
2024-02-15[clang][X86] X86::LAR X86::LSL add_implicate eflags (#80993)Qfrost
[@xia0ji233](https://github.com/xia0ji233) and I found that X86::LAR and X86::lSR implicit use eflags register. However, it was not been defined in LLVM, which means we will get wrong alive-result if we use these two instructions. ![T~ _81W6A}J}{AP{DF%E}KY](https://github.com/llvm/llvm-project/assets/58380176/b84e758b-2978-49e7-a11c-726fd66e1976)
2024-01-26[X86] Support promoted ENQCMD, KEYLOCKER and USERMSR (#77293)XinWang10
R16-R31 was added into GPRs in https://github.com/llvm/llvm-project/pull/70958, This patch supports the promoted ENQCMD, KEYLOCKER and USER-MSR instructions in EVEX space. RFC: https://discourse.llvm.org/t/rfc-design-for-apx-feature-egpr-and-ndd-support/73031/4
2024-01-05[X86]Support lowering for APX Promoted SHA/MOVDIR/CRC32/INVPCID/CET ↵XinWang10
instructions (#76786) R16-R31 was added into GPRs in https://github.com/llvm/llvm-project/pull/70958, This patch supports the lowering for promoted SHA/MOVDIR/CRC32/INVPCID/CET. RFC: https://discourse.llvm.org/t/rfc-design-for-apx-feature-egpr-and-ndd-support/73031/4
2023-12-27[X86] Correct operand order of UWRMSR. (#76389)Freddy Ye
2023-12-24[X86][NFC] Set default OpPrefix to PS for XOP/VEX/EVEX instructionsShengchen Kan
It helps simplify the class definitions. Now, the only explicit usage of PS is to check prefix 0x66/0xf2/0xf3 can not be used a prefix, e.g. wbinvd. See 82974e0114f02ffc07557e217d87f8dc4e100a26 for more details.
2023-12-22[X86][NFC] Not imply TB in PS|PD|XS|XDShengchen Kan
This can help us aovid introducing new classes T_MAP*PS|PD|XS|XD when a new opcode map is supported. And, T_MAP*PS|PD|XS|XD does not look better than T_MAP*, PS|PD|XS|XD.
2023-12-22[X86][MC] Support Enc/Dec for EGPR for promoted CET instruction (#76023)XinWang10
R16-R31 was added into GPRs in https://github.com/llvm/llvm-project/pull/70958, This patch supports the encoding/decoding for promoted CET instruction in EVEX space. RFC: https://discourse.llvm.org/t/rfc-design-for-apx-feature-egpr-and-ndd-support/73031/4
2023-12-21[X86][NFC] Not imply EVEX in NoCD8Shengchen Kan
NDD (new data destination) instructions need to set NoCD8 and EVEX_4V. EVEX_4V already implies EVEX. If NoCD8 implied EVEX too, we would not be able to reuse the class.
2023-12-07[X86][MC] Support Enc/Dec for EGPR for promoted INVPCID instruction (#74548)XinWang10
R16-R31 was added into GPRs in https://github.com/llvm/llvm-project/pull/70958, This patch supports the encoding/decoding for promoted INVPCID instruction in EVEX space. RFC: https://discourse.llvm.org/t/rfc-design-for-apx-feature-egpr-and-ndd-support/73031/4
2023-10-16[X86] Add USER_MSR instructions. (#68944)Freddy Ye
For more details about this instruction, please refer to the latest ISE document: https://www.intel.com/content/www/us/en/develop/download/intel-architecture-instruction-set-extensions-programming-reference.html
2023-07-19[X86] Add PBNDKB instruction.Freddy Ye
For more details about this instruction, please refer to the latest ISE document: https://www.intel.com/content/www/us/en/develop/download/intel-architecture-instruction-set-extensions-programming-reference.html Reviewed By: pengfei, skan Differential Revision: https://reviews.llvm.org/D155142
2023-04-05[X86][mem-fold] Remove definition of NotMemoryFoldable and move code into a ↵Shengchen Kan
def file, NFCI The goal is to centralize the logic of the memory fold.
2022-10-19[X86] Add WRMSRNS instructions.Freddy Ye
For more details about these instructions, please refer to the latest ISE document: https://www.intel.com/content/www/us/en/develop/download/intel-architecture-instruction-set-extensions-programming-reference.html Reviewed By: craig.topper Differential Revision: https://reviews.llvm.org/D135935
2022-10-19[X86] Add MSRLIST instructions.Freddy Ye
For more details about these instructions, please refer to the latest ISE document: https://www.intel.com/content/www/us/en/develop/download/intel-architecture-instruction-set-extensions-programming-reference.html Reviewed By: skan, RKSimon Differential Revision: https://reviews.llvm.org/D135934
2022-07-06[X86] Add RDPRU instructionPaul Robinson
Add support for the RDPRU instruction on Zen2 processors. User-facing features: - Clang option -m[no-]rdpru to enable/disable the feature - Support is implicit for znver2/znver3 processors - Preprocessor symbol __RDPRU__ to indicate support - Header rdpruintrin.h to define intrinsics - "rdpru" mnemonic supported for assembler code Internal features: - Clang builtin __builtin_ia32_rdpru - IR intrinsic @llvm.x86.rdpru Differential Revision: https://reviews.llvm.org/D128934
2022-06-16[PS5] Use same debug trap instruction as PS4Paul Robinson
2022-03-14[X86] Fix cosmetic issues in instruction mnemonicsAmir Ayupov
- Remove spurious } in invlpgb mnemonic - Add \t between mnemonic and operands for ud1 instructions Reviewed By: skan, craig.topper Differential Revision: https://reviews.llvm.org/D121570
2021-10-23[X86] Don't add implicit REP prefix to VIA PadLock xstoreJessica Clarke
Commit 8fa3e8fa1492 added an implicit REP prefix to all VIA PadLock instructions, but GNU as doesn't add one to xstore, only all the others. This resulted in a kernel panic regression in FreeBSD upon updating to LLVM 11 (https://bugs.freebsd.org/259218) which includes the commit in question. This partially reverts that commit. Reviewed By: craig.topper Differential Revision: https://reviews.llvm.org/D112355
2021-09-02[X86] Remove isel predicates for xgetbv/xsetbv instructions so they can work ↵Craig Topper
on Windows. https://reviews.llvm.org/D56686 was supposed to allow these to work on Windows without needing to enable the xsave feature to match MSVC. It seems this didn't work because the backend isel patterns would still block it. This patch removes the predicates from the isel patterns. Fixes PR51706. Reviewed By: pengfei Differential Revision: https://reviews.llvm.org/D109097
2021-07-02[X86] Modify LOOP*, HLT control flow attributesAmir Ayupov
Add missing control flow attributes: - LOOP*: isBranch, isTerminator - HLT: isTerminator This helps downstream disassemblers (such as BOLT) reconstruct the control flow graph more accurately. Reviewed By: craig.topper Differential Revision: https://reviews.llvm.org/D102297
2021-05-09[NFCI][X86] Mark a few lately-added system instructions as such for ↵Roman Lebedev
Scheduling purposes
2021-01-19[X86] Add segment and address-size override prefixesBill Wendling
X86 allows for the "addr32" and "addr16" address size override prefixes. Also, these and the segment override prefixes should be recognized as valid prefixes. Differential Revision: https://reviews.llvm.org/D94726
2020-12-08UBSAN: emit distinctive trapsTim Northover
Sometimes people get minimal crash reports after a UBSAN incident. This change tags each trap with an integer representing the kind of failure encountered, which can aid in tracking down the root cause of the problem.
2020-10-25[X86] Don't disassemble wbinvd with 0xf2 or 0x66 prefix.Craig Topper
The 0xf3 prefix has been defined as wbnoinvd on Icelake Server. So the prefix isn't ignored by the CPU. AMD documentation suggests that wbnoinvd is treated as wbinvd on older processors. Intel documentation is not clear. Perhaps 0xf2 and 0x66 are treated the same, but its not documented. This patch changes TB to PS in the td file so 0xf2 and 0x66 will be treated as errors. This matches versions of objdump after wbnoinvd was added.
2020-07-15[X86] Allow lsl/lar to be parsed with a GR16, GR32, or GR64 as source register.Craig Topper
This matches GNU assembler behavior. Operand size is determined only from the destination register.
2020-07-15[X86] Teach assembler parser to accept lsl and lar with a 64 or 32 source ↵Craig Topper
register when the destination is a 64 register. Previously we only accepted a 32-bit source with a 64-bit dest. Accepting 64-bit as well is more consistent with gas behavior. I think maybe we should accept 16 bit register as well, but I'm not sure.
2020-06-19[X86] Correct the implementation of ud1(a.k.a. ud2b) instruction.Craig Topper
We were missing the modrm byte this instruction has according to current Intel SDM. Experiments with gcc indicate that different modrm values are chosen based on 2 operands so I've added those as well. I think our previous implementation was based on an older behavior of binutils that has since been changed.
2020-06-11[X86] Force VIA PadLock crypto instructions to emit a 0xF3 prefix when they ↵Craig Topper
encode to match what GNU as does. The spec for these says they need 0xf3 but also mentions REP before the mnemonic. But I don't think its fair to users to make them write REP first. And gas doesn't make them. objdump seems to disassemble with or without the prefix and just prints any 0xf3 as REP.
2020-06-11[X86] Replace TB with PS on instructions that are documented in the SDM with ↵Craig Topper
'NP' 'NP' means that the instruction is not recognized with a 66, F2 or F3 prefix. It will either #UD or decode to a different instruction. All of the cases are here should fall into the #UD variety since we should be detecting the collision with other instructions when we build the disassembler tables.
2020-02-21[X86] Add a new format type for instructions that represent named prefix ↵Craig Topper
bytes like data16 and rep. Use it to make a simpler version of isPrefix. isPrefix was added to support the patches to align branches. it relies on a switch over instruction names. This moves those opcodes to a new format so the information is tablegen and we can just check for a specific value in some bits in TSFlags instead. I've left the other function in place for now so that the existing patches in phabricator will still work. I'll work with the owner to get them migrated.
2019-09-19Reapply r372285 "GlobalISel: Don't materialize immarg arguments to intrinsics"Matt Arsenault
This reverts r372314, reapplying r372285 and the commits which depend on it (r372286-r372293, and r372296-r372297) This was missing one switch to getTargetConstant in an untested case. llvm-svn: 372338
2019-09-19Revert r372285 "GlobalISel: Don't materialize immarg arguments to intrinsics"Hans Wennborg
This broke the Chromium build, causing it to fail with e.g. fatal error: error in backend: Cannot select: t362: v4i32 = X86ISD::VSHLI t392, Constant:i8<15> See llvm-commits thread of r372285 for details. This also reverts r372286, r372287, r372288, r372289, r372290, r372291, r372292, r372293, r372296, and r372297, which seemed to depend on the main commit. > Encode them directly as an imm argument to G_INTRINSIC*. > > Since now intrinsics can now define what parameters are required to be > immediates, avoid using registers for them. Intrinsics could > potentially want a constant that isn't a legal register type. Also, > since G_CONSTANT is subject to CSE and legalization, transforms could > potentially obscure the value (and create extra work for the > selector). The register bank of a G_CONSTANT is also meaningful, so > this could throw off future folding and legalization logic for AMDGPU. > > This will be much more convenient to work with than needing to call > getConstantVRegVal and checking if it may have failed for every > constant intrinsic parameter. AMDGPU has quite a lot of intrinsics wth > immarg operands, many of which need inspection during lowering. Having > to find the value in a register is going to add a lot of boilerplate > and waste compile time. > > SelectionDAG has always provided TargetConstant for constants which > should not be legalized or materialized in a register. The distinction > between Constant and TargetConstant was somewhat fuzzy, and there was > no automatic way to force usage of TargetConstant for certain > intrinsic parameters. They were both ultimately ConstantSDNode, and it > was inconsistently used. It was quite easy to mis-select an > instruction requiring an immediate. For SelectionDAG, start emitting > TargetConstant for these arguments, and using timm to match them. > > Most of the work here is to cleanup target handling of constants. Some > targets process intrinsics through intermediate custom nodes, which > need to preserve TargetConstant usage to match the intrinsic > expectation. Pattern inputs now need to distinguish whether a constant > is merely compatible with an operand or whether it is mandatory. > > The GlobalISelEmitter needs to treat timm as a special case of a leaf > node, simlar to MachineBasicBlock operands. This should also enable > handling of patterns for some G_* instructions with immediates, like > G_FENCE or G_EXTRACT. > > This does include a workaround for a crash in GlobalISelEmitter when > ARM tries to uses "imm" in an output with a "timm" pattern source. llvm-svn: 372314
2019-09-19GlobalISel: Don't materialize immarg arguments to intrinsicsMatt Arsenault
Encode them directly as an imm argument to G_INTRINSIC*. Since now intrinsics can now define what parameters are required to be immediates, avoid using registers for them. Intrinsics could potentially want a constant that isn't a legal register type. Also, since G_CONSTANT is subject to CSE and legalization, transforms could potentially obscure the value (and create extra work for the selector). The register bank of a G_CONSTANT is also meaningful, so this could throw off future folding and legalization logic for AMDGPU. This will be much more convenient to work with than needing to call getConstantVRegVal and checking if it may have failed for every constant intrinsic parameter. AMDGPU has quite a lot of intrinsics wth immarg operands, many of which need inspection during lowering. Having to find the value in a register is going to add a lot of boilerplate and waste compile time. SelectionDAG has always provided TargetConstant for constants which should not be legalized or materialized in a register. The distinction between Constant and TargetConstant was somewhat fuzzy, and there was no automatic way to force usage of TargetConstant for certain intrinsic parameters. They were both ultimately ConstantSDNode, and it was inconsistently used. It was quite easy to mis-select an instruction requiring an immediate. For SelectionDAG, start emitting TargetConstant for these arguments, and using timm to match them. Most of the work here is to cleanup target handling of constants. Some targets process intrinsics through intermediate custom nodes, which need to preserve TargetConstant usage to match the intrinsic expectation. Pattern inputs now need to distinguish whether a constant is merely compatible with an operand or whether it is mandatory. The GlobalISelEmitter needs to treat timm as a special case of a leaf node, simlar to MachineBasicBlock operands. This should also enable handling of patterns for some G_* instructions with immediates, like G_FENCE or G_EXTRACT. This does include a workaround for a crash in GlobalISelEmitter when ARM tries to uses "imm" in an output with a "timm" pattern source. llvm-svn: 372285
2019-04-04[X86] Remove CustomInserters for RDPKRU/WRPKRU. Use some custom lowering and ↵Craig Topper
new ISD opcodes instead. These inserters inserted some instructions to zero some registers and copied from virtual registers to physical registers. This change instead inserts the zeros directly into the DAG at lowering time using new ISD opcodes that take the extra zeroes as inputs. The zeros will then go through isel on their own to select the MOV32r0 pseudo. Then we just need to mention the physical registers directly in the isel patterns and the isel table and InstrEmitter will take care of inserting the necessary copies to/from physical registers. llvm-svn: 357659
2019-03-20[X86] Remove X86 specific dag nodes for RDTSC/RDTSCP/RDPMC. NFCIAndrea Di Biagio
This patch removes the following dag node opcodes from namespace X86ISD: RDTSC_DAG, RDTSCP_DAG, RDPMC_DAG The logic that expands RDTSC/RDPMC/XGETBV intrinsics is basically the same. The only differences are: RDTSC/RDTSCP don't implicitly read ECX. RDTSCP also implicitly writes ECX. I moved the common expansion logic into a helper function with the goal to get rid of code repetition. That helper is now used for the expansion of RDTSC/RDTSCP/RDPMC/XGETBV intrinsics. No functional change intended. Differential Revision: https://reviews.llvm.org/D59547 llvm-svn: 356546
2019-01-19Update the file headers across all of the LLVM projects in the monorepoChandler Carruth
to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
2018-07-13[cfi-verify] Support AArch64.Joel Galenson
This patch adds support for AArch64 to cfi-verify. This required three changes to cfi-verify. First, it generalizes checking if an instruction is a trap by adding a new isTrap flag to TableGen (and defining it for x86 and AArch64). Second, the code that ensures that the operand register is not clobbered between the CFI check and the indirect call needs to allow a single dereference (in x86 this happens as part of the jump instruction). Third, we needed to ensure that return instructions are not counted as indirect branches. Technically, returns are indirect branches and can be covered by CFI, but LLVM's forward-edge CFI does not protect them, and x86 does not consider them, so we keep that behavior. In addition, we had to improve AArch64's code to evaluate the branch target of a MCInst to handle calls where the destination is not the first operand (which it often is not). Differential Revision: https://reviews.llvm.org/D48836 llvm-svn: 337007
2018-06-12[X86] Add NotMemoryFoldable to a bunch of instructions to suppress them from ↵Craig Topper
the autogenerated load folding table. Most of these are system instructions or other instructions we don't use in CodeGen. No point wasting space for them in the table. Removing them from the autogenerated table makes it easier to review the manual table. A few are real opcode collisions where the memory and register forms are completely different instructions. llvm-svn: 334474
2018-05-25[x86] invpcid LLVM intrinsicGabor Buella
Re-add the feature flag for invpcid, which was removed in r294561. Add an intrinsic, which always uses a 32 bit integer as first argument, while the instruction actually uses a 64 bit register in 64 bit mode for the INVPCID_TYPE argument. Reviewers: craig.topper Reviewed By: craig.topper Differential Revision: https://reviews.llvm.org/D47141 llvm-svn: 333255
2018-05-18[X86][CET] Changing -fcf-protection behavior to comply with gcc (LLVM part)Alexander Ivchenko
This patch aims to match the changes introduced in gcc by https://gcc.gnu.org/ml/gcc-cvs/2018-04/msg00534.html. The IBT feature definition is removed, with the IBT instructions being freely available on all X86 targets. The shadow stack instructions are also being made freely available, and the use of all these CET instructions is controlled by the module flags derived from the -fcf-protection clang option. The hasSHSTK option remains since clang uses it to determine availability of shadow stack instruction intrinsics, but it is no longer directly used. Comes with a clang patch (D46881). Patch by mike.dvoretsky Differential Revision: https://reviews.llvm.org/D46882 llvm-svn: 332705
2018-05-10[X86] ptwrite intrinsicGabor Buella
Reviewers: craig.topper, RKSimon Reviewed By: craig.topper, RKSimon Differential Revision: https://reviews.llvm.org/D46539 llvm-svn: 331961
2018-05-08[X86] Tag PCONFIG instruction with WriteSystem scheduler classSimon Pilgrim
llvm-svn: 331773
2018-05-08[x86] Introduce the pconfig instructionGabor Buella
Reviewers: craig.topper, zvi Reviewed By: craig.topper Differential Revision: https://reviews.llvm.org/D46430 llvm-svn: 331739
2018-05-01[X86] Remove 'opaque ptr' from the intel syntax parser and printer.Craig Topper
Previously for instructions like fxsave we would print "opaque ptr" as part of the memory operand. Now we print nothing. We also no longer accept "opaque ptr" in the parser. We still accept any size to be specified for these instructions, but we may want to consider only parsing when no explicit size is specified. This what gas does. llvm-svn: 331243
2018-04-30[X86] Use a MnemonicAlias instead of an InstAlias.Craig Topper
llvm-svn: 331157