[X86-64] Fix 256-bit SET0 lowering for non-VLX targets

If we don't have VLX then 256-bit SET0 should be lowered
to VPXOR with ZMM registers.  This restores functionality
accidentally removed by r309926.

Differential Revision: https://reviews.llvm.org/D62415

llvm-svn: 361843
This commit is contained in:
David Greene 2019-05-28 15:37:01 +00:00
parent ebe22a1774
commit 561fcc0d63
2 changed files with 72 additions and 0 deletions

View File

@ -3932,6 +3932,12 @@ bool X86InstrInfo::expandPostRAPseudo(MachineInstr &MI) const {
MIB.addReg(SrcReg, RegState::ImplicitDefine);
return true;
}
if (MI.getOpcode() == X86::AVX512_256_SET0) {
// No VLX so we must reference a zmm.
unsigned ZReg =
TRI->getMatchingSuperReg(SrcReg, X86::sub_ymm, &X86::VR512RegClass);
MIB->getOperand(0).setReg(ZReg);
}
return Expand2AddrUndef(MIB, get(X86::VPXORDZrr));
}
case X86::V_SETALLONES:

View File

@ -0,0 +1,66 @@
# Test that we emit VPXORD with ZMM registers instead of YMM
# registers when we do not have VLX.
#
# RUN: llc -mtriple=x86_64-- -mattr=+avx512f -o - %s | FileCheck %s
# CHECK: vpxord %zmm16, %zmm16, %zmm16
--- |
; ModuleID = 'test.ll'
source_filename = "test.ll"
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
@tst_ = common global [4 x i64] zeroinitializer, align 64
define void @main() #0 {
bb0:
%gep1 = bitcast [4 x i64]* @tst_ to [4 x i64]*
%lsr.iv1 = bitcast [4 x i64]* %gep1 to <4 x i64>*
store <4 x i64> zeroinitializer, <4 x i64>* %lsr.iv1, align 16
ret void
}
attributes #0 = { "target-features"="+avx512f" }
...
---
name: main
alignment: 4
exposesReturnsTwice: false
legalized: false
regBankSelected: false
selected: false
failedISel: false
tracksRegLiveness: true
hasWinCFI: false
registers: []
liveins: []
frameInfo:
isFrameAddressTaken: false
isReturnAddressTaken: false
hasStackMap: false
hasPatchPoint: false
stackSize: 0
offsetAdjustment: 0
maxAlignment: 0
adjustsStack: false
hasCalls: false
stackProtector: ''
maxCallFrameSize: 0
cvBytesOfCalleeSavedRegisters: 0
hasOpaqueSPAdjustment: false
hasVAStart: false
hasMustTailInVarArgFunc: false
localFrameSize: 0
savePoint: ''
restorePoint: ''
fixedStack: []
stack: []
constants: []
machineFunctionInfo: {}
body: |
bb.0.bb0:
renamable $ymm16 = AVX512_256_SET0
VMOVAPSZmr $rip, 1, $noreg, @tst_, $noreg, killed renamable $zmm16 :: (store 32 into %ir.lsr.iv1, align 64)
RET 0
...