================
@@ -14585,11 +14585,18 @@ void Sema::CheckAddressOfPackedMember(Expr *rhs) {
                      _2, _3, _4));
 }
 
+static ExprResult UsualUnaryConversionsNoPromoteInt(Sema &S, Expr *E) {
+  // Don't promote integer types
+  if (QualType Ty = E->getType(); 
S.getASTContext().isPromotableIntegerType(Ty))
+    return S.DefaultFunctionArrayLvalueConversion(E);
+  return S.UsualUnaryConversions(E);
----------------
frasercrmck wrote:

Yep, makes sense. I've added `Sema::UsualUnaryFPConversions` and am using that 
where appropriate. I didn't want to fold in the use of 
`DefaultFunctionArrayLvalueConversion`  into that even though that would have 
saved a bit of duplicated code.

Regarding bitfields: with the current version of this patch (i.e., without the 
implicit promotion) we are calling the builtin according to the type you 
specify in the bitfield:

``` c
struct StructWithBitfield {
  int i : 4;
  char c: 4;
  short s : 4;
};
```

`__builtin_elementwise_abs(s.i)` calls `llvm.abs.i32`, `s.c` calls 
`llvm.abs.i8`, `s.s` `llvm.abs.i16`, etc. I wonder if this is consistent enough 
behaviour to permit them?

https://github.com/llvm/llvm-project/pull/119423
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to