llvm/test/CodeGen/NVPTX/fcos-no-fast-math.ll
Artem Belevich e41bb16926 [NVPTX] Only lower sin/cos to approximate instructions if unsafe math is allowed.
Previously we'd always lower @llvm.{sin,cos}.f32 to {sin.cos}.approx.f32
instruction even when unsafe FP math was not allowed.

Clang-generated IR is not affected by this as it uses precise sin/cos
from CUDA's libdevice when unsafe math is disabled.

Differential Revision: https://reviews.llvm.org/D28619

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291936 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-13 18:48:13 +00:00

15 lines
413 B
LLVM

; RUN: not llc < %s -march=nvptx -mcpu=sm_20 2>&1 | FileCheck %s
; Check that we fail to select fcos without fast-math enabled
declare float @llvm.cos.f32(float)
; CHECK: LLVM ERROR: Cannot select: {{.*}}: f32 = fcos
; CHECK: In function: test_fcos_safe
define float @test_fcos_safe(float %a) #0 {
%r = tail call float @llvm.cos.f32(float %a)
ret float %r
}
attributes #0 = { "unsafe-fp-math" = "false" }