From 9efa4cdb5169ef77e6250473574980e7438fcf42 Mon Sep 17 00:00:00 2001 From: eopXD Date: Sun, 28 May 2023 01:29:36 -0700 Subject: [PATCH] [Clang][RISCV] Reduce boilerplate under RVVEmitter::createHeader. NFC Signed-off by: eop Chen --- clang/utils/TableGen/RISCVVEmitter.cpp | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/clang/utils/TableGen/RISCVVEmitter.cpp b/clang/utils/TableGen/RISCVVEmitter.cpp index c9f454a..35b2203 100644 --- a/clang/utils/TableGen/RISCVVEmitter.cpp +++ b/clang/utils/TableGen/RISCVVEmitter.cpp @@ -377,25 +377,13 @@ void RVVEmitter::createHeader(raw_ostream &OS) { } } - for (int Log2LMUL : Log2LMULs) { - auto T = TypeCache.computeType(BasicType::Float16, Log2LMUL, - PrototypeDescriptor::Vector); - if (T) - printType(*T); - } - - for (int Log2LMUL : Log2LMULs) { - auto T = TypeCache.computeType(BasicType::Float32, Log2LMUL, - PrototypeDescriptor::Vector); - if (T) - printType(*T); - } - - for (int Log2LMUL : Log2LMULs) { - auto T = TypeCache.computeType(BasicType::Float64, Log2LMUL, - PrototypeDescriptor::Vector); - if (T) - printType(*T); + for (BasicType BT : + {BasicType::Float16, BasicType::Float32, BasicType::Float64}) { + for (int Log2LMUL : Log2LMULs) { + auto T = TypeCache.computeType(BT, Log2LMUL, PrototypeDescriptor::Vector); + if (T) + printType(*T); + } } OS << "#define __riscv_v_intrinsic_overloading 1\n"; -- 2.7.4