summaryrefslogtreecommitdiff
path: root/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
AgeCommit message (Collapse)Author
2025-06-28MCParsedAsmOperand::print: Add MCAsmInfo parameterFangrui Song
so that subclasses can provide the appropriate MCAsmInfo to print MCExpr objects. At present, llvm/utils/TableGen/AsmMatcherEmitter.cpp constucts a generic MCAsmInfo.
2025-06-28MC: Migrate away from operator<< MCExprFangrui Song
MCExpr::print has an optional MCAsmInfo argument, which is error-prone when omitted. MCExpr::print and the convenience helper operator<< are discouraged to use. Switch to MCAsmInfo::printExpr instead. Use the target-specific MCAsmInfo if available.
2025-06-27[AMDGPU] Use StringRef::consume_back (NFC) (#146194)Kazu Hirata
Note that StringRef::consume_back returns true while consuming the given prefix if present.
2025-06-17[llvm] annotate interfaces in llvm/Target for DLL export (#143615)Andrew Rogers
## Purpose This patch is one in a series of code-mods that annotate LLVM’s public interface for export. This patch annotates the `llvm/Target` library. These annotations currently have no meaningful impact on the LLVM build; however, they are a prerequisite to support an LLVM Windows DLL (shared library) build. ## Background This effort is tracked in #109483. Additional context is provided in [this discourse](https://discourse.llvm.org/t/psa-annotating-llvm-public-interface/85307), and documentation for `LLVM_ABI` and related annotations is found in the LLVM repo [here](https://github.com/llvm/llvm-project/blob/main/llvm/docs/InterfaceExportAnnotations.rst). A sub-set of these changes were generated automatically using the [Interface Definition Scanner (IDS)](https://github.com/compnerd/ids) tool, followed formatting with `git clang-format`. The bulk of this change is manual additions of `LLVM_ABI` to `LLVMInitializeX` functions defined in .cpp files under llvm/lib/Target. Adding `LLVM_ABI` to the function implementation is required here because they do not `#include "llvm/Support/TargetSelect.h"`, which contains the declarations for this functions and was already updated with `LLVM_ABI` in a previous patch. I considered patching these files with `#include "llvm/Support/TargetSelect.h"` instead, but since TargetSelect.h is a large file with a bunch of preprocessor x-macro stuff in it I was concerned it would unnecessarily impact compile times. In addition, a number of unit tests under llvm/unittests/Target required additional dependencies to make them build correctly against the LLVM DLL on Windows using MSVC. ## Validation Local builds and tests to validate cross-platform compatibility. This included llvm, clang, and lldb on the following configurations: - Windows with MSVC - Windows with Clang - Linux with GCC - Linux with Clang - Darwin with Clang
2025-06-13[AMDGPU][AsmParser] Support true16 register suffix for valid register range ↵Shilei Tian
(#143997)
2025-06-04[AMDGPU][True16][MC][CodeGen] true16 mode for v_cvt_pk_bf8/fp8_f32 (#141881)Brox Chen
Update true16/fake16 profile with v_cvt_pk_bf8/fp8_f32, keeping the vdst_in profile, and update codegen pattern. update mc test and codegen test.
2025-06-03[AMDGPU] Bugfix for scaled MFMA parsing FP literals (#142493)Vigneshwar Jayakumar
bugfix on parsing FP literals for scale values in the scaled MFMA. Due to the change in order of operands between MCinst and parsed operands, the FP literal imms for scale values were not parsed correctly. --------- Co-authored-by: Matt Arsenault <arsenm2@gmail.com>
2025-05-27MCSymbol: Remove the default argument of getVariableValueFangrui Song
It has been made ineffective by e015626f189dc76f8df9fdc25a47638c6a2f3feb. This change migrates the users.
2025-05-26MCParser: Error when .set reassigns a non-redefinable variableFangrui Song
The conditions in parseAssignmentExpression are conservative. We should also report an error when a non-redefiniable variable (e.g. .equiv followed by .set; .weakref followed by .set). Make MCAsmStreamer::emitLabel call setOffset to make the behavior similar to MCObjectStreamer. `isUndefined()` can now be replaced with `isUnset()`. Additionally, fix an AMDGPU API user (tested by a few tests including MC/AMDGPU/hsa-v4.s)
2025-05-26[AMDGPU] Use StringRef::consume_front (NFC) (#141442)Kazu Hirata
2025-05-25Replace #include MCAsmLexer.h with AsmLexer.hFangrui Song
MCAsmLexer.h has been made a forwarder header since #134207
2025-05-21[AMDGPU] Fix scale opsel flags for scaled MFMA operations (#140183)Vigneshwar Jayakumar
Fix for src scale opsel flags encoding and ASM parsing for gfx950 scaled MFMA.
2025-05-09[AMDGPU][NFC] Remove _DEFERRED operands. (#139123)Ivan Kosarev
All immediates are deferred now.
2025-05-08[AMDGPU][NFC] Remove unused operand types. (#139062)Ivan Kosarev
2025-05-07[AMDGPU] Fix regclass check for PackedF32InputMods in AsmParser. (#138767)Stanislav Mekhanoshin
Downstream patch by Pravin Jagtap.
2025-04-10[AMDGPU] Rename TH_STORE_RT_WB to TH_STORE_WB (#135171)Mirko Brkušanin
So it matches the documentation Fixes: SWDEV-526726
2025-03-28[AMDGPU] Hoist some constant stuff out of the loop in AMDGPUAsmParser.cpp. ↵Stanislav Mekhanoshin
NFC. (#133398)
2025-03-14[NFC][AMDGPU] Replace more direct arch comparison with isAMDGCN() (#131379)Shilei Tian
This is an extension of #131357. Hopefully this would be the last one.
2025-03-02[MC] Move VariantKind info to MCAsmInfoFangrui Song
Follow-up to 14951a5a3120e50084b3c5fb217e2d47992a24d1 * Unify getVariantKindName and getVariantKindForName * Allow each target to specify the preferred case (albeit ignored in MCParser) Note: targets that use variant kinds should call MCExpr::print with a non-null MAI to print variant kinds. operator<< passes a nullptr to `MCExpr::print`, which should be avoided (e.g. Hexagon; fixed in commit cf00ac81ac049cddb80aec1d6d88b8fab4f209e8).
2025-03-02[MCParser] Extract some VariantKind from getVariantKindForNameFangrui Song
All VariantKinds except VK_None/VK_Invalid are target-specific (e.g. a target may not support "@plt" even if it is widely available). Move the parsers to lib/Target to ensure that VariantKind from unrelated targets will not be parsed.
2025-02-12[TableGen] Emit OpName as an enum class instead of a namespace (#125313)Rahul Joshi
- Change InstrInfoEmitter to emit OpName as an enum class instead of an anonymous enum in the OpName namespace. - This will help clearly distinguish between values that are OpNames vs just operand indices and should help avoid bugs due to confusion between the two. - Rename OpName::OPERAND_LAST to NUM_OPERAND_NAMES. - Emit declaration of getOperandIdx() along with the OpName enum so it doesn't have to be repeated in various headers. - Also updated AMDGPU, RISCV, and WebAssembly backends to conform to the new definition of OpName (mostly mechanical changes).
2025-02-11[AMDGPU] Create new directive .amdhsa_inst_pref_size (#126622)Stanislav Mekhanoshin
The field INST_PREF_SIZE is available since gfx11.
2025-02-05[AMDGPU][True16][MC] validate op_sel and .l/.h syntax (#125872)Brox Chen
check if op_sel is consistent with .l/.h syntax if both are presented reopen this https://github.com/llvm/llvm-project/pull/123250 since problem is resolved in https://github.com/llvm/llvm-project/pull/125561
2025-01-31[AMDGPU] Allow unaligned VGPR for ds_read_b96_tr_b6 (#125169)Pravin Jagtap
All load transpose instructions follow gfx950 standard of even aligned VGPR except ds_read_b96_tr_b6, which allows unaligned VGPR. Co-authored-by: Sirish Pande [Sirish.Pande@amd.com](mailto:Sirish.Pande@amd.com)
2025-01-30Revert "[AMDGPU][True16][MC] validate op_sel and .l/.h syntax (#123250)"Kazu Hirata
This reverts commit fabe747bf051697cde72a963f1012d6ba9c3f5f5. Multiple buildbots are failing. See: https://github.com/llvm/llvm-project/pull/123250
2025-01-30[AMDGPU][True16][MC] validate op_sel and .l/.h syntax (#123250)Brox Chen
check if op_sel is consistent with .l/.h syntax if both are presented
2025-01-03[AMDGPU][MC] Allow null where 128b or larger dst reg is expected (#115200)Jun Wang
For GFX10+, currently null cannot be used as dst reg in instructions that expect the dst reg to be 128b or larger (e.g., s_load_dwordx4). This patch fixes this problem while ensuring null cannot be used as S#, T#, or V#.
2024-12-04AMDGPU: Simplify definition of bitop3 operand. NFC. (#118648)Matt Arsenault
Co-authored-by: Jay Foad <jay.foad@amd.com>
2024-11-26AMDGPU: Verify f8f6f4 formats in assembler (#117826)Matt Arsenault
Verify the register widths of the corresponding operands match the floating point format expected size.
2024-11-26AMDGPU: MC support for V_CVT_SCALE_SR_FP4 instructions (#117795)Matt Arsenault
Co-authored-by: Shilei Tian <shilei.tian@amd.com>
2024-11-26Builtins & Codegen support for v_cvt_scalef32_pk_{fp|bf}8_{f|bf}16 for ↵Matt Arsenault
gfx950 (#117742) OPSEL[3] determines low/high 16 bits of word to write. Co-authored-by: Pravin Jagtap <Pravin.Jagtap@amd.com>
2024-11-25AMDGPU: MC support for v_cvt_scalef32_pk_fp4_{f|bf}16 on gfx950. (#117594)Matt Arsenault
These instructions have non-standard use of OPSEL bits to select dest write byte. The src2_modifiers operand is used without having its corresponding src2 operand by introducing dummy src2. Co-authored-by: Pravin Jagtap <Pravin.Jagtap@amd.com>
2024-11-25AMDGPU: Add MC support for gfx950 V_BITOP3_B32/B16 (#117379)Matt Arsenault
Co-authored-by: Pravin Jagtap <Pravin.Jagtap@amd.com>
2024-11-13[AMDGPU] Remove unused includes (NFC) (#116154)Kazu Hirata
Identified with misc-include-cleaner.
2024-10-03[AMDGPU] Qualify auto. NFC. (#110878)Jay Foad
Generated automatically with: $ clang-tidy -fix -checks=-*,llvm-qualified-auto $(find lib/Target/AMDGPU/ -type f)
2024-09-28[AMDGPU] Use MCRegister. NFCCraig Topper
2024-09-27[AMDGPU][MC] Implement fft and rotate modes for ds_swizzle_b32 (#108064)Jun Wang
In addition to the basic mode, the ds_swizzle_b32 is supposed to support two specific modes: fft and rotate. This patch implements those two modes.
2024-09-23[AMDGPU] Include unused preload kernarg in KD total SGPR count (#104743)Austin Kerbow
Unlike with implicitly preloaded data UserSGPRs firmware is unable to handle cases where SGPRs for kernel arguments contain preloaded data but not are not explicitly referenced in the kernel. We need to include these preloaded SGPRs in the GRANULATED_WAVEFRONT_SGPR_COUNT calculation to not clobber SGPRs in adjacent waves.
2024-09-22[llvm] Use std::optional::value_or (NFC) (#109568)Kazu Hirata
2024-09-20[llvm] Don't call raw_string_ostream::flush() (NFC)Youngsuk Kim
Don't call raw_string_ostream::flush(), which is essentially a no-op. As specified in the docs, raw_string_ostream is always unbuffered. ( 65b13610a5226b84889b923bae884ba395ad084d for further reference )
2024-09-20[AMDGPU] Use Lo_32 and Hi_32 helpers (NFC) (#109413)Nikita Popov
2024-09-18[NFC] Update function names in MCTargetAsmParser.h (#108643)Lei Huang
Update function names to adhere to LLVM coding standard.
2024-09-11[AMDGPU][True16][MC] 16bit vsrc and vdst support in MC (#104510)Brox Chen
This is a large patch includes the MC level support for V_CVT_F16_F32, V_CVT_F32_F16 and V_LDEXP_F16 in true16 format. This patch includes the asm/disasm changes to encode/decode the 16bit vsrc, vdst and src modifieres for vop and dpp format. This patch is a dependency for many 16 bit instructions while only three instructions are updated to make it easier to review. There will be another patch to support these three instructions in the codeGen level, this patch just replaces these two instructions with its fake16 format.
2024-08-26[MC] Update MCOperand::getReg/setReg/createReg and MCInstBuilder::addReg to ↵Craig Topper
use MCRegister. (#106015) Replace unsigned with MCRegister. Update some ternary operators that started giving errors.
2024-08-14[AMDGPU][NFC] Rename isHi() to isHi16Reg() for clarity. (#103888)Ivan Kosarev
And declare it to take an MCRegister. Also rename related entities and remove a comment for the function that depending on its purpose is either irrelevant or misleading.
2024-08-12[AMDGPU][AsmParser] Eliminate validateExeczVcczOperands(). (#102600)Ivan Kosarev
Mention the names of unavailable registers in error messages to not make the diagnostics for execz/vccz less rich than it was. Clean up unnecessary name qualifications while there. Part of <https://github.com/llvm/llvm-project/issues/62629>.
2024-08-09[AMDGPU][AsmParser][NFC] Remove a misleading comment. (#102604)Ivan Kosarev
The work of ParseRegularReg() should remain to be parsing the register as it was specified, and not to try translate it to anything else. It's up to operand predicates to decide on what is and is not an acceptable register for an operand, including considering its expected register class, and for the rest of the AsmParser infrastructure to handle it respectively from there on.
2024-08-08[AMDGPU][AsmParser] Print names of parsed registers in debug output. (#102328)Ivan Kosarev
Knowing just their numeric values is not very helpful. Part of <https://github.com/llvm/llvm-project/issues/62629>.
2024-08-06[AMDGPU] Add parseStringOrIntWithPrefix helper in asm parser (#102213)Stanislav Mekhanoshin
When we have a modifier with a value (like dst_sel:DWORD for example) we only accept symbolic values. SP3 allows to use numberic constants as well. Adding a helper function to allow both. Besides the compatibility it is easier to use.
2024-07-23[AMDGPU][MC] Improve error message for missing dim operand (#96588)Jun Wang
For GFX10+, the MIMG instrucitons generally require a dim operand. However, when dim is missing, the assembler produces the error message "operands are not valid for this GPU or mode" (See issue https://github.com/llvm/llvm-project/issues/47585). This patch fixes the issue by producing a more direct error message. --------- Co-authored-by: Jun Wang <jun.wang7@amd.com>