summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/AMDGPU/GlobalISel/irtranslator-fast-math-flags.ll
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2019-06-17 23:48:43 +0000
committerMatt Arsenault <Matthew.Arsenault@amd.com>2019-06-17 23:48:43 +0000
commit5a321b899e7a10b45c3ee4003fb2a048f35074a9 (patch)
treeef7f04552525c95db5ad398c5956c71ddb8b833d /llvm/test/CodeGen/AMDGPU/GlobalISel/irtranslator-fast-math-flags.ll
parentd57f7cc15e22888773d3ad663160ccc66fc7656b (diff)
downloadbcm5719-llvm-5a321b899e7a10b45c3ee4003fb2a048f35074a9.tar.gz
bcm5719-llvm-5a321b899e7a10b45c3ee4003fb2a048f35074a9.zip
GlobalISel: Use the original flags when lowering fneg to fsub
This was ignoring the flag on fneg, and using the source instruction's flags. Also fixes tests missing from r358702. Note the expansion itself isn't correct without nnan, but that should be fixed separately. llvm-svn: 363637
Diffstat (limited to 'llvm/test/CodeGen/AMDGPU/GlobalISel/irtranslator-fast-math-flags.ll')
-rw-r--r--llvm/test/CodeGen/AMDGPU/GlobalISel/irtranslator-fast-math-flags.ll31
1 files changed, 31 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/AMDGPU/GlobalISel/irtranslator-fast-math-flags.ll b/llvm/test/CodeGen/AMDGPU/GlobalISel/irtranslator-fast-math-flags.ll
new file mode 100644
index 00000000000..dc660bfca29
--- /dev/null
+++ b/llvm/test/CodeGen/AMDGPU/GlobalISel/irtranslator-fast-math-flags.ll
@@ -0,0 +1,31 @@
+; RUN: llc -march=amdgcn -mcpu=fiji -O0 -stop-after=irtranslator -global-isel %s -o - | FileCheck %s
+
+; Check flags are preserved for a regular instruction.
+; CHECK-LABEL: name: fadd_nnan
+; CHECK: nnan G_FADD
+define amdgpu_kernel void @fadd_nnan(float %arg0, float %arg1) {
+ %res = fadd nnan float %arg0, %arg1
+ store float %res, float addrspace(1)* undef
+ ret void
+}
+
+; Check flags are preserved for a specially handled intrinsic
+; CHECK-LABEL: name: fma_fast
+; CHECK: nnan ninf nsz arcp contract afn reassoc G_FMA
+define amdgpu_kernel void @fma_fast(float %arg0, float %arg1, float %arg2) {
+ %res = call fast float @llvm.fma.f32(float %arg0, float %arg1, float %arg2)
+ store float %res, float addrspace(1)* undef
+ ret void
+}
+
+; Check flags are preserved for an arbitrarry target intrinsic
+; CHECK-LABEL: name: rcp_nsz
+; CHECK: = nsz G_INTRINSIC intrinsic(@llvm.amdgcn.rcp), %8(s32)
+define amdgpu_kernel void @rcp_nsz(float %arg0) {
+ %res = call nsz float @llvm.amdgcn.rcp.f32 (float %arg0)
+ store float %res, float addrspace(1)* undef
+ ret void
+}
+
+declare float @llvm.fma.f32(float, float, float)
+declare float @llvm.amdgcn.rcp.f32(float)
OpenPOWER on IntegriCloud