Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions llvm/lib/Target/X86/X86CompressEVEX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,11 @@ static bool CompressEVEXImpl(MachineInstr &MI, const X86Subtarget &ST) {
//
// For AVX512 cases, EVEX prefix is needed in order to carry this information
// thus preventing the transformation to VEX encoding.
bool IsND = X86II::hasNewDataDest(TSFlags);
if (TSFlags & X86II::EVEX_B)
// MOVBE*rr is special because it has sematic of NDD but not set EVEX_B.
bool IsMovberr =
MI.getOpcode() == X86::MOVBE32rr || MI.getOpcode() == X86::MOVBE64rr;
bool IsND = X86II::hasNewDataDest(TSFlags) || IsMovberr;
if (TSFlags & X86II::EVEX_B || IsMovberr)
if (!IsND || !isRedundantNewDataDest(MI, ST))
return false;

Expand Down
10 changes: 10 additions & 0 deletions llvm/test/CodeGen/X86/apx/compress-evex.mir
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,13 @@ body: |
renamable $rax = XOR64rr_NF_ND killed renamable $rax, killed renamable $r16
RET64 $rax
...
---
name: bswapr_to_movberr
body: |
bb.0.entry:
liveins: $rax
; CHECK: bswapq %rax # EVEX TO LEGACY Compression encoding: [0x48,0x0f,0xc8]
renamable $rax = MOVBE64rr killed renamable $rax
RET64 killed $rax

...
2 changes: 2 additions & 0 deletions llvm/utils/TableGen/X86ManualCompressEVEXTables.def
Original file line number Diff line number Diff line change
Expand Up @@ -328,4 +328,6 @@ ENTRY(VBROADCASTSDZ256rm, VBROADCASTSDYrm)
ENTRY(VBROADCASTSDZ256rr, VBROADCASTSDYrr)
ENTRY(VPBROADCASTQZ256rm, VPBROADCASTQYrm)
ENTRY(VPBROADCASTQZ256rr, VPBROADCASTQYrr)
ENTRY(MOVBE32rr, BSWAP32r)
ENTRY(MOVBE64rr, BSWAP64r)
#undef ENTRY