summaryrefslogtreecommitdiff
path: root/clang/utils
diff options
context:
space:
mode:
authoreopXD <yueh.ting.chen@gmail.com>2023-02-09 08:12:02 -0800
committereopXD <yueh.ting.chen@gmail.com>2023-02-13 18:07:00 -0800
commit235e90c1d760ea38f2af6bf4de2cc9355b89d24c (patch)
tree7133dee650c6ac07c74e695ba8070656955db391 /clang/utils
parent4b815d8443db4d041625f022cd26294080e929e6 (diff)
downloadllvm-235e90c1d760ea38f2af6bf4de2cc9355b89d24c.tar.gz
[Clang][RISCV] Guard vector float16 type correctly with semantic analysis
Before this commit, vector float 16 types (e.g. `vfloat16m1_t`) of RVV is only defined when extension `zvfh` is defined. However this generate inaccurate diagnostics like: ``` error: unknown type name 'vfloat16m1_t' ``` This commit improves the compiler by guarding type check correctly under semantic analysis. Reviewed By: craig.topper Differential Revision: https://reviews.llvm.org/D143657
Diffstat (limited to 'clang/utils')
-rw-r--r--clang/utils/TableGen/RISCVVEmitter.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/clang/utils/TableGen/RISCVVEmitter.cpp b/clang/utils/TableGen/RISCVVEmitter.cpp
index 6926bbdf8d0f..2ff352ff128d 100644
--- a/clang/utils/TableGen/RISCVVEmitter.cpp
+++ b/clang/utils/TableGen/RISCVVEmitter.cpp
@@ -368,14 +368,13 @@ void RVVEmitter::createHeader(raw_ostream &OS) {
}
}
}
- OS << "#if defined(__riscv_zvfh)\n";
+
for (int Log2LMUL : Log2LMULs) {
auto T = TypeCache.computeType(BasicType::Float16, Log2LMUL,
PrototypeDescriptor::Vector);
if (T)
printType(*T);
}
- OS << "#endif\n";
OS << "#if (__riscv_v_elen_fp >= 32)\n";
for (int Log2LMUL : Log2LMULs) {