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