1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 03:23:01 +02:00
llvm-mirror/test/CodeGen/NVPTX/fsin-no-fast-math.ll
Artem Belevich f0d4a0534b [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

llvm-svn: 291936
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 fsin without fast-math enabled
declare float @llvm.sin.f32(float)
; CHECK: LLVM ERROR: Cannot select: {{.*}}: f32 = fsin
; CHECK: In function: test_fsin_safe
define float @test_fsin_safe(float %a) #0 {
%r = tail call float @llvm.sin.f32(float %a)
ret float %r
}
attributes #0 = { "unsafe-fp-math" = "false" }