[clang] [Clang][AArch64] Add fix vector types to header into SVE (PR #73258)

Kiran Chandramohan via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 4 03:15:06 PST 2023


================
@@ -2546,6 +2555,53 @@ void NeonEmitter::runFP16(raw_ostream &OS) {
   OS << "#endif /* __ARM_FP16_H */\n";
 }
 
+void NeonEmitter::runVectorType(raw_ostream &OS) {
+  OS << "/*===---- arm_vector_types - ARM vector type "
+        "------===\n"
+        " *\n"
+        " *\n"
+        " * Part of the LLVM Project, under the Apache License v2.0 with LLVM "
+        "Exceptions.\n"
+        " * See https://llvm.org/LICENSE.txt for license information.\n"
+        " * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception\n"
+        " *\n"
+        " *===-----------------------------------------------------------------"
+        "------===\n"
+        " */\n\n";
+  OS << "#ifndef __ARM_NEON_H\n\n";
+  OS << "#ifndef __ARM_NEON_TYPES_H\n";
+  OS << "#define __ARM_NEON_TYPES_H\n";
+  OS << "#ifdef __aarch64__\n";
+  OS << "typedef uint8_t poly8_t;\n";
+  OS << "typedef uint16_t poly16_t;\n";
+  OS << "typedef uint64_t poly64_t;\n";
+  OS << "typedef __uint128_t poly128_t;\n";
+  OS << "#else\n";
+  OS << "typedef int8_t poly8_t;\n";
+  OS << "typedef int16_t poly16_t;\n";
+  OS << "#endif\n";
+
+  // Needs to declare all the types in case there is arm_sve.h followed by
+  // arm_neon.h.
+  // arm_sve defines __ARM_NEON_TYPES_H so it avoids to declare again the
+  // types in arm_neon.h
----------------
kiranchandramohan wrote:

Consider revising this to say what is being done here and then provide the reason.

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


More information about the cfe-commits mailing list