[clang] [llvm] [Clang][AMDGPU] Add __builtin_amdgcn_cvt_off_f32_i4 (PR #133741)

Shilei Tian via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 2 07:08:59 PDT 2025


Juan Manuel Martinez =?utf-8?q?Caamaño?= <juamarti at amd.com>,
Juan Manuel Martinez =?utf-8?q?Caamaño?= <juamarti at amd.com>,
Juan Manuel Martinez =?utf-8?q?Caamaño?= <juamarti at amd.com>,
Juan Manuel Martinez =?utf-8?q?Caamaño?= <juamarti at amd.com>,
Juan Manuel Martinez =?utf-8?q?Caamaño?= <juamarti at amd.com>,
Juan Manuel Martinez =?utf-8?q?Caamaño?= <juamarti at amd.com>,
Juan Manuel Martinez =?utf-8?q?Caamaño?= <juamarti at amd.com>,
Juan Manuel Martinez =?utf-8?q?Caamaño?= <juamarti at amd.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/133741 at github.com>


================
@@ -743,9 +743,13 @@ GCNTTIImpl::instCombineIntrinsic(InstCombiner &IC, IntrinsicInst &II) const {
     if (!CArg)
       break;
 
-    int CArg4BitAsInt = CArg->getValue().trunc(4).getSExtValue();
-    float ResVal = 0.0625 * CArg4BitAsInt;
-    Constant *Res = ConstantFP::get(II.getType(), ResVal);
+    // Tabulated 0.0625 * (sext (CArg & 0xf)).
+    constexpr size_t ResValsSize = 16;
+    const float ResVals[ResValsSize] = {
----------------
shiltian wrote:

or even `constexpr`?

https://github.com/llvm/llvm-project/pull/133741


More information about the llvm-commits mailing list