This is an archive of the discontinued LLVM Phabricator instance.

[X86] Remove AVX/AVX512 check from validateOperandSize, just always accept 512
AbandonedPublic

Authored by craig.topper on Sep 30 2019, 5:50 PM.

Details

Summary

The AVX/AVX512 check were based on the command line features. But the function may have a target attribute that gives more features than the command line. We shouldn't fail for 512 operand if the command line doesn't support it, but the target attribute does. gcc supports this.

I don't know how to get to the target attribute here, or if we even can without creating a layering issue. So I've just removed the check entirely and always allow 512 bits. In some simple testing, the backend seems to produce an error like "couldn't allocate output register for constraint 'x'" when the type is larger than supported by the subtarget features. So I think we can handle this gracefully without crashing.

Diff Detail

Event Timeline

craig.topper created this revision.Sep 30 2019, 5:50 PM
rnk added subscribers: ahatanak, void.Oct 3 2019, 1:32 PM

I notice that x86 is the only target for which validateInput/OutputSize are implemented. If you are going to disable these checks, perhaps we should get rid of these methods and leave all these errors to the backend? You could add -S to the x86_32-inline-asm.c test and turn it into an integration test that shows that we no longer crash. It would need REQUIRES: x86-registered-target if you do that.

Adding @void and @ahatanak, who added these long ago.

clang/lib/Basic/Targets/X86.cpp
1768

I think the same issues apply to this SSELevel check. I suspect no one complains about these checks because everyone enables SSE2 in one way or another.

The idea was that we'd have a much more graceful error message as well as a way for the front end to do the diagnosis. The code is being called out of SemaStmtAsm.cpp and I'm pretty sure we can probably accumulate the target attributes there?

-eric

New patch to factor in the target attribute D68627

craig.topper abandoned this revision.Dec 6 2019, 10:04 AM