[clang] [clang][AArch64] Fix C++11 style initialization of typedef'd vectors (PR #118956)

Paul Walker via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 6 06:17:01 PST 2024


================
@@ -0,0 +1,23 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 2
+// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64-none-linux-gnu -target-feature +sve -emit-llvm -o - %s | FileCheck %s
+
+#include <arm_sve.h>
+
+using vec_t = svint8_t;
+
+/// From: https://github.com/llvm/llvm-project/issues/107609
+/// The type of `vec` is a typedef of svint8_t, while svdup_s8 returns the non-typedef'd type.
+
+// CHECK-LABEL: define dso_local <vscale x 16 x i8> @_Z20sve_init_dup_typedefv
+// CHECK-SAME: () #[[ATTR0:[0-9]+]] {
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:    [[VEC:%.*]] = alloca <vscale x 16 x i8>, align 16
+// CHECK-NEXT:    [[TMP0:%.*]] = call <vscale x 16 x i8> @llvm.aarch64.sve.dup.x.nxv16i8(i8 2)
+// CHECK-NEXT:    store <vscale x 16 x i8> [[TMP0]], ptr [[VEC]], align 16
+// CHECK-NEXT:    [[TMP1:%.*]] = load <vscale x 16 x i8>, ptr [[VEC]], align 16
+// CHECK-NEXT:    ret <vscale x 16 x i8> [[TMP1]]
+//
+vec_t sve_init_dup_typedef() {
+  vec_t vec{svdup_s8(2)};
+  return vec;
+}
----------------
paulwalker-arm wrote:

Not sure if you misread my comment or perhaps my proposed test does not work? My rational for suggesting a different test is that mine doesn't require arm_sve.h nor any builtin functions.

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


More information about the cfe-commits mailing list