14 changes: 13 additions & 1 deletion llvm/test/CodeGen/X86/fmf-propagation.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; REQUIRES: asserts
; RUN: llc -mtriple=x86_64-unknown-unknown -debug-only=isel < %s -o /dev/null 2>&1 | FileCheck %s
; RUN: llc -mtriple=x86_64-unknown-unknown -mattr=avx512f -debug-only=isel < %s -o /dev/null 2>&1 | FileCheck %s

; This tests the propagation of fast-math-flags from IR instructions to SDNodeFlags.

Expand Down Expand Up @@ -44,3 +44,15 @@ define float @fmf_setcc_canon(float %x, float %y) {
%ret = select i1 %cmp, float %x, float %y
ret float %ret
}

declare <16 x float> @llvm.x86.avx512.vfmadd.ps.512(<16 x float>, <16 x float>, <16 x float>, i32)

; CHECK-LABEL: Initial selection DAG: %bb.0 'fmf_target_intrinsic:'
; CHECK: v16f32 = llvm.x86.avx512.vfmadd.ps.512 TargetConstant:i64<9546>
; CHECK: v16f32 = llvm.x86.avx512.vfmadd.ps.512 TargetConstant:i64<9546>

define <16 x float> @fmf_target_intrinsic(<16 x float> %a, <16 x float> %b, <16 x float> %c) nounwind {
%t0 = tail call ninf nsz <16 x float> @llvm.x86.avx512.vfmadd.ps.512(<16 x float> %a, <16 x float> %b, <16 x float> %c, i32 4)
%t1 = tail call nsz <16 x float> @llvm.x86.avx512.vfmadd.ps.512(<16 x float> %t0, <16 x float> %b, <16 x float> %c, i32 4)
ret <16 x float> %t1
}