xref: /aosp_15_r20/external/llvm/test/CodeGen/Mips/fabs.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; Check that abs.[ds] is selected and does not depend on -enable-no-nans-fp-math
2*9880d681SAndroid Build Coastguard Worker; They obey the Has2008 and ABS2008 configuration bits which govern the
3*9880d681SAndroid Build Coastguard Worker; conformance to IEEE 754 (1985) and IEEE 754 (2008). When these bits are not
4*9880d681SAndroid Build Coastguard Worker; present, they confirm to 1985.
5*9880d681SAndroid Build Coastguard Worker; In 1985 mode, abs.[ds] are arithmetic (i.e. they raise invalid operation
6*9880d681SAndroid Build Coastguard Worker; exceptions when given NaN's). In 2008 mode, they are non-arithmetic (i.e.
7*9880d681SAndroid Build Coastguard Worker; they are copies and don't raise any exceptions).
8*9880d681SAndroid Build Coastguard Worker
9*9880d681SAndroid Build Coastguard Worker; RUN: llc  < %s -mtriple=mipsel-linux-gnu -mcpu=mips32 | FileCheck %s
10*9880d681SAndroid Build Coastguard Worker; RUN: llc  < %s -mtriple=mipsel-linux-gnu -mcpu=mips32r2 | FileCheck %s
11*9880d681SAndroid Build Coastguard Worker; RUN: llc  < %s -mtriple=mipsel-linux-gnu -mcpu=mips32 -enable-no-nans-fp-math | FileCheck %s
12*9880d681SAndroid Build Coastguard Worker
13*9880d681SAndroid Build Coastguard Worker; RUN: llc  < %s -mtriple=mips64el-linux-gnu -mcpu=mips64 | FileCheck %s
14*9880d681SAndroid Build Coastguard Worker; RUN: llc  < %s -mtriple=mips64el-linux-gnu -mcpu=mips64 -enable-no-nans-fp-math | FileCheck %s
15*9880d681SAndroid Build Coastguard Worker
16*9880d681SAndroid Build Coastguard Workerdefine float @foo0(float %a) nounwind readnone {
17*9880d681SAndroid Build Coastguard Workerentry:
18*9880d681SAndroid Build Coastguard Worker
19*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: foo0
20*9880d681SAndroid Build Coastguard Worker; CHECK: abs.s
21*9880d681SAndroid Build Coastguard Worker
22*9880d681SAndroid Build Coastguard Worker  %call = tail call float @fabsf(float %a) nounwind readnone
23*9880d681SAndroid Build Coastguard Worker  ret float %call
24*9880d681SAndroid Build Coastguard Worker}
25*9880d681SAndroid Build Coastguard Worker
26*9880d681SAndroid Build Coastguard Workerdeclare float @fabsf(float) nounwind readnone
27*9880d681SAndroid Build Coastguard Worker
28*9880d681SAndroid Build Coastguard Workerdefine double @foo1(double %a) nounwind readnone {
29*9880d681SAndroid Build Coastguard Workerentry:
30*9880d681SAndroid Build Coastguard Worker
31*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: foo1:
32*9880d681SAndroid Build Coastguard Worker; CHECK: abs.d
33*9880d681SAndroid Build Coastguard Worker
34*9880d681SAndroid Build Coastguard Worker  %call = tail call double @fabs(double %a) nounwind readnone
35*9880d681SAndroid Build Coastguard Worker  ret double %call
36*9880d681SAndroid Build Coastguard Worker}
37*9880d681SAndroid Build Coastguard Worker
38*9880d681SAndroid Build Coastguard Workerdeclare double @fabs(double) nounwind readnone
39