From c04c66d705b4f6e95a6325ef6d6c647ebc622165 Mon Sep 17 00:00:00 2001 From: Hsiangkai Wang Date: Fri, 7 May 2021 15:18:11 +0800 Subject: [PATCH] [RISCV] Consider scalar types for required extensions. We have vector operations on double vector and float scalar. For example, vfwadd.wf is such a instruction. vfloat64m1_t vfwadd_wf(vfloat64m1_t op0, float op1, size_t op2); We should specify F and D extensions for it. Differential Revision: https://reviews.llvm.org/D102051 --- clang/utils/TableGen/RISCVVEmitter.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/clang/utils/TableGen/RISCVVEmitter.cpp b/clang/utils/TableGen/RISCVVEmitter.cpp index 423e547..467a8b2 100644 --- a/clang/utils/TableGen/RISCVVEmitter.cpp +++ b/clang/utils/TableGen/RISCVVEmitter.cpp @@ -107,6 +107,9 @@ public: bool isFloatVector(unsigned Width) const { return isVector() && isFloat() && ElementBitwidth == Width; } + bool isFloat(unsigned Width) const { + return isFloat() && ElementBitwidth == Width; + } private: // Verify RVV vector type and set Valid. @@ -765,11 +768,11 @@ RVVIntrinsic::RVVIntrinsic(StringRef NewName, StringRef Suffix, } // Init RISC-V extensions for (const auto &T : OutInTypes) { - if (T->isFloatVector(16)) + if (T->isFloatVector(16) || T->isFloat(16)) RISCVExtensions |= RISCVExtension::Zfh; - else if (T->isFloatVector(32)) + else if (T->isFloatVector(32) || T->isFloat(32)) RISCVExtensions |= RISCVExtension::F; - else if (T->isFloatVector(64)) + else if (T->isFloatVector(64) || T->isFloat(64)) RISCVExtensions |= RISCVExtension::D; } if (RequiredExtension == "Zvamo") -- 2.7.4