[llvm] [AMDGPU][MC] Implement fft and rotate modes for ds_swizzle_b32 (PR #108064)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 11 23:50:08 PDT 2024
================
@@ -8141,6 +8143,54 @@ AMDGPUAsmParser::parseSwizzleBitmaskPerm(int64_t &Imm) {
return true;
}
+bool AMDGPUAsmParser::parseSwizzleFFT(int64_t &Imm) {
+ using namespace llvm::AMDGPU::Swizzle;
+
+ if (!AMDGPU::isGFX9Plus(getSTI())) {
+ Error(getLoc(), "FFT mode swizzle not supported on this GPU");
+ return false;
+ }
+
+ int64_t Swizzle;
+ SMLoc Loc;
+ if (!parseSwizzleOperand(Swizzle, 0, FFT_SWIZZLE_MAX,
+ "FFT swizzle must be in the interval [0," +
+ Twine(FFT_SWIZZLE_MAX).str() + Twine(']').str(),
+ Loc))
+ return false;
+
+ Imm = FFT_MODE_ENC | Swizzle;
+ return true;
+}
+
+bool AMDGPUAsmParser::parseSwizzleRotate(int64_t &Imm) {
+ using namespace llvm::AMDGPU::Swizzle;
+
+ if (!AMDGPU::isGFX9Plus(getSTI())) {
+ Error(getLoc(), "Rotate mode swizzle not supported on this GPU");
+ return false;
+ }
+
+ SMLoc Loc;
+ int64_t Direction;
+
+ if (!parseSwizzleOperand(Direction, 0, 1,
+ "direction must be 0 (left) or 1 (right)", Loc))
+ return false;
+
+ int64_t RotateSize;
+ if (!parseSwizzleOperand(
+ RotateSize, 0, ROTATE_MAX_SIZE,
+ "number of threads to rotate must be in the interval [0," +
+ Twine(ROTATE_MAX_SIZE).str() + Twine(']').str(),
----------------
arsenm wrote:
Same
https://github.com/llvm/llvm-project/pull/108064
More information about the llvm-commits
mailing list