[llvm] [AMDGPU] Add v2bf16 for opsel immediate folding (PR #82435)

Stanislav Mekhanoshin via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 20 14:43:15 PST 2024


https://github.com/rampitec created https://github.com/llvm/llvm-project/pull/82435

This was previously enabled since v2bf16 was represented by v2f16. As of now it is NFC since we only have dot instructions which could use it, but currently folding is guarded by the hasDOTOpSelHazard().

>From 499da18b99f468b9fd814ec596d039f60e502496 Mon Sep 17 00:00:00 2001
From: Stanislav Mekhanoshin <Stanislav.Mekhanoshin at amd.com>
Date: Tue, 20 Feb 2024 14:37:23 -0800
Subject: [PATCH] [AMDGPU] Add v2bf16 for opsel immediate folding

This was previously enabled since v2bf16 was represented by v2f16.
As of now it is NFC since we only have dot instructions which could
use it, but currently folding is guarded by the hasDOTOpSelHazard().
---
 llvm/lib/Target/AMDGPU/SIFoldOperands.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/llvm/lib/Target/AMDGPU/SIFoldOperands.cpp b/llvm/lib/Target/AMDGPU/SIFoldOperands.cpp
index 8bf05682cbe7ea..d16d8ebd41a54f 100644
--- a/llvm/lib/Target/AMDGPU/SIFoldOperands.cpp
+++ b/llvm/lib/Target/AMDGPU/SIFoldOperands.cpp
@@ -219,8 +219,10 @@ bool SIFoldOperands::canUseImmWithOpSel(FoldCandidate &Fold) const {
   default:
     return false;
   case AMDGPU::OPERAND_REG_IMM_V2FP16:
+  case AMDGPU::OPERAND_REG_IMM_V2BF16:
   case AMDGPU::OPERAND_REG_IMM_V2INT16:
   case AMDGPU::OPERAND_REG_INLINE_C_V2FP16:
+  case AMDGPU::OPERAND_REG_INLINE_C_V2BF16:
   case AMDGPU::OPERAND_REG_INLINE_C_V2INT16:
     break;
   }



More information about the llvm-commits mailing list