fhahn marked an inline comment as done. fhahn added inline comments.
================ Comment at: clang/lib/Sema/SemaChecking.cpp:16547 + Expr *A = TheCall->getArg(0); + QualType TyA = A->getType(); + ---------------- aaron.ballman wrote: > fhahn wrote: > > aaron.ballman wrote: > > > Should this type undergo the usual promotions? > > I'm not sure, but given that we only have a single argument then wouldn't > > it be sufficient to avoid promotion? I don't think promotion to wider types > > would impact the results of the provided builtins. > You set the type of the call to be the type of the argument, which means > passing in a `const int` will result in a `const int` that's observable and > probably unexpected. e.g. this will fail, > ``` > const int a = -12; > static_assert(!std::is_const_v<decltype(__builtin_elementwise_abs(a))>); > ``` > (This can come up with overload resolution or in template specializations.) Ah right. I originally was planning on just using `getUnqualifiedType`, but for consistency it seems better to just apply the usual unary conversions. I also added the test above and a codegen tests with `short`. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D111986/new/ https://reviews.llvm.org/D111986 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits