mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-01 13:11:39 +01:00
[DAGCombiner] Add a peekThroughBitcast to MergeStoresOfConstantsOrVecElts to fix a crash if we are storing a bitcast of a constant.
Loading a constant into a k-register in AVX512 requires a bitcast from a scalar constant. In the test case here we have a k-register store that gets split into multiple parts of KNL. MergeConsecutiveStores sees each of these pieces as a consecutive store and looks through the bitcast to find the underly scalar constant. But when we went to create the combined store we didn't look through the same bitcast. llvm-svn: 326677
This commit is contained in:
parent
60c68d3c93
commit
53ec70c57c
@ -12911,6 +12911,7 @@ bool DAGCombiner::MergeStoresOfConstantsOrVecElts(
|
||||
StoreSDNode *St = cast<StoreSDNode>(StoreNodes[Idx].MemNode);
|
||||
|
||||
SDValue Val = St->getValue();
|
||||
Val = peekThroughBitcast(Val);
|
||||
StoreInt <<= ElementSizeBits;
|
||||
if (ConstantSDNode *C = dyn_cast<ConstantSDNode>(Val)) {
|
||||
StoreInt |= C->getAPIntValue()
|
||||
|
@ -2795,3 +2795,35 @@ entry:
|
||||
ret <8 x i64> %8
|
||||
}
|
||||
|
||||
define void @store_v64i1_constant(<64 x i1>* %R) {
|
||||
; KNL-LABEL: store_v64i1_constant:
|
||||
; KNL: ## %bb.0: ## %entry
|
||||
; KNL-NEXT: kxnorw %k0, %k0, %k0
|
||||
; KNL-NEXT: kmovw %k0, 2(%rdi)
|
||||
; KNL-NEXT: movl $-536871045, 4(%rdi) ## imm = 0xDFFFFF7B
|
||||
; KNL-NEXT: movw $-4099, (%rdi) ## imm = 0xEFFD
|
||||
; KNL-NEXT: retq
|
||||
;
|
||||
; SKX-LABEL: store_v64i1_constant:
|
||||
; SKX: ## %bb.0: ## %entry
|
||||
; SKX-NEXT: movabsq $-2305843576149381123, %rax ## imm = 0xDFFFFF7BFFFFEFFD
|
||||
; SKX-NEXT: movq %rax, (%rdi)
|
||||
; SKX-NEXT: retq
|
||||
;
|
||||
; AVX512BW-LABEL: store_v64i1_constant:
|
||||
; AVX512BW: ## %bb.0: ## %entry
|
||||
; AVX512BW-NEXT: movabsq $-2305843576149381123, %rax ## imm = 0xDFFFFF7BFFFFEFFD
|
||||
; AVX512BW-NEXT: movq %rax, (%rdi)
|
||||
; AVX512BW-NEXT: retq
|
||||
;
|
||||
; AVX512DQ-LABEL: store_v64i1_constant:
|
||||
; AVX512DQ: ## %bb.0: ## %entry
|
||||
; AVX512DQ-NEXT: kxnorw %k0, %k0, %k0
|
||||
; AVX512DQ-NEXT: kmovw %k0, 2(%rdi)
|
||||
; AVX512DQ-NEXT: movl $-536871045, 4(%rdi) ## imm = 0xDFFFFF7B
|
||||
; AVX512DQ-NEXT: movw $-4099, (%rdi) ## imm = 0xEFFD
|
||||
; AVX512DQ-NEXT: retq
|
||||
entry:
|
||||
store <64 x i1> <i1 1, i1 0, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 0, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 0, i1 1, i1 1, i1 1, i1 1, i1 0, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 1, i1 0, i1 1, i1 1>, <64 x i1>* %R
|
||||
ret void
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user