1; RUN: llc -verify-machineinstrs < %s -mtriple=ppc32-- -fp-contract=fast -mattr=-vsx -disable-ppc-vsx-fma-mutation=false | FileCheck %s 2; RUN: llc -verify-machineinstrs < %s -mtriple=powerpc64-unknown-linux-gnu -fp-contract=fast -mattr=+vsx -mcpu=pwr7 -disable-ppc-vsx-fma-mutation=false | FileCheck -check-prefix=CHECK-VSX %s 3 4define double @test_FMADD_EXT1(float %A, float %B, double %C) { 5 %D = fmul float %A, %B ; <float> [#uses=1] 6 %E = fpext float %D to double ; <double> [#uses=1] 7 %F = fadd double %E, %C ; <double> [#uses=1] 8 ret double %F 9; CHECK-LABEL: test_FMADD_EXT1: 10; CHECK: fmadd 11; CHECK-NEXT: blr 12 13; CHECK-VSX-LABEL: test_FMADD_EXT1: 14; CHECK-VSX: xsmaddmdp 15; CHECK-VSX-NEXT: blr 16} 17 18define double @test_FMADD_EXT2(float %A, float %B, double %C) { 19 %D = fmul float %A, %B ; <float> [#uses=1] 20 %E = fpext float %D to double ; <double> [#uses=1] 21 %F = fadd double %C, %E ; <double> [#uses=1] 22 ret double %F 23; CHECK-LABEL: test_FMADD_EXT2: 24; CHECK: fmadd 25; CHECK-NEXT: blr 26 27; CHECK-VSX-LABEL: test_FMADD_EXT2: 28; CHECK-VSX: xsmaddmdp 29; CHECK-VSX-NEXT: blr 30} 31 32define double @test_FMSUB_EXT1(float %A, float %B, double %C) { 33 %D = fmul float %A, %B ; <float> [#uses=1] 34 %E = fpext float %D to double ; <double> [#uses=1] 35 %F = fsub double %E, %C ; <double> [#uses=1] 36 ret double %F 37; CHECK-LABEL: test_FMSUB_EXT1: 38; CHECK: fmsub 39; CHECK-NEXT: blr 40 41; CHECK-VSX-LABEL: test_FMSUB_EXT1: 42; CHECK-VSX: xsmsubmdp 43; CHECK-VSX-NEXT: blr 44} 45 46define double @test_FMSUB_EXT2(float %A, float %B, double %C) { 47 %D = fmul float %A, %B ; <float> [#uses=1] 48 %E = fpext float %D to double ; <double> [#uses=1] 49 %F = fsub double %C, %E ; <double> [#uses=1] 50 ret double %F 51; CHECK-LABEL: test_FMSUB_EXT2: 52; CHECK: fneg 53; CHECK-NEXT: fmadd 54; CHECK-NEXT: blr 55 56; CHECK-VSX-LABEL: test_FMSUB_EXT2: 57; CHECK-VSX: xsnegdp 58; CHECK-VSX-NEXT: xsmaddmdp 59; CHECK-VSX-NEXT: blr 60} 61 62; need nsz flag to generate fnmsub since it may affect sign of zero 63define double @test_FMSUB_EXT2_NSZ(float %A, float %B, double %C) { 64 %D = fmul nsz float %A, %B ; <float> [#uses=1] 65 %E = fpext float %D to double ; <double> [#uses=1] 66 %F = fsub nsz double %C, %E ; <double> [#uses=1] 67 ret double %F 68; CHECK-LABEL: test_FMSUB_EXT2_NSZ: 69; CHECK: fnmsub 70; CHECK-NEXT: blr 71 72; CHECK-VSX-LABEL: test_FMSUB_EXT2_NSZ: 73; CHECK-VSX: xsnmsubmdp 74; CHECK-VSX-NEXT: blr 75} 76 77define double @test_FMSUB_EXT3(float %A, float %B, double %C) { 78 %D = fmul float %A, %B ; <float> [#uses=1] 79 %E = fsub float -0.000000e+00, %D ; <float> [#uses=1] 80 %F = fpext float %E to double ; <double> [#uses=1] 81 %G = fsub double %F, %C ; <double> [#uses=1] 82 ret double %G 83; CHECK-LABEL: test_FMSUB_EXT3: 84; CHECK: fnmadd 85 86; CHECK-NEXT: blr 87 88; CHECK-VSX-LABEL: test_FMSUB_EXT3: 89; CHECK-VSX: xsnmaddmdp 90 91; CHECK-VSX-NEXT: blr 92} 93 94define double @test_FMSUB_EXT4(float %A, float %B, double %C) { 95 %D = fmul float %A, %B ; <float> [#uses=1] 96 %E = fpext float %D to double ; <double> [#uses=1] 97 %F = fsub double -0.000000e+00, %E ; <double> [#uses=1] 98 %G = fsub double %F, %C ; <double> [#uses=1] 99 ret double %G 100; CHECK-LABEL: test_FMSUB_EXT4: 101; CHECK: fnmadd 102 103; CHECK-NEXT: blr 104 105; CHECK-VSX-LABEL: test_FMSUB_EXT4: 106; CHECK-VSX: xsnmaddmdp 107 108; CHECK-VSX-NEXT: blr 109} 110