[SM6.9] Lower vector any/all calls to vector op#7753
Conversation
|
✅ With the latest revision this PR passed the Python code formatter. |
damyanp
left a comment
There was a problem hiding this comment.
LGTM, but should aim for approval from someone more experienced than me.
hekota
left a comment
There was a problem hiding this comment.
Few comments, plus the scalarization using just and needs to be updated.
| bool NeedsConvertToInt = EltTy->isFloatingPointTy(); | ||
| for (unsigned I = 0; I < Ty->getVectorNumElements(); I++) { | ||
| Value *Elt = Builder.CreateExtractElement(Arg, I); | ||
| if (NeedsConvertToInt) | ||
| Elt = GenerateCmpNEZero(Elt, Builder); |
There was a problem hiding this comment.
| bool NeedsConvertToInt = EltTy->isFloatingPointTy(); | |
| for (unsigned I = 0; I < Ty->getVectorNumElements(); I++) { | |
| Value *Elt = Builder.CreateExtractElement(Arg, I); | |
| if (NeedsConvertToInt) | |
| Elt = GenerateCmpNEZero(Elt, Builder); | |
| bool NeedsConvertToBool = EltTy->isFloatingPointTy(); | |
| for (unsigned I = 0; I < Ty->getVectorNumElements(); I++) { | |
| Value *Elt = Builder.CreateExtractElement(Arg, I); | |
| if (NeedsConvertToBool) | |
| Elt = GenerateCmpNEZero(Elt, Builder); |
Please rename, this is not really converting float value to integer ;)
There was a problem hiding this comment.
ack for the future! This actually goes away entirely with the latest commit!
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
Co-authored-by: Helena Kotas <hekotas@microsoft.com>
|
The operations are declared as "Bitwise AND/OR reduction of the vector returning a scalar", but in reality, we only ever call it with a bool vector, right? I am not sure if that's a problem or not. |
With the currently lowering, yes. It's only every called with an i1 vec. But there isn't a reason to add that restriction. For example, it might be nice to add an intrinsic to hlsl for "unary vector and" and "unary vector or" in the future but restricting the opcode would prevent that |
Fixes #7687
Implement vector reduction lowing for calls to
anyandall