Skip to content

Commit 6d1267e

Browse files
authored
Merge pull request #158 from sx-aurora-dev/merge/vp-fneg
Merge/vp fneg
2 parents 316b9ef + 3614f07 commit 6d1267e

File tree

3 files changed

+61
-12
lines changed

3 files changed

+61
-12
lines changed

llvm/docs/LangRef.rst

Lines changed: 53 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18644,7 +18644,7 @@ operation.
1864418644
Semantics:
1864518645
""""""""""
1864618646

18647-
The '``llvm.vp.fadd``' intrinsic performs floating-point addition (:ref:`add <i_fadd>`)
18647+
The '``llvm.vp.fadd``' intrinsic performs floating-point addition (:ref:`fadd <i_fadd>`)
1864818648
of the first and second vector operand on each enabled lane. The result on
1864918649
disabled lanes is undefined. The operation is performed in the default
1865018650
floating-point environment.
@@ -18693,7 +18693,7 @@ operation.
1869318693
Semantics:
1869418694
""""""""""
1869518695

18696-
The '``llvm.vp.fsub``' intrinsic performs floating-point subtraction (:ref:`add <i_fsub>`)
18696+
The '``llvm.vp.fsub``' intrinsic performs floating-point subtraction (:ref:`fsub <i_fsub>`)
1869718697
of the first and second vector operand on each enabled lane. The result on
1869818698
disabled lanes is undefined. The operation is performed in the default
1869918699
floating-point environment.
@@ -18742,7 +18742,7 @@ operation.
1874218742
Semantics:
1874318743
""""""""""
1874418744

18745-
The '``llvm.vp.fmul``' intrinsic performs floating-point multiplication (:ref:`add <i_fmul>`)
18745+
The '``llvm.vp.fmul``' intrinsic performs floating-point multiplication (:ref:`fmul <i_fmul>`)
1874618746
of the first and second vector operand on each enabled lane. The result on
1874718747
disabled lanes is undefined. The operation is performed in the default
1874818748
floating-point environment.
@@ -18791,7 +18791,7 @@ operation.
1879118791
Semantics:
1879218792
""""""""""
1879318793

18794-
The '``llvm.vp.fdiv``' intrinsic performs floating-point division (:ref:`add <i_fdiv>`)
18794+
The '``llvm.vp.fdiv``' intrinsic performs floating-point division (:ref:`fdiv <i_fdiv>`)
1879518795
of the first and second vector operand on each enabled lane. The result on
1879618796
disabled lanes is undefined. The operation is performed in the default
1879718797
floating-point environment.
@@ -18840,7 +18840,7 @@ operation.
1884018840
Semantics:
1884118841
""""""""""
1884218842

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

1886218910
'``llvm.vp.fma.*``' Intrinsics

llvm/include/llvm/IR/Intrinsics.td

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1655,6 +1655,11 @@ let IntrProperties =
16551655
LLVMMatchType<0>,
16561656
LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>,
16571657
llvm_i32_ty]>;
1658+
def int_vp_fneg : DefaultAttrsIntrinsic<[ llvm_anyvector_ty ],
1659+
[ LLVMMatchType<0>,
1660+
LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>,
1661+
llvm_i32_ty]>;
1662+
16581663
def int_vp_fma : DefaultAttrsIntrinsic<[ llvm_anyvector_ty ],
16591664
[ LLVMMatchType<0>,
16601665
LLVMMatchType<0>,
@@ -1691,12 +1696,6 @@ def int_vp_compress: Intrinsic<[ llvm_anyvector_ty ],
16911696

16921697

16931698
// VP standard fp-math intrinsics.
1694-
def int_vp_fneg : Intrinsic<[ llvm_anyvector_ty ],
1695-
[ LLVMMatchType<0>,
1696-
LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>,
1697-
llvm_i32_ty],
1698-
[ IntrNoMem, IntrWillReturn]>;
1699-
17001699

17011700
def int_vp_merge : DefaultAttrsIntrinsic<[ llvm_anyvector_ty ],
17021701
[ LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>,

llvm/unittests/IR/VPIntrinsicTest.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,10 @@ 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.fneg.v8f32(<8 x float>, <8 x i1>, "
103+
"i32)";
102104
Str << " declare <8 x float> @llvm.vp.fma.v8f32(<8 x float>, <8 x float>, "
103-
"<8 x float>, <8 x i1>, i32) ";
105+
"<8 x float>, <8 x i1>, i32) ";
104106

105107
Str << " declare void @llvm.vp.store.v8i32.p0v8i32(<8 x i32>, <8 x i32>*, "
106108
"<8 x i1>, i32) ";

0 commit comments

Comments
 (0)