[cfe-dev] [libc++abi] demangle fails to handle SSE2 types

Howard Hinnant hhinnant at apple.com
Wed May 23 08:47:51 PDT 2012


On May 23, 2012, at 11:12 AM, Luc Bourhis wrote:

> 
> On 23 May 2012, at 16:01, Howard Hinnant wrote:
> 
>> It does include a mangling for vendor extended types, and it is a shame that the ABI hasn't been followed for these types (prefix with 'u'), but oh well.
> 
> For the record, g++ follows that ABI. The demangling is unfortunately not symmetric, at least for g++ 4.6:
> 
> Type: __m64
> Mangled: U8__vectori
> Demangled: int __vector
> 
> Type: __m128
> Mangled: U8__vectorf
> Demangled: float __vector
> 
> Type: __m128d
> Mangled: U8__vectord
> Demangled: double __vector
> 
> Type: __m128i
> Mangled: U8__vectorx
> Demangled: long long __vector

Ironically libc++abi can demangle these.

> 
> I mention that because it can become annoying in the context of C++ programs generating C++ code (an exercise I indulge into on a regular basis): it would be nice if clang/libc++abi keeps it symmetric.
> 
>> If you'll tell me what string you would like to see these symbols demangle to, I'll put it on my to-do list.
> 
> Thanks! Here you are:
> 
> Type: __m64
> Mangled: Dv1_x
> 
> Type: __m128
> Mangled: Dv4_f
> 
> Type: __m128d
> Mangled: Dv2_d
> 
> Type: __m128i
> Mangled: Dv2_x
> 
> Type: __m256
> Mangled: Dv8_f
> 
> Type: __m256d
> Mangled: Dv4_d
> 
> Type: __m256i
> Mangled: Dv4_x
> 
> The last 3 types are actually AVX types, a technology only available on Sandy Bridge platforms, and I had to run clang on a Linux machine because I don't have access to a Mac with those processors, but it should not matter as far as you are concerned. 

Do you wish the demangled strings to be the same as the type name?  Or do you wish to follow the g++ 4.6 convention?  My recommendation is to have the demangled name be the same as what you would write in source code, which appears to be what you have labeled "Type:".

Howard




More information about the cfe-dev mailing list