1 ; RUN: llc < %s -march=nvptx64 -mcpu=sm_20 -fp-contract=fast | FileCheck %s --check-prefix=FAST
2 ; RUN: llc < %s -march=nvptx64 -mcpu=sm_30 | FileCheck %s --check-prefix=DEFAULT
3 ; RUN: %if ptxas %{ llc < %s -march=nvptx64 -mcpu=sm_20 -fp-contract=fast | %ptxas-verify %}
4 ; RUN: %if ptxas %{ llc < %s -march=nvptx64 -mcpu=sm_30 | %ptxas-verify %}
6 target triple = "nvptx64-unknown-cuda"
8 ;; Make sure we are generating proper instruction sequences for fused ops
9 ;; If fusion is allowed, we try to form fma.rn at the PTX level, and emit
10 ;; add.f32 otherwise. Without an explicit rounding mode on add.f32, ptxas
11 ;; is free to fuse with a multiply if it is able. If fusion is not allowed,
12 ;; we do not form fma.rn at the PTX level and explicitly generate add.rn
13 ;; for all adds to prevent ptxas from fusion the ops.
17 define float @t0(float %a, float %b, float %c) {
19 ;; DEFAULT: mul.rn.f32
20 ;; DEFAULT: add.rn.f32
21 %v0 = fmul float %a, %b
22 %v1 = fadd float %v0, %c
28 define float @t1(float %a, float %b) {
29 ;; We cannot form an fma here, but make sure we explicitly emit add.rn.f32
30 ;; to prevent ptxas from fusing this with anything else.
32 ;; DEFAULT: add.rn.f32
33 %v1 = fadd float %a, %b