1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 11:33:24 +02:00

[X86] Don't crash on CVTPS2PH with wide vector inputs.

This commit is contained in:
Benjamin Kramer 2020-10-27 14:34:26 +01:00
parent 60eeed7af0
commit b4071a353d
2 changed files with 33 additions and 0 deletions

View File

@ -29878,6 +29878,9 @@ void X86TargetLowering::ReplaceNodeResults(SDNode *N,
Results.push_back(Chain); Results.push_back(Chain);
return; return;
} }
case X86ISD::CVTPS2PH:
Results.push_back(LowerCVTPS2PH(SDValue(N, 0), DAG));
return;
case ISD::CTPOP: { case ISD::CTPOP: {
assert(N->getValueType(0) == MVT::i64 && "Unexpected VT!"); assert(N->getValueType(0) == MVT::i64 && "Unexpected VT!");
// Use a v2i64 if possible. // Use a v2i64 if possible.

View File

@ -1422,3 +1422,33 @@ define void @store_cvt_8f64_to_8i16(<8 x double> %a0, <8 x i16>* %a1) nounwind {
store <8 x i16> %2, <8 x i16>* %a1 store <8 x i16> %2, <8 x i16>* %a1
ret void ret void
} }
define void @store_cvt_32f32_to_32f16(<32 x float> %a0, <32 x half>* %a1) nounwind {
; AVX1-LABEL: store_cvt_32f32_to_32f16:
; AVX1: # %bb.0:
; AVX1-NEXT: vcvtps2ph $4, %ymm3, 48(%rdi)
; AVX1-NEXT: vcvtps2ph $4, %ymm2, 32(%rdi)
; AVX1-NEXT: vcvtps2ph $4, %ymm1, 16(%rdi)
; AVX1-NEXT: vcvtps2ph $4, %ymm0, (%rdi)
; AVX1-NEXT: vzeroupper
; AVX1-NEXT: retq
;
; AVX2-LABEL: store_cvt_32f32_to_32f16:
; AVX2: # %bb.0:
; AVX2-NEXT: vcvtps2ph $4, %ymm3, 48(%rdi)
; AVX2-NEXT: vcvtps2ph $4, %ymm2, 32(%rdi)
; AVX2-NEXT: vcvtps2ph $4, %ymm1, 16(%rdi)
; AVX2-NEXT: vcvtps2ph $4, %ymm0, (%rdi)
; AVX2-NEXT: vzeroupper
; AVX2-NEXT: retq
;
; AVX512-LABEL: store_cvt_32f32_to_32f16:
; AVX512: # %bb.0:
; AVX512-NEXT: vcvtps2ph $4, %zmm1, 32(%rdi)
; AVX512-NEXT: vcvtps2ph $4, %zmm0, (%rdi)
; AVX512-NEXT: vzeroupper
; AVX512-NEXT: retq
%1 = fptrunc <32 x float> %a0 to <32 x half>
store <32 x half> %1, <32 x half>* %a1
ret void
}