sext() modifier is supported in SDWA instructions only for integer operands. Spec is unclear should integer operands support abs and neg modifiers with sext - for now they are not supported.
Renamed InputModsWithNoDefault to FloatInputMods. Added SextInputMods for operands that support sext() modifier.
Added AMDGPUOperand::Modifier struct to handle register and immediate modifiers.
Code cleaning in AMDGPUOperand class: organize method in groups (render-, predicate-methods...).
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
The change introduces some new error messages. It would be good to create tests for those. You may discover (and then fix) something unexpected.
lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp | ||
---|---|---|
73 ↗ | (On Diff #59566) | After 1st glance, I would replace has/getSext... by has/getInteger... |
90–95 ↗ | (On Diff #59566) | Please comment out why floating modifiers take precedence over integer ones. |
382 ↗ | (On Diff #59566) | This construct asserts cleaner. +Typo in the last word. assert(... && "float (abs, neg) and sext modifiers should not be used simultaneously"); |
2382 ↗ | (On Diff #59566) | floating-point |
lib/Target/AMDGPU/SIDefines.h | ||
86 ↗ | (On Diff #59566) | Suspicious. If this is correct, explain why. |
Fixess for review. Renamed FloatInputMods to FPInputMods and SextInputMods to IntInputMods.
lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp | ||
---|---|---|
73 ↗ | (On Diff #59862) | I would better use "Integer", not "Int". |
83 ↗ | (On Diff #59862) | Still getSext..., not getInteger... Perhaps Sext is Ok but explain why, please. |
90–95 ↗ | (On Diff #59862) | Not done, as far as I see. |
lib/Target/AMDGPU/SIDefines.h | ||
86 ↗ | (On Diff #59862) | Not done. |
I forgot to submit my previous comments.
lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp | ||
---|---|---|
73 ↗ | (On Diff #59862) | I prefer Int because it is not that long as Integer. Otherwise method names would be much longer. Also if we use FP for floating point then usage of Int as acronim for Integer looks better. |
90–95 ↗ | (On Diff #59566) | Floating modifiers have precedence because they are used more often. FP and sext modifiers can't be set immediately so this doesn't affect correctness. |
91–93 ↗ | (On Diff #59566) | I'm not sure that I understood your comment correctly. There is no need for return after this if-else construct because it covers all possible situations. If you are speaking about coding standatd (http://llvm.org/docs/CodingStandards.html#don-t-use-else-after-a-return) then I don't see what is better way to write this code fragment. |
lib/Target/AMDGPU/SIDefines.h | ||
86 ↗ | (On Diff #59566) | This is correct. |
Looks good enough, but I recommend addressing my comments prior committing this.
lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp | ||
---|---|---|
73 ↗ | (On Diff #59872) | My point was that "int" might be misunderstood as 32-bit integer type (just like "float" above). |
90–95 ↗ | (On Diff #59872) | Did you mean "FP and sext modifiers can't be set simultaneously..."? If yes, then Ok. |
lib/Target/AMDGPU/SIDefines.h | ||
86 ↗ | (On Diff #59872) | Please comment that in the code. |