Skip to content

Commit 5988a66

Browse files
author
Simon Moll
committed
Merge commit 'cef177d186a4de200a8246d0382ae804b968d63b' into merge/vp-fma
2 parents ab74a16 + cef177d commit 5988a66

File tree

4 files changed

+57
-10
lines changed

4 files changed

+57
-10
lines changed

llvm/docs/LangRef.rst

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18857,6 +18857,54 @@ Examples:
1885718857
%also.r = select <4 x i1> %mask, <4 x float> %t, <4 x float> undef
1885818858

1885918859

18860+
.. _int_vp_fma:
18861+
18862+
'``llvm.vp.fma.*``' Intrinsics
18863+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
18864+
18865+
Syntax:
18866+
"""""""
18867+
This is an overloaded intrinsic.
18868+
18869+
::
18870+
18871+
declare <16 x float> @llvm.vp.fma.v16f32 (<16 x float> <left_op>, <16 x float> <middle_op>, <16 x float> <right_op>, <16 x i1> <mask>, i32 <vector_length>)
18872+
declare <vscale x 4 x float> @llvm.vp.fma.nxv4f32 (<vscale x 4 x float> <left_op>, <vscale x 4 x float> <middle_op>, <vscale x 4 x float> <right_op>, <vscale x 4 x i1> <mask>, i32 <vector_length>)
18873+
declare <256 x double> @llvm.vp.fma.v256f64 (<256 x double> <left_op>, <256 x double> <middle_op>, <256 x double> <right_op>, <256 x i1> <mask>, i32 <vector_length>)
18874+
18875+
Overview:
18876+
"""""""""
18877+
18878+
Predicated floating-point fused multiply-add of two vectors of floating-point values.
18879+
18880+
18881+
Arguments:
18882+
""""""""""
18883+
18884+
The first three operands and the result have the same vector of floating-point type. The
18885+
fourth operand is the vector mask and has the same number of elements as the
18886+
result vector type. The fifth operand is the explicit vector length of the
18887+
operation.
18888+
18889+
Semantics:
18890+
""""""""""
18891+
18892+
The '``llvm.vp.fma``' intrinsic performs floating-point fused multiply-add (:ref:`llvm.fma <int_fma>`)
18893+
of the first, second, and third vector operand on each enabled lane. The result on
18894+
disabled lanes is undefined. The operation is performed in the default
18895+
floating-point environment.
18896+
18897+
Examples:
18898+
"""""""""
18899+
18900+
.. code-block:: llvm
18901+
18902+
%r = call <4 x float> @llvm.vp.fma.v4f32(<4 x float> %a, <4 x float> %b, <4 x float> %c, <4 x i1> %mask, i32 %evl)
18903+
;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
18904+
18905+
%t = call <4 x float> @llvm.fma(<4 x float> %a, <4 x float> %b, <4 x float> %c)
18906+
%also.r = select <4 x i1> %mask, <4 x float> %t, <4 x float> undef
18907+
1886018908

1886118909
.. _int_vp_reduce_add:
1886218910

llvm/include/llvm/IR/Intrinsics.td

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1655,6 +1655,12 @@ let IntrProperties =
16551655
LLVMMatchType<0>,
16561656
LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>,
16571657
llvm_i32_ty]>;
1658+
def int_vp_fma : DefaultAttrsIntrinsic<[ llvm_anyvector_ty ],
1659+
[ LLVMMatchType<0>,
1660+
LLVMMatchType<0>,
1661+
LLVMMatchType<0>,
1662+
LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>,
1663+
llvm_i32_ty]>;
16581664
}
16591665
// Shuffles.
16601666
def int_vp_select : DefaultAttrsIntrinsic<[ llvm_anyvector_ty ],
@@ -1691,14 +1697,6 @@ def int_vp_fneg : Intrinsic<[ llvm_anyvector_ty ],
16911697
llvm_i32_ty],
16921698
[ IntrNoMem, IntrWillReturn]>;
16931699

1694-
def int_vp_fma : Intrinsic<[ llvm_anyvector_ty ],
1695-
[ LLVMMatchType<0>,
1696-
LLVMMatchType<0>,
1697-
LLVMMatchType<0>,
1698-
LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>,
1699-
llvm_i32_ty ],
1700-
[ IntrNoMem, IntrNoSync, IntrWillReturn]>;
1701-
17021700

17031701
def int_vp_merge : DefaultAttrsIntrinsic<[ llvm_anyvector_ty ],
17041702
[ LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>,

llvm/include/llvm/IR/VPIntrinsics.def

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,6 @@ VP_PROPERTY_CONSTRAINEDFP(1, 0, not_intrinsic) // experimental_constrained_fneg
280280
VP_PROPERTY_UNARYOP
281281
END_REGISTER_VP(vp_fneg, VP_FNEG)
282282

283-
284-
285283
// llvm.vp.fma(x,y,z,mask,vlen)
286284
BEGIN_REGISTER_VP(vp_fma, 3, 4, VP_FMA, -1)
287285
VP_PROPERTY_CONSTRAINEDFP(1, 1, experimental_constrained_fma)

llvm/unittests/IR/VPIntrinsicTest.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ class VPIntrinsicTest : public testing::Test {
9999
Str << " declare <8 x float> @llvm.vp." << BinaryFPOpcode
100100
<< ".v8f32(<8 x float>, <8 x float>, <8 x i1>, i32) ";
101101

102+
Str << " declare <8 x float> @llvm.vp.fma.v8f32(<8 x float>, <8 x float>, "
103+
"<8 x float>, <8 x i1>, i32) ";
104+
102105
Str << " declare void @llvm.vp.store.v8i32.p0v8i32(<8 x i32>, <8 x i32>*, "
103106
"<8 x i1>, i32) ";
104107
Str << " declare void @llvm.vp.scatter.v8i32.v8p0i32(<8 x i32>, <8 x "

0 commit comments

Comments
 (0)