Index: llvm/trunk/lib/Target/PowerPC/PPCInstrVSX.td =================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCInstrVSX.td +++ llvm/trunk/lib/Target/PowerPC/PPCInstrVSX.td @@ -1512,6 +1512,12 @@ AltVSXFMARel; } + // Additional xsnmsubasp patterns: -a*b + c == -(a*b - c) + def : Pat<(fma (fneg f32:$A), f32:$B, f32:$C), + (XSNMSUBASP $C, $A, $B)>; + def : Pat<(fma f32:$A, (fneg f32:$C), f32:$B), + (XSNMSUBASP $C, $A, $B)>; + // Single Precision Conversions (FP <-> INT) def XSCVSXDSP : XX2Form<60, 312, (outs vssrc:$XT), (ins vsfrc:$XB), Index: llvm/trunk/test/CodeGen/PowerPC/fdiv.ll =================================================================== --- llvm/trunk/test/CodeGen/PowerPC/fdiv.ll +++ llvm/trunk/test/CodeGen/PowerPC/fdiv.ll @@ -5,9 +5,8 @@ ; CHECK-LABEL: foo: ; CHECK: # %bb.0: ; CHECK-NEXT: xsresp 3, 2 -; CHECK-NEXT: fneg 2, 2 ; CHECK-NEXT: xsmulsp 0, 1, 3 -; CHECK-NEXT: xsmaddasp 1, 2, 0 +; CHECK-NEXT: xsnmsubasp 1, 2, 0 ; CHECK-NEXT: xsmaddasp 0, 3, 1 ; CHECK-NEXT: fmr 1, 0 ; CHECK-NEXT: blr