diff options
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/test/CodeGen/X86/fmsubadd-combine.ll | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/fmsubadd-combine.ll b/llvm/test/CodeGen/X86/fmsubadd-combine.ll index ca2c61a8850..20d850306a2 100644 --- a/llvm/test/CodeGen/X86/fmsubadd-combine.ll +++ b/llvm/test/CodeGen/X86/fmsubadd-combine.ll @@ -132,4 +132,23 @@ entry: ret <16 x float> %subadd } +; This should not be matched to fmsubadd because the mul is on the wrong side of the fsub. +define <2 x double> @mul_subadd_bad_commute(<2 x double> %A, <2 x double> %B, <2 x double> %C) #0 { +; FMA3-LABEL: mul_subadd_bad_commute: +; FMA3: # %bb.0: # %entry +; FMA3-NEXT: vfmsubadd213pd {{.*#+}} xmm0 = (xmm1 * xmm0) -/+ xmm2 +; FMA3-NEXT: retq +; +; FMA4-LABEL: mul_subadd_bad_commute: +; FMA4: # %bb.0: # %entry +; FMA4-NEXT: vfmsubaddpd %xmm2, %xmm1, %xmm0, %xmm0 +; FMA4-NEXT: retq +entry: + %AB = fmul <2 x double> %A, %B + %Sub = fsub <2 x double> %C, %AB + %Add = fadd <2 x double> %AB, %C + %subadd = shufflevector <2 x double> %Add, <2 x double> %Sub, <2 x i32> <i32 0, i32 3> + ret <2 x double> %subadd +} + attributes #0 = { nounwind "unsafe-fp-math"="true" } |