From 5da3c08728d3d1091f4f3fa01f9d813a45d150f5 Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Thu, 14 Apr 2011 20:33:36 +0000 Subject: [PATCH] Match pointer of compatible vection types. // rdar://9208404 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129536 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/SemaOverload.cpp | 8 ++++++++ test/SemaCXX/neon-vector-types.cpp | 27 +++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 test/SemaCXX/neon-vector-types.cpp diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp index ac2ba1a992..25e25a2139 100644 --- a/lib/Sema/SemaOverload.cpp +++ b/lib/Sema/SemaOverload.cpp @@ -1661,6 +1661,14 @@ bool Sema::IsPointerConversion(Expr *From, QualType FromType, QualType ToType, return true; } + if (FromPointeeType->isVectorType() && ToPointeeType->isVectorType() && + Context.areCompatibleVectorTypes(FromPointeeType, ToPointeeType)) { + ConvertedType = BuildSimilarlyQualifiedPointerType(FromTypePtr, + ToPointeeType, + ToType, Context); + return true; + } + return false; } diff --git a/test/SemaCXX/neon-vector-types.cpp b/test/SemaCXX/neon-vector-types.cpp new file mode 100644 index 0000000000..aa82b11e8c --- /dev/null +++ b/test/SemaCXX/neon-vector-types.cpp @@ -0,0 +1,27 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +// rdar://9208404 + +typedef int MP4Err; +typedef float Float32; +typedef float float32_t; +typedef __attribute__((neon_vector_type(4))) float32_t float32x4_t; +typedef float vFloat __attribute__((__vector_size__(16))); +typedef vFloat VFLOAT; +typedef unsigned long UInt32; + +extern int bar (float32x4_t const *p); + +int foo (const Float32 *realBufPtr) { + float32x4_t const *vRealPtr = (VFLOAT *)&realBufPtr[0]; + return bar(vRealPtr); +} + +MP4Err autoCorrelation2nd_Neon(Float32 *alphar, Float32 *alphai, + const Float32 *realBufPtr, + const Float32 *imagBufPtr, + const UInt32 len) +{ + float32x4_t const *vRealPtr = (VFLOAT *)&realBufPtr[0]; + return 0; +} + -- 2.50.1