[PATCH] D39575: [X86] Add subtarget features prefer-avx256 and prefer-avx128 and use them to limit vector width presented by TTI

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 3 10:30:46 PDT 2017


craig.topper added inline comments.


================
Comment at: lib/Target/X86/X86Subtarget.h:64
+  enum X86PreferVecWidthEnum {
+    // NOTE: Strictest constraint must have highest encoding.
+    PreferAny, Prefer256, Prefer128
----------------
DavidKreitzer wrote:
> It might be worth expanding upon this a bit to make is clear why Prefer128 is "stricter" than Prefer256.
> 
> I have no objection to this choice of ordering, but it does make the code at lines 535-539 read a little funny.
It's not really a choice, the tablegen generated code only knows how to handle boolean features and features that represent a level. (like the SSElevel). For the level case it always does a max. This way if a CPU specifies a particular SSE level and the command line specifies a higher one the command line will be able to override it.

Though in those cases we make the higher SSE level imply the lower ones so if you say no sse2 we disable all the sse levels 2 and above. I didn't do that here. So I'm not sure what would happen for the vector levels.

I think I need to rethink this a bit.


https://reviews.llvm.org/D39575





More information about the llvm-commits mailing list