xref: /llvm-project/llvm/test/CodeGen/PowerPC/scalar-equal.ll (revision b922a3621116b404d868af8b74cab25ab78555be)
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:    fsel f1, f0, f3, f4
24; FAST-P8-NEXT:    xsnegdp f0, f0
25; FAST-P8-NEXT:    fsel f1, f0, f1, 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:    beq cr0, .LBB0_2
50; NO-FAST-P8-NEXT:  # %bb.1: # %entry
51; NO-FAST-P8-NEXT:    fmr f3, f4
52; NO-FAST-P8-NEXT:  .LBB0_2: # %entry
53; NO-FAST-P8-NEXT:    fmr f1, f3
54; NO-FAST-P8-NEXT:    blr
55entry:
56  %cmp = fcmp oeq double %a, %b
57  %cond = select i1 %cmp, double %c, double %d
58  ret double %cond
59}
60
61define double @testoeq_fast(double %a, double %b, double %c, double %d) {
62; FAST-P8-LABEL: testoeq_fast:
63; FAST-P8:       # %bb.0: # %entry
64; FAST-P8-NEXT:    xssubdp f0, f1, f2
65; FAST-P8-NEXT:    fsel f1, f0, f3, f4
66; FAST-P8-NEXT:    xsnegdp f0, f0
67; FAST-P8-NEXT:    fsel f1, f0, f1, f4
68; FAST-P8-NEXT:    blr
69;
70; FAST-P9-LABEL: testoeq_fast:
71; FAST-P9:       # %bb.0: # %entry
72; FAST-P9-NEXT:    xssubdp f0, f1, f2
73; FAST-P9-NEXT:    fsel f1, f0, f3, f4
74; FAST-P9-NEXT:    xsnegdp f0, f0
75; FAST-P9-NEXT:    fsel f1, f0, f1, f4
76; FAST-P9-NEXT:    blr
77;
78; NO-FAST-P9-LABEL: testoeq_fast:
79; NO-FAST-P9:       # %bb.0: # %entry
80; NO-FAST-P9-NEXT:    xssubdp f0, f1, f2
81; NO-FAST-P9-NEXT:    fsel f1, f0, f3, f4
82; NO-FAST-P9-NEXT:    xsnegdp f0, f0
83; NO-FAST-P9-NEXT:    fsel f1, f0, f1, f4
84; NO-FAST-P9-NEXT:    blr
85;
86; NO-FAST-P8-LABEL: testoeq_fast:
87; NO-FAST-P8:       # %bb.0: # %entry
88; NO-FAST-P8-NEXT:    xssubdp f0, f1, f2
89; NO-FAST-P8-NEXT:    fsel f1, f0, f3, f4
90; NO-FAST-P8-NEXT:    xsnegdp f0, f0
91; NO-FAST-P8-NEXT:    fsel f1, f0, f1, f4
92; NO-FAST-P8-NEXT:    blr
93entry:
94  %cmp = fcmp nnan ninf nsz oeq double %a, %b
95  %cond = select nnan ninf nsz i1 %cmp, double %c, double %d
96  ret double %cond
97}
98