We've discovered a problem in the AVX2 gather patterns X86InstrSSE.td. According to the AVX2 manual, no two of the destination register, vector index register and mask register can be the same. The patterns in X86InstrSSE.td are missing this constraint and it's possible to generate an illegal instruction. It doesn't look like TableGen supports Constraints beyond EARLY_CLOBBER and TIED_TO. We would need to add a constraint such as "$dst != $src1, $dst != $mask, $src1 != $mask" to the current patterns to enforce the rules. Is there another mechanism to suport a constraint like this or is hacking TableGen the best way to do it? If the latter, does anyone have a sense of how difficult this would be to implement? -David
> It doesn't look like TableGen supports Constraints beyond EARLY_CLOBBER > and TIED_TO. We would need to add a constraint such as "$dst != $src1, > $dst != $mask, $src1 != $mask" to the current patterns to enforce the > rules.You can emulate such constraints via early clobbing. Just mark dst as early clobbing.> Is there another mechanism to suport a constraint like this or is > hacking TableGen the best way to do it? If the latter, does anyone have > a sense of how difficult this would be to implement?It's not a tablegen problem, the regalloc part is the hardest. -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University
>> It doesn't look like TableGen supports Constraints beyond EARLY_CLOBBER >> and TIED_TO. We would need to add a constraint such as "$dst != $src1, >> $dst != $mask, $src1 != $mask" to the current patterns to enforce the >> rules. > You can emulate such constraints via early clobbing. Just mark dst as > early clobbing.How would that (or any early clobbering) enforce $src1 != $mask? Or is it a fortuitous side-effect of implementation? Tim.
On 1/23/2013 3:33 PM, Anton Korobeynikov wrote:>> It doesn't look like TableGen supports Constraints beyond EARLY_CLOBBER >> and TIED_TO. We would need to add a constraint such as "$dst != $src1, >> $dst != $mask, $src1 != $mask" to the current patterns to enforce the >> rules. > You can emulate such constraints via early clobbing. Just mark dst as > early clobbing.How would you emulate src1 != mask via early clobbing? -Krzysztof -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Anton Korobeynikov <anton at korobeynikov.info> writes:>> It doesn't look like TableGen supports Constraints beyond EARLY_CLOBBER >> and TIED_TO. We would need to add a constraint such as "$dst != $src1, >> $dst != $mask, $src1 != $mask" to the current patterns to enforce the >> rules.> You can emulate such constraints via early clobbing. Just mark dst as > early clobbing.Actually, I've always wondered what early clobbering is. Can you explain it? I don't think that it will work for the src1 != mask constraint, though, right?>> Is there another mechanism to suport a constraint like this or is >> hacking TableGen the best way to do it? If the latter, does anyone have >> a sense of how difficult this would be to implement?> It's not a tablegen problem, the regalloc part is the hardest.Sure, but we'll want to express the constraint in TableGen, I think. Any hints on a direction for regalloc? How are such constraints modeled in the current iteration of the register allocator? Thanks! -David