mirror of
https://github.com/RPCSX/llvm.git
synced 2025-02-03 19:15:30 +00:00
[x86] remove duplicate movq instruction defs (PR25554)
We had duplicated definitions for the same hardware '[v]movq' instructions. For example with SSE: def MOVZQI2PQIrr : RS2I<0x6E, MRMSrcReg, (outs VR128:$dst), (ins GR64:$src), "mov{d|q}\t{$src, $dst|$dst, $src}", // X86-64 only [(set VR128:$dst, (v2i64 (X86vzmovl (v2i64 (scalar_to_vector GR64:$src)))))], IIC_SSE_MOVDQ>; def MOV64toPQIrr : RS2I<0x6E, MRMSrcReg, (outs VR128:$dst), (ins GR64:$src), "mov{d|q}\t{$src, $dst|$dst, $src}", [(set VR128:$dst, (v2i64 (scalar_to_vector GR64:$src)))], IIC_SSE_MOVDQ>, Sched<[WriteMove]>; As shown in the test case and PR25554: https://llvm.org/bugs/show_bug.cgi?id=25554 This causes us to miss reusing an operand because later passes don't know these 'movq' are the same instruction. This patch deletes one pair of these defs. Sadly, this won't fix the original test case in the bug report. Something else is still broken. Differential Revision: http://reviews.llvm.org/D14941 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253988 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
1c9cdef8b9
commit
5c2d0848ab
@ -500,7 +500,6 @@ X86InstrInfo::X86InstrInfo(X86Subtarget &STI)
|
||||
{ X86::MOVSX64rr8, X86::MOVSX64rm8, 0 },
|
||||
{ X86::MOVUPDrr, X86::MOVUPDrm, TB_ALIGN_16 },
|
||||
{ X86::MOVUPSrr, X86::MOVUPSrm, 0 },
|
||||
{ X86::MOVZQI2PQIrr, X86::MOVZQI2PQIrm, 0 },
|
||||
{ X86::MOVZPQILo2PQIrr, X86::MOVZPQILo2PQIrm, TB_ALIGN_16 },
|
||||
{ X86::MOVZX16rr8, X86::MOVZX16rm8, 0 },
|
||||
{ X86::MOVZX32rr16, X86::MOVZX32rm16, 0 },
|
||||
@ -610,7 +609,6 @@ X86InstrInfo::X86InstrInfo(X86Subtarget &STI)
|
||||
{ X86::VMOVSHDUPrr, X86::VMOVSHDUPrm, 0 },
|
||||
{ X86::VMOVUPDrr, X86::VMOVUPDrm, 0 },
|
||||
{ X86::VMOVUPSrr, X86::VMOVUPSrm, 0 },
|
||||
{ X86::VMOVZQI2PQIrr, X86::VMOVZQI2PQIrm, 0 },
|
||||
{ X86::VMOVZPQILo2PQIrr,X86::VMOVZPQILo2PQIrm, TB_ALIGN_16 },
|
||||
{ X86::VPABSBrr128, X86::VPABSBrm128, 0 },
|
||||
{ X86::VPABSDrr128, X86::VPABSDrm128, 0 },
|
||||
|
@ -4683,7 +4683,7 @@ def MASKMOVDQU64 : PDI<0xF7, MRMSrcReg, (outs), (ins VR128:$src, VR128:$mask),
|
||||
} // ExeDomain = SSEPackedInt
|
||||
|
||||
//===---------------------------------------------------------------------===//
|
||||
// SSE2 - Move Doubleword
|
||||
// SSE2 - Move Doubleword/Quadword
|
||||
//===---------------------------------------------------------------------===//
|
||||
|
||||
//===---------------------------------------------------------------------===//
|
||||
@ -4883,30 +4883,18 @@ let isCodeGenOnly = 1 in {
|
||||
IIC_SSE_MOVDQ>, Sched<[WriteStore]>;
|
||||
}
|
||||
|
||||
//===---------------------------------------------------------------------===//
|
||||
// Patterns and instructions to describe movd/movq to XMM register zero-extends
|
||||
//
|
||||
let isCodeGenOnly = 1, SchedRW = [WriteMove] in {
|
||||
let AddedComplexity = 15 in {
|
||||
def VMOVZQI2PQIrr : VS2I<0x6E, MRMSrcReg, (outs VR128:$dst), (ins GR64:$src),
|
||||
"movq\t{$src, $dst|$dst, $src}", // X86-64 only
|
||||
[(set VR128:$dst, (v2i64 (X86vzmovl
|
||||
(v2i64 (scalar_to_vector GR64:$src)))))],
|
||||
IIC_SSE_MOVDQ>,
|
||||
VEX, VEX_W;
|
||||
def MOVZQI2PQIrr : RS2I<0x6E, MRMSrcReg, (outs VR128:$dst), (ins GR64:$src),
|
||||
"mov{d|q}\t{$src, $dst|$dst, $src}", // X86-64 only
|
||||
[(set VR128:$dst, (v2i64 (X86vzmovl
|
||||
(v2i64 (scalar_to_vector GR64:$src)))))],
|
||||
IIC_SSE_MOVDQ>;
|
||||
}
|
||||
} // isCodeGenOnly, SchedRW
|
||||
|
||||
let Predicates = [UseAVX] in {
|
||||
let AddedComplexity = 15 in
|
||||
let AddedComplexity = 15 in {
|
||||
def : Pat<(v4i32 (X86vzmovl (v4i32 (scalar_to_vector GR32:$src)))),
|
||||
(VMOVDI2PDIrr GR32:$src)>;
|
||||
|
||||
def : Pat<(v2i64 (X86vzmovl (v2i64 (scalar_to_vector GR64:$src)))),
|
||||
(VMOV64toPQIrr GR64:$src)>;
|
||||
|
||||
def : Pat<(v4i64 (X86vzmovl (insert_subvector undef,
|
||||
(v2i64 (scalar_to_vector GR64:$src)),(iPTR 0)))),
|
||||
(SUBREG_TO_REG (i64 0), (VMOV64toPQIrr GR64:$src), sub_xmm)>;
|
||||
}
|
||||
// AVX 128-bit movd/movq instructions write zeros in the high 128-bit part.
|
||||
// These instructions also write zeros in the high part of a 256-bit register.
|
||||
let AddedComplexity = 20 in {
|
||||
@ -4924,16 +4912,16 @@ let Predicates = [UseAVX] in {
|
||||
def : Pat<(v8i32 (X86vzmovl (insert_subvector undef,
|
||||
(v4i32 (scalar_to_vector GR32:$src)),(iPTR 0)))),
|
||||
(SUBREG_TO_REG (i32 0), (VMOVDI2PDIrr GR32:$src), sub_xmm)>;
|
||||
def : Pat<(v4i64 (X86vzmovl (insert_subvector undef,
|
||||
(v2i64 (scalar_to_vector GR64:$src)),(iPTR 0)))),
|
||||
(SUBREG_TO_REG (i64 0), (VMOVZQI2PQIrr GR64:$src), sub_xmm)>;
|
||||
}
|
||||
|
||||
let Predicates = [UseSSE2] in {
|
||||
let AddedComplexity = 15 in
|
||||
let AddedComplexity = 15 in {
|
||||
def : Pat<(v4i32 (X86vzmovl (v4i32 (scalar_to_vector GR32:$src)))),
|
||||
(MOVDI2PDIrr GR32:$src)>;
|
||||
|
||||
def : Pat<(v2i64 (X86vzmovl (v2i64 (scalar_to_vector GR64:$src)))),
|
||||
(MOV64toPQIrr GR64:$src)>;
|
||||
}
|
||||
let AddedComplexity = 20 in {
|
||||
def : Pat<(v4i32 (X86vzmovl (v4i32 (scalar_to_vector (loadi32 addr:$src))))),
|
||||
(MOVDI2PDIrm addr:$src)>;
|
||||
|
@ -8,7 +8,6 @@ define <2 x i64> @PR25554(<2 x i64> %v0, <2 x i64> %v1) {
|
||||
; SSE-NEXT: movl $1, %eax
|
||||
; SSE-NEXT: movd %rax, %xmm1
|
||||
; SSE-NEXT: por %xmm1, %xmm0
|
||||
; SSE-NEXT: movd %rax, %xmm1
|
||||
; SSE-NEXT: pslldq {{.*#+}} xmm1 = zero,zero,zero,zero,zero,zero,zero,zero,xmm1[0,1,2,3,4,5,6,7]
|
||||
; SSE-NEXT: paddq %xmm1, %xmm0
|
||||
; SSE-NEXT: retq
|
||||
@ -18,7 +17,6 @@ define <2 x i64> @PR25554(<2 x i64> %v0, <2 x i64> %v1) {
|
||||
; AVX-NEXT: movl $1, %eax
|
||||
; AVX-NEXT: vmovq %rax, %xmm1
|
||||
; AVX-NEXT: vpor %xmm1, %xmm0, %xmm0
|
||||
; AVX-NEXT: vmovq %rax, %xmm1
|
||||
; AVX-NEXT: vpslldq {{.*#+}} xmm1 = zero,zero,zero,zero,zero,zero,zero,zero,xmm1[0,1,2,3,4,5,6,7]
|
||||
; AVX-NEXT: vpaddq %xmm1, %xmm0, %xmm0
|
||||
; AVX-NEXT: retq
|
||||
|
Loading…
x
Reference in New Issue
Block a user