[llvm-bugs] [Bug 28839] New: AVX512: Register allocator doesn't understand mask registers
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Aug 4 05:41:47 PDT 2016
https://llvm.org/bugs/show_bug.cgi?id=28839
Bug ID: 28839
Summary: AVX512: Register allocator doesn't understand mask
registers
Product: libraries
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: Backend: X86
Assignee: unassignedbugs at nondot.org
Reporter: wenzel.jakob at epfl.ch
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
The LLVM register allocator fails to effectively deal with mask registers and
sometimes generates bizarre sequences of moves from mask to integer registers
(and back!).
Consider the following code fragment compiled with the HEAD revision of
LLVM/Clang:
#include <immintrin.h>
__mmask16 combine(__m512 a, __m512 b, __m512 c, __m512 d, __m512 x) {
__mmask16 m1 = _mm512_cmp_ps_mask(a, x, _CMP_GE_OS);
__mmask16 m2 = _mm512_cmp_ps_mask(b, x, _CMP_GE_OS);
__mmask16 m3 = _mm512_cmp_ps_mask(c, x, _CMP_GE_OS);
__mmask16 m4 = _mm512_cmp_ps_mask(d, x, _CMP_GE_OS);
return _mm512_kor(_mm512_kor(m1, m2), _mm512_kor(m3, m4));
}
This is what I get (clang++ -mavx512f test.cpp -o test.s -O3 -S
-fomit-frame-pointer):
__Z7combineDv16_fS_S_S_S_: ## @_Z7combineDv16_fS_S_S_S_
vcmpgeps %zmm4, %zmm0, %k0
kmovw %k0, %eax
vcmpgeps %zmm4, %zmm1, %k0
kmovw %k0, %ecx
vcmpgeps %zmm4, %zmm2, %k0
kmovw %k0, %edx
vcmpgeps %zmm4, %zmm3, %k0
kmovw %k0, %esi
kmovw %ecx, %k0
kmovw %eax, %k1
korw %k0, %k1, %k0
kmovw %esi, %k1
kmovw %edx, %k2
korw %k1, %k2, %k1
korw %k1, %k0, %k0
kmovw %k0, %eax
movzwl %ax, %eax
retq
Note all the unnecessary 'kmov' instructions, and that vcmpgeps only seems to
be able to put its output into the 'k0' register.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160804/f229add2/attachment-0001.html>
More information about the llvm-bugs
mailing list