1 ; Check that abs.[ds] is only selected for mips32r6 or mips64r6 when no
2 ; additional options are passed. For revisions prior mips32r6 and mips64r6,
3 ; abs.[ds] does not generate the correct result when working with NaNs, and
4 ; should be explicitly enabled with -enable-no-nans-fp-math or +abs2008 options.
6 ; In 1985 mode, abs.[ds] are arithmetic (i.e. they raise invalid operation
7 ; exceptions when given NaN's). In 2008 mode, they are non-arithmetic (i.e.
8 ; they are copies and don't raise any exceptions).
10 ; Testing default values
11 ; RUN: llc < %s -mtriple=mipsel-linux-gnu -mcpu=mips32 | FileCheck %s \
12 ; RUN: -check-prefix=CHECK-ABSLEGACY
13 ; RUN: llc < %s -mtriple=mips64el-linux-gnu -mcpu=mips64 | FileCheck %s \
14 ; RUN: -check-prefix=CHECK-ABSLEGACY
15 ; RUN: llc < %s -mtriple=mipsel-linux-gnu -mcpu=mips32r2 | FileCheck %s \
16 ; RUN: -check-prefix=CHECK-ABSLEGACY
17 ; RUN: llc < %s -mtriple=mips64el-linux-gnu -mcpu=mips64r2 | FileCheck %s \
18 ; RUN: -check-prefix=CHECK-ABSLEGACY
19 ; RUN: llc < %s -mtriple=mipsel-linux-gnu -mcpu=mips32r6 | FileCheck %s \
20 ; RUN: -check-prefix=CHECK-ABS2008
21 ; RUN: llc < %s -mtriple=mips64el-linux-gnu -mcpu=mips64r6 | FileCheck %s \
22 ; RUN: -check-prefix=CHECK-ABS2008
23 ; RUN: llc < %s -mtriple=mips-linux-gnu -mcpu=mips32 | FileCheck %s \
24 ; RUN: -check-prefix=CHECK-ABSLEGACY
25 ; RUN: llc < %s -mtriple=mips64-linux-gnu -mcpu=mips64 | FileCheck %s \
26 ; RUN: -check-prefix=CHECK-ABSLEGACY
27 ; RUN: llc < %s -mtriple=mips-linux-gnu -mcpu=mips32r2 | FileCheck %s \
28 ; RUN: -check-prefix=CHECK-ABSLEGACY
29 ; RUN: llc < %s -mtriple=mips64-linux-gnu -mcpu=mips64r2 | FileCheck %s \
30 ; RUN: -check-prefix=CHECK-ABSLEGACY
31 ; RUN: llc < %s -mtriple=mips-linux-gnu -mcpu=mips32r6 | FileCheck %s \
32 ; RUN: -check-prefix=CHECK-ABS2008
33 ; RUN: llc < %s -mtriple=mips64-linux-gnu -mcpu=mips64r6 | FileCheck %s \
34 ; RUN: -check-prefix=CHECK-ABS2008
35 ; Testing non-default values
36 ; RUN: llc < %s -mtriple=mipsel-linux-gnu -mcpu=mips32r2 -mattr=+abs2008 \
37 ; RUN: | FileCheck %s -check-prefix=CHECK-ABS2008
38 ; RUN: llc < %s -mtriple=mips64el-linux-gnu -mcpu=mips64r2 -mattr=+abs2008 \
39 ; RUN: | FileCheck %s -check-prefix=CHECK-ABS2008
40 ; RUN: llc < %s -mtriple=mips-linux-gnu -mcpu=mips32r2 -mattr=+abs2008 \
41 ; RUN: | FileCheck %s -check-prefix=CHECK-ABS2008
42 ; RUN: llc < %s -mtriple=mips64-linux-gnu -mcpu=mips64r2 -mattr=+abs2008 \
43 ; RUN: | FileCheck %s -check-prefix=CHECK-ABS2008
44 ; Testing -enable-no-nans-fp-math
45 ; RUN: llc < %s -mtriple=mipsel-linux-gnu -mcpu=mips32 \
46 ; RUN: -enable-no-nans-fp-math | FileCheck %s -check-prefix=CHECK-ABS2008
47 ; RUN: llc < %s -mtriple=mips64el-linux-gnu -mcpu=mips64 \
48 ; RUN: -enable-no-nans-fp-math | FileCheck %s -check-prefix=CHECK-ABS2008
49 ; RUN: llc < %s -mtriple=mips-linux-gnu -mcpu=mips32 \
50 ; RUN: -enable-no-nans-fp-math | FileCheck %s -check-prefix=CHECK-ABS2008
51 ; RUN: llc < %s -mtriple=mips64-linux-gnu -mcpu=mips64 \
52 ; RUN: -enable-no-nans-fp-math | FileCheck %s -check-prefix=CHECK-ABS2008
55 ; Testing default values
56 ; RUN: llc < %s -mtriple=mipsel-linux-gnu -mcpu=mips32 -mattr=+micromips \
57 ; RUN: | FileCheck %s -check-prefix=CHECK-ABSLEGACY
58 ; RUN: llc < %s -mtriple=mipsel-linux-gnu -mcpu=mips32r2 -mattr=+micromips \
59 ; RUN: | FileCheck %s -check-prefix=CHECK-ABSLEGACY
60 ; RUN: llc < %s -mtriple=mips-linux-gnu -mcpu=mips32 -mattr=+micromips \
61 ; RUN: | FileCheck %s -check-prefix=CHECK-ABSLEGACY
62 ; RUN: llc < %s -mtriple=mips-linux-gnu -mcpu=mips32r2 -mattr=+micromips \
63 ; RUN: | FileCheck %s -check-prefix=CHECK-ABSLEGACY
64 ; Testing non-default values
65 ; RUN: llc < %s -mtriple=mipsel-linux-gnu -mcpu=mips32r2 \
66 ; RUN: -mattr=+abs2008,+micromips | FileCheck %s -check-prefix=CHECK-ABS2008
67 ; RUN: llc < %s -mtriple=mips-linux-gnu -mcpu=mips32r2 \
68 ; RUN: -mattr=+abs2008,+micromips | FileCheck %s -check-prefix=CHECK-ABS2008
69 ; Testing -enable-no-nans-fp-math
70 ; RUN: llc < %s -mtriple=mipsel-linux-gnu -mcpu=mips32 -mattr=+micromips \
71 ; RUN: -enable-no-nans-fp-math | FileCheck %s -check-prefix=CHECK-ABS2008
72 ; RUN: llc < %s -mtriple=mips-linux-gnu -mcpu=mips32 -mattr=+micromips \
73 ; RUN: -enable-no-nans-fp-math | FileCheck %s -check-prefix=CHECK-ABS2008
75 define float @foo0(float %a) nounwind readnone {
79 ; CHECK-ABS2008: abs.s
80 ; CHECK-ABSLEGACY: {{(ori|ins)}}
81 ; CHECK-ABSLEGACY-NOT: abs.s
83 %call = tail call float @fabsf(float %a) nounwind readnone
87 declare float @fabsf(float) nounwind readnone
89 define double @foo1(double %a) nounwind readnone {
93 ; CHECK-ABS2008: abs.d
94 ; CHECK-ABSLEGACY: {{(ori|ins|dsll)}}
95 ; CHECK-ABSLEGACY-NOT: abs.d
97 %call = tail call double @fabs(double %a) nounwind readnone
101 declare double @fabs(double) nounwind readnone