summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@intel.com>2018-07-09 17:43:24 +0000
committerCraig Topper <craig.topper@intel.com>2018-07-09 17:43:24 +0000
commit47170b3153a4a494bbfd76d31e2fbb754dda34ec (patch)
tree161e7ab97c6c62904a775853a2a8cf12643c011c /llvm/test
parentd070659280c5d0902e5c83eeb0ece4ce77565893 (diff)
downloadbcm5719-llvm-47170b3153a4a494bbfd76d31e2fbb754dda34ec.tar.gz
bcm5719-llvm-47170b3153a4a494bbfd76d31e2fbb754dda34ec.zip
[X86] In combineFMA, make sure we bitcast the result of isFNEG back the expected type before creating the new FMA node.
Previously, we were creating malformed SDNodes, but nothing noticed because the type constraints prevented isel from noticing. llvm-svn: 336566
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/CodeGen/X86/avx512-fma-intrinsics.ll28
1 files changed, 28 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/avx512-fma-intrinsics.ll b/llvm/test/CodeGen/X86/avx512-fma-intrinsics.ll
index ee30370ba95..7b3f685d7b1 100644
--- a/llvm/test/CodeGen/X86/avx512-fma-intrinsics.ll
+++ b/llvm/test/CodeGen/X86/avx512-fma-intrinsics.ll
@@ -1148,5 +1148,33 @@ define <16 x float>@test_int_x86_avx512_mask_vfnmadd_ps_512(<16 x float> %x0, <1
ret <16 x float> %4
}
+; This test case used to crash due to combineFMA not bitcasting results of isFNEG.
+define <4 x float> @foo() {
+; X86-LABEL: foo:
+; X86: # %bb.0: # %entry
+; X86-NEXT: vmovss (%eax), %xmm0 # EVEX TO VEX Compression encoding: [0xc5,0xfa,0x10,0x00]
+; X86-NEXT: # xmm0 = mem[0],zero,zero,zero
+; X86-NEXT: vfmsub213ss %xmm0, %xmm0, %xmm0 # encoding: [0x62,0xf2,0x7d,0x38,0xab,0xc0]
+; X86-NEXT: retl # encoding: [0xc3]
+;
+; X64-LABEL: foo:
+; X64: # %bb.0: # %entry
+; X64-NEXT: vmovss (%rax), %xmm0 # EVEX TO VEX Compression encoding: [0xc5,0xfa,0x10,0x00]
+; X64-NEXT: # xmm0 = mem[0],zero,zero,zero
+; X64-NEXT: vfmsub213ss %xmm0, %xmm0, %xmm0 # encoding: [0x62,0xf2,0x7d,0x38,0xab,0xc0]
+; X64-NEXT: retq # encoding: [0xc3]
+entry:
+ %0 = load <4 x float>, <4 x float>* undef, align 16
+ %sub = fsub <4 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, %0
+ %1 = extractelement <4 x float> %sub, i64 0
+ %2 = call float @llvm.x86.avx512.vfmadd.f32(float undef, float undef, float %1, i32 9)
+ %3 = select i1 extractelement (<8 x i1> bitcast (<1 x i8> <i8 1> to <8 x i1>), i64 0), float %2, float undef
+ %4 = insertelement <4 x float> undef, float %3, i64 0
+ ret <4 x float> %4
+}
+
+; Function Attrs: nounwind readnone
+declare float @llvm.x86.avx512.vfmadd.f32(float, float, float, i32)
+
declare <16 x float> @llvm.fma.v16f32(<16 x float>, <16 x float>, <16 x float>)
declare <8 x double> @llvm.fma.v8f64(<8 x double>, <8 x double>, <8 x double>)
OpenPOWER on IntegriCloud