1 ; RUN: llc -verify-machineinstrs < %s -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 -mattr=-vsx | FileCheck %s
2 ; RUN: llc -verify-machineinstrs < %s -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 -enable-no-infs-fp-math -enable-no-nans-fp-math -mattr=-vsx | FileCheck -check-prefix=CHECK-FM %s
3 ; RUN: llc -verify-machineinstrs < %s -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 -enable-no-infs-fp-math -enable-no-nans-fp-math -mattr=+vsx | FileCheck -check-prefix=CHECK-FM-VSX %s
4 target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f128:128:128-v128:128:128-n32:64"
5 target triple = "powerpc64-unknown-linux-gnu"
7 define double @zerocmp1(double %a, double %y, double %z) #0 {
9 %cmp = fcmp ult double %a, 0.000000e+00
10 %z.y = select i1 %cmp, double %z, double %y
18 ; CHECK-FM: fsel 1, 1, 2, 3
21 ; CHECK-FM-VSX: @zerocmp1
22 ; CHECK-FM-VSX: fsel 1, 1, 2, 3
26 define double @zerocmp2(double %a, double %y, double %z) #0 {
28 %cmp = fcmp ogt double %a, 0.000000e+00
29 %y.z = select i1 %cmp, double %y, double %z
37 ; CHECK-FM: fneg [[REG:[0-9]+]], 1
38 ; CHECK-FM: fsel 1, [[REG]], 3, 2
41 ; CHECK-FM-VSX: @zerocmp2
42 ; CHECK-FM-VSX: xsnegdp [[REG:[0-9]+]], 1
43 ; CHECK-FM-VSX: fsel 1, [[REG]], 3, 2
47 define double @zerocmp3(double %a, double %y, double %z) #0 {
49 %cmp = fcmp oeq double %a, 0.000000e+00
50 %y.z = select i1 %cmp, double %y, double %z
58 ; CHECK-FM: fsel [[REG:[0-9]+]], 1, 2, 3
59 ; CHECK-FM: fneg [[REG2:[0-9]+]], 1
60 ; CHECK-FM: fsel 1, [[REG2]], [[REG]], 3
63 ; CHECK-FM-VSX: @zerocmp3
64 ; CHECK-FM-VSX: xsnegdp [[REG2:[0-9]+]], 1
65 ; CHECK-FM-VSX: fsel [[REG:[0-9]+]], 1, 2, 3
66 ; CHECK-FM-VSX: fsel 1, [[REG2]], [[REG]], 3
70 define double @min1(double %a, double %b) #0 {
72 %cmp = fcmp ole double %a, %b
73 %cond = select i1 %cmp, double %a, double %b
81 ; CHECK-FM: fsub [[REG:[0-9]+]], 2, 1
82 ; CHECK-FM: fsel 1, [[REG]], 1, 2
86 ; CHECK-FM-VSX: xssubdp [[REG:[0-9]+]], 2, 1
87 ; CHECK-FM-VSX: fsel 1, [[REG]], 1, 2
91 define double @max1(double %a, double %b) #0 {
93 %cmp = fcmp oge double %a, %b
94 %cond = select i1 %cmp, double %a, double %b
102 ; CHECK-FM: fsub [[REG:[0-9]+]], 1, 2
103 ; CHECK-FM: fsel 1, [[REG]], 1, 2
106 ; CHECK-FM-VSX: @max1
107 ; CHECK-FM-VSX: xssubdp [[REG:[0-9]+]], 1, 2
108 ; CHECK-FM-VSX: fsel 1, [[REG]], 1, 2
112 define double @cmp1(double %a, double %b, double %y, double %z) #0 {
114 %cmp = fcmp ult double %a, %b
115 %z.y = select i1 %cmp, double %z, double %y
123 ; CHECK-FM: fsub [[REG:[0-9]+]], 1, 2
124 ; CHECK-FM: fsel 1, [[REG]], 3, 4
127 ; CHECK-FM-VSX: @cmp1
128 ; CHECK-FM-VSX: xssubdp [[REG:[0-9]+]], 1, 2
129 ; CHECK-FM-VSX: fsel 1, [[REG]], 3, 4
133 define double @cmp2(double %a, double %b, double %y, double %z) #0 {
135 %cmp = fcmp ogt double %a, %b
136 %y.z = select i1 %cmp, double %y, double %z
144 ; CHECK-FM: fsub [[REG:[0-9]+]], 2, 1
145 ; CHECK-FM: fsel 1, [[REG]], 4, 3
148 ; CHECK-FM-VSX: @cmp2
149 ; CHECK-FM-VSX: xssubdp [[REG:[0-9]+]], 2, 1
150 ; CHECK-FM-VSX: fsel 1, [[REG]], 4, 3
154 define double @cmp3(double %a, double %b, double %y, double %z) #0 {
156 %cmp = fcmp oeq double %a, %b
157 %y.z = select i1 %cmp, double %y, double %z
165 ; CHECK-FM: fsub [[REG:[0-9]+]], 1, 2
166 ; CHECK-FM: fsel [[REG2:[0-9]+]], [[REG]], 3, 4
167 ; CHECK-FM: fneg [[REG3:[0-9]+]], [[REG]]
168 ; CHECK-FM: fsel 1, [[REG3]], [[REG2]], 4
171 ; CHECK-FM-VSX: @cmp3
172 ; CHECK-FM-VSX: xssubdp [[REG:[0-9]+]], 1, 2
173 ; CHECK-FM-VSX: xsnegdp [[REG3:[0-9]+]], [[REG]]
174 ; CHECK-FM-VSX: fsel [[REG2:[0-9]+]], [[REG]], 3, 4
175 ; CHECK-FM-VSX: fsel 1, [[REG3]], [[REG2]], 4
179 attributes #0 = { nounwind readnone }