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
4 define 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]
9 ; CHECK-LABEL: test_FMADD_EXT1:
13 ; CHECK-VSX-LABEL: test_FMADD_EXT1:
14 ; CHECK-VSX: xsmaddmdp
18 define 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]
23 ; CHECK-LABEL: test_FMADD_EXT2:
27 ; CHECK-VSX-LABEL: test_FMADD_EXT2:
28 ; CHECK-VSX: xsmaddmdp
32 define 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]
37 ; CHECK-LABEL: test_FMSUB_EXT1:
41 ; CHECK-VSX-LABEL: test_FMSUB_EXT1:
42 ; CHECK-VSX: xsmsubmdp
46 define 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]
51 ; CHECK-LABEL: test_FMSUB_EXT2:
56 ; CHECK-VSX-LABEL: test_FMSUB_EXT2:
58 ; CHECK-VSX-NEXT: xsmaddmdp
62 ; need nsz flag to generate fnmsub since it may affect sign of zero
63 define 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]
68 ; CHECK-LABEL: test_FMSUB_EXT2_NSZ:
72 ; CHECK-VSX-LABEL: test_FMSUB_EXT2_NSZ:
73 ; CHECK-VSX: xsnmsubmdp
77 define 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]
83 ; CHECK-LABEL: test_FMSUB_EXT3:
88 ; CHECK-VSX-LABEL: test_FMSUB_EXT3:
89 ; CHECK-VSX: xsnmaddmdp
94 define 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]
100 ; CHECK-LABEL: test_FMSUB_EXT4:
105 ; CHECK-VSX-LABEL: test_FMSUB_EXT4:
106 ; CHECK-VSX: xsnmaddmdp
108 ; CHECK-VSX-NEXT: blr