This patch implements __builtin_reduce_xor as specified in D111529.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Time | Test | |
---|---|---|
70 ms | x64 debian > Clang.Sema::builtins-reduction-math.c |
Event Timeline
clang/lib/Sema/SemaChecking.cpp | ||
---|---|---|
2112 | I think reduce_xor is only specified for integer types, so I think we need an extra check here? |
- Add extra type check to the vector elements.
- Add comment about type restriction.
- polish tests a little bit.
clang/lib/Sema/SemaChecking.cpp | ||
---|---|---|
2116 | nit: the element type will be restricted to int, so maybe say something like only supports vectors of integers> | |
clang/test/Sema/builtins-reduction-math.c | ||
50 | vector of integers type sounds a bit off. Not sure if that's much better, but how about dropping the type from the end? |
Improve diagnostic message.
Fix failing CI by running:
arc diff git merge-base HEAD origin --update D115231
Any reason not to handle builtin_reduce_xor + builtin_reduce_or as well in the same patch since they are very similar?
Hi, thanks for take a look at this.
Yes, you're right. The reason I split them is that I'm a beginner, so I want to send a "experimental patch" first, this will make review work a little bit easier if I mess something up. I think it's reasonable to add all similar builtins if currently nothing wrong about this one.
LGTM aside from a nit. Please wait a day or two before landing in case other reviewers have concerns they haven't had the chance to raise yet.
clang/include/clang/Sema/Sema.h | ||
---|---|---|
12773 ↗ | (On Diff #394563) | If we're going to be renaming this, we should probably drop the Sema prefix from the name. (I'd note that we have a lot of functions prefixed with Sema that should be renamed, in case anyone really wants an NFC task that should be pretty trivial.) |
Thanks for accepting this patch! I would appreciate it if someone is willing to commit this for me since I don't have commit access ;D
You can use:
Jun Zhang
jun@junz.org
It looks like the patch doesn't apply cleanly on current main. Could you rebase the patch?
- rebase to main.
- rename PrepareBuiltinReduceMathOneArg to PrepareBuiltinReduceMathOneArgCall.
I think reduce_xor is only specified for integer types, so I think we need an extra check here?