llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

AVX512: We don't always need EVEX for VEX-encodable instructions.

Open ahmedbougacha opened this issue 11 years ago • 5 comments

Bugzilla Link 23376
Resolution FIXED
Resolved on Feb 22, 2017 18:55
Version trunk
OS All
CC @ahmedbougacha,@delena

Extended Description

This:

define float @​t(float %a, float %b) { %res = fadd float %a, %b ret float %res }

Generates the EVEX-prefixed:

62f17e0858c1    	vaddss	%xmm1, %xmm0, %xmm0

instead of using VEX:

c5fa58c1        	vaddss	%xmm1, %xmm0, %xmm0

AFAIK, there is no transition penalty between AVX512 and AVX, so I believe the only reason to use EVEX in this case is to access more registers (xmm0-31).

That's not always useful, so we should recognize that, and relax EVEX->VEX when possible.

ahmedbougacha avatar Apr 30 '15 03:04 ahmedbougacha

Apologies; I should have searched more before replying. Appears https://reviews.llvm.org/D28221 is the actual issue. Again, sorry for wasting time here.

llvmbot avatar Feb 23 '17 02:02 llvmbot

(Sorry this is against llvm 3.9.1)

llvmbot avatar Feb 23 '17 02:02 llvmbot

Could this issue explain the following problem I'm seeing. On a i7-6600U (skylake) box using llvm directly , I get some EVEX encoded instructions even though the i7-6600U doesn't support AVX512 leading to a SIGILL. Or is that a separate issue I should file?

Thanks, Matt

llvmbot avatar Feb 23 '17 02:02 llvmbot

The bug was fixed in a patch to X86 AVX512 on LLVM revision 290649. Changed date is 2016-12-28.

llvmbot avatar Jan 02 '17 14:01 llvmbot

I agree, it may be a pass after register allocation, that will take EXEX instructions with xmm/ymm 0-15 and replace them with appropriate VEX instrcutions.

delena avatar Apr 30 '15 09:04 delena