Skip to content

Error when using GFNI without AVX512BW #58687

Closed
@calebzulawski

Description

@calebzulawski

According to the Intel Software Developer's Manual, GFNI instructions on 512-bit vectors only require GFNI + AVX512F. Without AVX512BW, however, LLVM errors:

godbolt

declare <64 x i8> @llvm.x86.vgf2p8mulb.512(<64 x i8>, <64 x i8>)

define <64 x i8> @foo(<64 x i8>, <64 x i8>) local_unnamed_addr #0 {
    %3 = call <64 x i8> @llvm.x86.vgf2p8mulb.512(<64 x i8> %0, <64 x i8> %1)
    ret <64 x i8> %3
}
attributes #0 = { "target-features"="+gfni,+avx512f" }
LLVM ERROR: Cannot select: 0x55a198567b00: v64i8 = X86ISD::GF2P8MULB 0x55a198567710, 0x55a1985677f0
  0x55a198567710: v64i8,ch = CopyFromReg 0x55a1984e5698, Register:v64i8 %0
    0x55a1985676a0: v64i8 = Register %0
  0x55a1985677f0: v64i8,ch = CopyFromReg 0x55a1984e5698, Register:v64i8 %1
    0x55a198567780: v64i8 = Register %1
In function: foo
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: /opt/compiler-explorer/clang-trunk/bin/llc -o /app/output.s -x86-asm-syntax=intel <source>
1.	Running pass 'Function Pass Manager' on module '<source>'.
2.	Running pass 'X86 DAG->DAG Instruction Selection' on function '@foo'
 #0 0x000055a192e12034 PrintStackTraceSignalHandler(void*) Signals.cpp:0:0
 #1 0x000055a192e0f8b4 SignalHandler(int) Signals.cpp:0:0
 #2 0x00007f418b895420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #3 0x00007f418b36200b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
 #4 0x00007f418b341859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
 #5 0x000055a1904ccd9d llvm::DisplayGraph(llvm::StringRef, bool, llvm::GraphProgram::Name) (.cold) GraphWriter.cpp:0:0
 #6 0x000055a192be1130 llvm::SelectionDAGISel::CannotYetSelect(llvm::SDNode*) (/opt/compiler-explorer/clang-trunk/bin/llc+0x3019130)
 #7 0x000055a192be70a2 llvm::SelectionDAGISel::SelectCodeCommon(llvm::SDNode*, unsigned char const*, unsigned int) (/opt/compiler-explorer/clang-trunk/bin/llc+0x301f0a2)
 #8 0x000055a1916ef042 (anonymous namespace)::X86DAGToDAGISel::Select(llvm::SDNode*) X86ISelDAGToDAG.cpp:0:0
 #9 0x000055a192bdefc7 llvm::SelectionDAGISel::DoInstructionSelection() (/opt/compiler-explorer/clang-trunk/bin/llc+0x3016fc7)
#10 0x000055a192beb479 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/opt/compiler-explorer/clang-trunk/bin/llc+0x3023479)
#11 0x000055a192bee141 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x3026141)
#12 0x000055a192bf0a9f llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (.part.0) SelectionDAGISel.cpp:0:0
#13 0x000055a1916f90c5 (anonymous namespace)::X86DAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&) X86ISelDAGToDAG.cpp:0:0
#14 0x000055a1920d75c0 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#15 0x000055a19257e6b0 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x29b66b0)
#16 0x000055a19257e829 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x29b6829)
#17 0x000055a19257f410 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x29b7410)
#18 0x000055a1905a1d0b compileModule(char**, llvm::LLVMContext&) llc.cpp:0:0
#19 0x000055a1904db832 main (/opt/compiler-explorer/clang-trunk/bin/llc+0x913832)
#20 0x00007f418b343083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#21 0x000055a190599c2e _start (/opt/compiler-explorer/clang-trunk/bin/llc+0x9d1c2e)
Compiler returned: 139

I didn't check all instructions, but VPCLMULQDQ and VAES have similar CPUID tiers and may have similar issues.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions