BUILD_VECTORtoBlendMask never updates second part of returned MaskValue and so it is always all 1s without the notion about the actual value of Lane2Cond.
This patch attempts to fix it; It breaks test/CodeGen/X86/vector-blend.ll, but the testcase itself checks for the incorrect code
Details
Diff Detail
Event Timeline
Hi Alexander,
It seems like you're on track to solving the bug, but there's some details that I find weird.
Please also:
1 - Fix the test-case that's wrong
2 - Add a test-case
Adding Chandler, just to be sure there's no minute detail we might be forgetting (or for him to tell me the "undef" problem I mentioned is not a problem).
lib/Target/X86/X86ISelLowering.cpp | ||
---|---|---|
11105 | It looks like the -1 serves as an "undef". In that case, you seem to be bailing out too early. I also prefer the comment above in the place where it was. It explains why the loop loops on NumElemsInLane, and not NumElems. |
I agree with Filipe.
Alexander, if you don't mind, I'll upload a fixed patch myself, this should be fairly simple.
Posted new patch as D13505.
Note that there are actually two distinct bugs in this code...
It looks like the -1 serves as an "undef". In that case, you seem to be bailing out too early.
If Lane1Cond is 1, and Lane2Cond is undef, then we can just do what Lane1Cond says (same for when Lane1Cond is undef, but Lane2Cond is not).
I also prefer the comment above in the place where it was. It explains why the loop loops on NumElemsInLane, and not NumElems.