[clang] [clang] improve consistency with GCC vector comparison (PR #148954)

Imple Lee via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 16 07:18:11 PDT 2025


================
@@ -12901,24 +12901,24 @@ QualType Sema::GetSignedVectorType(QualType V) {
     return Context.getExtVectorType(Context.LongLongTy, VTy->getNumElements());
   }
 
-  if (TypeSize == Context.getTypeSize(Context.Int128Ty))
-    return Context.getVectorType(Context.Int128Ty, VTy->getNumElements(),
-                                 VectorKind::Generic);
-  if (TypeSize == Context.getTypeSize(Context.LongLongTy))
-    return Context.getVectorType(Context.LongLongTy, VTy->getNumElements(),
-                                 VectorKind::Generic);
-  if (TypeSize == Context.getTypeSize(Context.LongTy))
-    return Context.getVectorType(Context.LongTy, VTy->getNumElements(),
-                                 VectorKind::Generic);
   if (TypeSize == Context.getTypeSize(Context.IntTy))
     return Context.getVectorType(Context.IntTy, VTy->getNumElements(),
                                  VectorKind::Generic);
+  if (TypeSize == Context.getTypeSize(Context.SignedCharTy))
----------------
ImpleLee wrote:

There are several other inconsistencies:

1. `signed char` should be used instead of `char`
2. `int` should be prioritized over other types, so on ILP32 and LLP64, the resultant types should just be `int` instead of `long`.

Maybe it is better to just duplicate the GCC type order to ensure compatibility. 

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


More information about the cfe-commits mailing list