diff options
| author | Aleksandar Beserminji <abeserminji@wavecomp.com> | 2019-01-28 14:59:30 +0000 |
|---|---|---|
| committer | Aleksandar Beserminji <abeserminji@wavecomp.com> | 2019-01-28 14:59:30 +0000 |
| commit | 6c5dfcb89edf93eb50356dc39ea0ea2dcbba906f (patch) | |
| tree | d36c2d32305d6a18db49a79cbe30bddc4bf9cb7d /llvm/test/CodeGen/Mips | |
| parent | 9feaecf22c235e5b97bd56d657a90fe1736eba56 (diff) | |
| download | bcm5719-llvm-6c5dfcb89edf93eb50356dc39ea0ea2dcbba906f.tar.gz bcm5719-llvm-6c5dfcb89edf93eb50356dc39ea0ea2dcbba906f.zip | |
[mips] Support for +abs2008 attribute
Instruction abs.[ds] is not generating correct result when working
with NaNs for revisions prior mips32r6 and mips64r6.
To generate a sequence which always produce a correct result, but also
to allow user more control on how his code is compiled, attribute
+abs2008 is added, so user can choose legacy or 2008.
By default legacy mode is used on revisions prior R6. Mips32r6 and
mips64r6 use abs2008 mode by default.
Differential Revision: https://reviews.llvm.org/D35983
llvm-svn: 352370
Diffstat (limited to 'llvm/test/CodeGen/Mips')
| -rw-r--r-- | llvm/test/CodeGen/Mips/fabs.ll | 85 | ||||
| -rw-r--r-- | llvm/test/CodeGen/Mips/llvm-ir/abs.ll | 16 | ||||
| -rw-r--r-- | llvm/test/CodeGen/Mips/msa/f16-llvm-ir.ll | 6 |
3 files changed, 86 insertions, 21 deletions
diff --git a/llvm/test/CodeGen/Mips/fabs.ll b/llvm/test/CodeGen/Mips/fabs.ll index ce1a9a60e7c..75aa7d8295f 100644 --- a/llvm/test/CodeGen/Mips/fabs.ll +++ b/llvm/test/CodeGen/Mips/fabs.ll @@ -1,23 +1,84 @@ -; Check that abs.[ds] is selected and does not depend on -enable-no-nans-fp-math -; They obey the Has2008 and ABS2008 configuration bits which govern the -; conformance to IEEE 754 (1985) and IEEE 754 (2008). When these bits are not -; present, they confirm to 1985. +; 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). -; RUN: llc < %s -mtriple=mipsel-linux-gnu -mcpu=mips32 | FileCheck %s -; RUN: llc < %s -mtriple=mipsel-linux-gnu -mcpu=mips32r2 | FileCheck %s -; RUN: llc < %s -mtriple=mipsel-linux-gnu -mcpu=mips32 -enable-no-nans-fp-math | FileCheck %s +; 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 -; RUN: llc < %s -mtriple=mips64el-linux-gnu -mcpu=mips64 | FileCheck %s -; RUN: llc < %s -mtriple=mips64el-linux-gnu -mcpu=mips64 -enable-no-nans-fp-math | FileCheck %s +; 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: abs.s +; 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 @@ -29,7 +90,9 @@ define double @foo1(double %a) nounwind readnone { entry: ; CHECK-LABEL: foo1: -; CHECK: abs.d +; 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 diff --git a/llvm/test/CodeGen/Mips/llvm-ir/abs.ll b/llvm/test/CodeGen/Mips/llvm-ir/abs.ll index 3ae8525ec18..c0812977e3a 100644 --- a/llvm/test/CodeGen/Mips/llvm-ir/abs.ll +++ b/llvm/test/CodeGen/Mips/llvm-ir/abs.ll @@ -1,11 +1,12 @@ -; RUN: llc -march=mips -mcpu=mips32 -asm-show-inst < %s | FileCheck %s --check-prefix=MIPS32 -; RUN: llc -march=mips -mcpu=mips32r2 -mattr=+fp64 -asm-show-inst < %s | FileCheck %s --check-prefix=MIPS32FP64 -; RUN: llc -march=mips -mcpu=mips32r3 -mattr=+micromips -asm-show-inst < %s | FileCheck %s --check-prefix=MM -; RUN: llc -march=mips -mcpu=mips32r3 -mattr=+micromips,+fp64 -asm-show-inst < %s | FileCheck %s --check-prefix=MMFP64 -; RUN: llc -march=mips -mcpu=mips32r6 -mattr=+micromips -asm-show-inst < %s | FileCheck %s --check-prefix=MMR6 +; RUN: llc -march=mips -mcpu=mips32 -asm-show-inst < %s | FileCheck %s --check-prefix=MIPS32 +; RUN: llc -march=mips -mcpu=mips32r2 -mattr=+abs2008,+fp64 -asm-show-inst < %s | FileCheck %s --check-prefix=MIPS32FP64 +; RUN: llc -march=mips -mcpu=mips32r3 -mattr=+abs2008,+micromips -asm-show-inst < %s | FileCheck %s --check-prefix=MM +; RUN: llc -march=mips -mcpu=mips32r3 -mattr=+abs2008,+micromips,+fp64 -asm-show-inst < %s | FileCheck %s --check-prefix=MMFP64 +; RUN: llc -march=mips -mcpu=mips32r6 -mattr=+micromips -asm-show-inst < %s | FileCheck %s --check-prefix=MMR6 define float @abs_s(float %a) { -; MIPS32: abs.s {{.*}} # <MCInst #{{[0-9]+}} FABS_S +; MIPS32: {{(ori|ins)}} +; MIPS32-NOT: abs.s ; MIPS32FP64: abs.s {{.*}} # <MCInst #{{[0-9]+}} FABS_S ; MM: abs.s {{.*}} # <MCInst #{{[0-9]+}} FABS_S_MM ; MMFP64: abs.s {{.*}} # <MCInst #{{[0-9]+}} FABS_S_MM @@ -15,7 +16,8 @@ define float @abs_s(float %a) { } define double @abs_d(double %a) { -; MIPS32: abs.d {{.*}} # <MCInst #{{[0-9]+}} FABS_D32 +; MIPS32: {{(ori|ins|dsll)}} +; MIPS32-NOT: abs.d ; MIPS32FP64: abs.d {{.*}} # <MCInst #{{[0-9]+}} FABS_D64 ; MM: abs.d {{.*}} # <MCInst #{{[0-9]+}} FABS_D32_MM ; MMFP64: abs.d {{.*}} # <MCInst #{{[0-9]+}} FABS_D64_MM diff --git a/llvm/test/CodeGen/Mips/msa/f16-llvm-ir.ll b/llvm/test/CodeGen/Mips/msa/f16-llvm-ir.ll index 8544a75c50a..3c1aa8b4792 100644 --- a/llvm/test/CodeGen/Mips/msa/f16-llvm-ir.ll +++ b/llvm/test/CodeGen/Mips/msa/f16-llvm-ir.ll @@ -1,11 +1,11 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py -; RUN: llc -relocation-model=pic -mtriple=mipsel-- -mcpu=mips32r5 \ +; RUN: llc -relocation-model=pic -mtriple=mipsel-- -mcpu=mips32r5 -mattr=+abs2008 \ ; RUN: -mattr=+fp64,+msa -verify-machineinstrs -mips-jalr-reloc=false < %s | FileCheck %s \ ; RUN: --check-prefixes=ALL,MIPS32,MIPSR5,MIPS32-O32,MIPS32R5-O32 -; RUN: llc -relocation-model=pic -mtriple=mips64el-- -mcpu=mips64r5 \ +; RUN: llc -relocation-model=pic -mtriple=mips64el-- -mcpu=mips64r5 -mattr=+abs2008 \ ; RUN: -mattr=+fp64,+msa -verify-machineinstrs -target-abi n32 -mips-jalr-reloc=false < %s | FileCheck %s \ ; RUN: --check-prefixes=ALL,MIPS64,MIPSR5,MIPS64-N32,MIPS64R5-N32 -; RUN: llc -relocation-model=pic -mtriple=mips64el-- -mcpu=mips64r5 \ +; RUN: llc -relocation-model=pic -mtriple=mips64el-- -mcpu=mips64r5 -mattr=+abs2008 \ ; RUN: -mattr=+fp64,+msa -verify-machineinstrs -target-abi n64 -mips-jalr-reloc=false < %s | FileCheck %s \ ; RUN: --check-prefixes=ALL,MIPS64,MIPSR5,MIPS64-N64,MIPS64R5-N64 |

