[clang] c04c66d - [RISCV] Consider scalar types for required extensions.
Hsiangkai Wang via cfe-commits
cfe-commits at lists.llvm.org
Fri May 7 13:08:04 PDT 2021
Author: Hsiangkai Wang
Date: 2021-05-08T04:06:45+08:00
New Revision: c04c66d705b4f6e95a6325ef6d6c647ebc622165
URL: https://github.com/llvm/llvm-project/commit/c04c66d705b4f6e95a6325ef6d6c647ebc622165
DIFF: https://github.com/llvm/llvm-project/commit/c04c66d705b4f6e95a6325ef6d6c647ebc622165.diff
LOG: [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
Added:
Modified:
clang/utils/TableGen/RISCVVEmitter.cpp
Removed:
################################################################################
diff --git a/clang/utils/TableGen/RISCVVEmitter.cpp b/clang/utils/TableGen/RISCVVEmitter.cpp
index 423e5477fbbae..467a8b2f52ac6 100644
--- a/clang/utils/TableGen/RISCVVEmitter.cpp
+++ b/clang/utils/TableGen/RISCVVEmitter.cpp
@@ -107,6 +107,9 @@ class RVVType {
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")
More information about the cfe-commits
mailing list