xref: /aosp_15_r20/external/llvm/test/CodeGen/Mips/fneg.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 %d) nounwind readnone {
17*9880d681SAndroid Build Coastguard Workerentry:
18*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: foo0:
19*9880d681SAndroid Build Coastguard Worker; CHECK: neg.s
20*9880d681SAndroid Build Coastguard Worker  %sub = fsub float -0.000000e+00, %d
21*9880d681SAndroid Build Coastguard Worker  ret float %sub
22*9880d681SAndroid Build Coastguard Worker}
23*9880d681SAndroid Build Coastguard Worker
24*9880d681SAndroid Build Coastguard Workerdefine double @foo1(double %d) nounwind readnone {
25*9880d681SAndroid Build Coastguard Workerentry:
26*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: foo1:
27*9880d681SAndroid Build Coastguard Worker; CHECK: neg.d
28*9880d681SAndroid Build Coastguard Worker  %sub = fsub double -0.000000e+00, %d
29*9880d681SAndroid Build Coastguard Worker  ret double %sub
30*9880d681SAndroid Build Coastguard Worker}
31