1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc -mcpu=pwr8 -ppc-asm-full-reg-names --enable-unsafe-fp-math \
3; RUN:   -verify-machineinstrs --enable-no-signed-zeros-fp-math \
4; RUN:   --enable-no-nans-fp-math --enable-no-infs-fp-math \
5; RUN:   -mtriple=powerpc64le-unknown-unknown < %s | FileCheck %s \
6; RUN:   --check-prefix=FAST-P8
7; RUN: llc -mcpu=pwr9 -ppc-asm-full-reg-names --enable-unsafe-fp-math \
8; RUN:   -verify-machineinstrs --enable-no-signed-zeros-fp-math \
9; RUN:   --enable-no-nans-fp-math --enable-no-infs-fp-math \
10; RUN:   -mtriple=powerpc64le-unknown-unknown < %s | FileCheck %s \
11; RUN:   --check-prefix=FAST-P9
12; RUN: llc -mcpu=pwr9 -ppc-asm-full-reg-names -verify-machineinstrs \
13; RUN:   -mtriple=powerpc64le-unknown-unknown < %s | FileCheck %s \
14; RUN:   --check-prefix=NO-FAST-P9
15; RUN: llc -mcpu=pwr8 -ppc-asm-full-reg-names -verify-machineinstrs \
16; RUN:   -mtriple=powerpc64le-unknown-unknown < %s | FileCheck %s \
17; RUN:   --check-prefix=NO-FAST-P8
18
19define double @testoeq(double %a, double %b, double %c, double %d) {
20; FAST-P8-LABEL: testoeq:
21; FAST-P8:       # %bb.0: # %entry
22; FAST-P8-NEXT:    xssubdp f0, f1, f2
23; FAST-P8-NEXT:    xsnegdp f1, f0
24; FAST-P8-NEXT:    fsel f0, f0, f3, f4
25; FAST-P8-NEXT:    fsel f1, f1, f0, f4
26; FAST-P8-NEXT:    blr
27;
28; FAST-P9-LABEL: testoeq:
29; FAST-P9:       # %bb.0: # %entry
30; FAST-P9-NEXT:    xssubdp f0, f1, f2
31; FAST-P9-NEXT:    fsel f1, f0, f3, f4
32; FAST-P9-NEXT:    xsnegdp f0, f0
33; FAST-P9-NEXT:    fsel f1, f0, f1, f4
34; FAST-P9-NEXT:    blr
35;
36; NO-FAST-P9-LABEL: testoeq:
37; NO-FAST-P9:       # %bb.0: # %entry
38; NO-FAST-P9-NEXT:    xscmpudp cr0, f1, f2
39; NO-FAST-P9-NEXT:    beq cr0, .LBB0_2
40; NO-FAST-P9-NEXT:  # %bb.1: # %entry
41; NO-FAST-P9-NEXT:    fmr f3, f4
42; NO-FAST-P9-NEXT:  .LBB0_2: # %entry
43; NO-FAST-P9-NEXT:    fmr f1, f3
44; NO-FAST-P9-NEXT:    blr
45;
46; NO-FAST-P8-LABEL: testoeq:
47; NO-FAST-P8:       # %bb.0: # %entry
48; NO-FAST-P8-NEXT:    xscmpudp cr0, f1, f2
49; NO-FAST-P8-NEXT:    fmr f1, f3
50; NO-FAST-P8-NEXT:    beqlr cr0
51; NO-FAST-P8-NEXT:  # %bb.1: # %entry
52; NO-FAST-P8-NEXT:    fmr f1, f4
53; NO-FAST-P8-NEXT:    blr
54entry:
55  %cmp = fcmp oeq double %a, %b
56  %cond = select i1 %cmp, double %c, double %d
57  ret double %cond
58}
59
60define double @testoeq_fast(double %a, double %b, double %c, double %d) {
61; FAST-P8-LABEL: testoeq_fast:
62; FAST-P8:       # %bb.0: # %entry
63; FAST-P8-NEXT:    xssubdp f0, f1, f2
64; FAST-P8-NEXT:    xsnegdp f1, f0
65; FAST-P8-NEXT:    fsel f0, f0, f3, f4
66; FAST-P8-NEXT:    fsel f1, f1, f0, f4
67; FAST-P8-NEXT:    blr
68;
69; FAST-P9-LABEL: testoeq_fast:
70; FAST-P9:       # %bb.0: # %entry
71; FAST-P9-NEXT:    xssubdp f0, f1, f2
72; FAST-P9-NEXT:    fsel f1, f0, f3, f4
73; FAST-P9-NEXT:    xsnegdp f0, f0
74; FAST-P9-NEXT:    fsel f1, f0, f1, f4
75; FAST-P9-NEXT:    blr
76;
77; NO-FAST-P9-LABEL: testoeq_fast:
78; NO-FAST-P9:       # %bb.0: # %entry
79; NO-FAST-P9-NEXT:    xssubdp f0, f1, f2
80; NO-FAST-P9-NEXT:    fsel f1, f0, f3, f4
81; NO-FAST-P9-NEXT:    xsnegdp f0, f0
82; NO-FAST-P9-NEXT:    fsel f1, f0, f1, f4
83; NO-FAST-P9-NEXT:    blr
84;
85; NO-FAST-P8-LABEL: testoeq_fast:
86; NO-FAST-P8:       # %bb.0: # %entry
87; NO-FAST-P8-NEXT:    xssubdp f0, f1, f2
88; NO-FAST-P8-NEXT:    xsnegdp f1, f0
89; NO-FAST-P8-NEXT:    fsel f0, f0, f3, f4
90; NO-FAST-P8-NEXT:    fsel f1, f1, f0, f4
91; NO-FAST-P8-NEXT:    blr
92entry:
93  %cmp = fcmp nnan ninf nsz oeq double %a, %b
94  %cond = select nnan ninf nsz i1 %cmp, double %c, double %d
95  ret double %cond
96}
97