diff options
author | Iain Buclaw <ibuclaw@gdcproject.org> | 2022-11-05 19:32:17 +0100 |
---|---|---|
committer | Iain Buclaw <ibuclaw@gdcproject.org> | 2022-11-05 19:47:16 +0100 |
commit | 3c28d6a3a018e9acb7af1422d6263661f69d5f94 (patch) | |
tree | dbf38ada050ca3502eacc0ae91c0a729b2a91c14 /libphobos/libdruntime | |
parent | 3ad2167bbac8ae83b1e91305b105ab5287bdac55 (diff) | |
download | gcc-3c28d6a3a018e9acb7af1422d6263661f69d5f94.zip gcc-3c28d6a3a018e9acb7af1422d6263661f69d5f94.tar.gz gcc-3c28d6a3a018e9acb7af1422d6263661f69d5f94.tar.bz2 |
d: Add support for vector comparison operators
The front-end added semantic support to permit comparing two vector
expressions. This removes the restriction in the code generator, as
well as the intrisics that previously exposed the same operation.
gcc/d/ChangeLog:
* d-target.cc (Target::isVectorOpSupported): Remove cases for
comparison operators.
* intrinsics.cc (maybe_set_intrinsic): Remove cases for vector
comparison intrinsics.
(maybe_warn_intrinsic_mismatch): Likewise.
(expand_intrinsic_vec_cond): Remove.
(maybe_expand_intrinsic): Remove cases for vector comparison
intrinsics.
* intrinsics.def (INTRINSIC_EQUALMASK): Remove.
(INTRINSIC_NOTEQUALMASK): Remove.
(INTRINSIC_GREATERMASK): Remove.
(INTRINSIC_GREATEREQUALMASK): Remove.
libphobos/ChangeLog:
* libdruntime/gcc/simd.d (equalMask): Implement using generics.
(notEqualMask): Likewise.
(greaterMask): Likewise.
(greaterOrEqualMask): Likewise.
(notMask): Likewise.
(andAndMask): Likewise.
(orOrMask): Likewise.
gcc/testsuite/ChangeLog:
* gdc.dg/Wbuiltin_declaration_mismatch2.d: Remove comparision tests.
* gdc.dg/simd2a.d: Update comparison tests.
* gdc.dg/simd2b.d: Likewise.
* gdc.dg/simd2c.d: Likewise.
* gdc.dg/simd2d.d: Likewise.
* gdc.dg/simd2e.d: Likewise.
* gdc.dg/simd2f.d: Likewise.
* gdc.dg/simd2g.d: Likewise.
* gdc.dg/simd2h.d: Likewise.
* gdc.dg/simd2i.d: Likewise.
* gdc.dg/simd2j.d: Likewise.
Diffstat (limited to 'libphobos/libdruntime')
-rw-r--r-- | libphobos/libdruntime/gcc/simd.d | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/libphobos/libdruntime/gcc/simd.d b/libphobos/libdruntime/gcc/simd.d index ffca50f..ebd94bf 100644 --- a/libphobos/libdruntime/gcc/simd.d +++ b/libphobos/libdruntime/gcc/simd.d @@ -306,13 +306,25 @@ template blendvector(V0, V1, M) * assert(c.array == [0, 0, -1, -1]); * --- */ -V equalMask(V)(V op1, V op2) if (isVectorType!V); +V equalMask(V)(V op1, V op2) if (isVectorType!V) +{ + return op1 == op2; +} /// Ditto -V notEqualMask(V)(V op1, V op2) if (isVectorType!V); +V notEqualMask(V)(V op1, V op2) if (isVectorType!V) +{ + return op1 != op2; +} /// Ditto -V greaterMask(V)(V op1, V op2) if (isVectorType!V); +V greaterMask(V)(V op1, V op2) if (isVectorType!V) +{ + return op1 > op2; +} /// Ditto -V greaterOrEqualMask(V)(V op1, V op2) if (isVectorType!V); +V greaterOrEqualMask(V)(V op1, V op2) if (isVectorType!V) +{ + return op1 >= op2; +} /** * Perform an element-wise logical comparison between two vectors, producing @@ -326,19 +338,19 @@ V greaterOrEqualMask(V)(V op1, V op2) if (isVectorType!V); */ V notMask(V)(V op1) if (isVectorType!V) { - return equalMask(op1, 0); + return op1 == 0; } /// Ditto V andAndMask(V)(V op1, V op2) if (isVectorType!V) { - return notEqualMask(op1, 0) & notEqualMask(op2, 0); + return (op1 != 0) & (op2 != 0); } /// Ditto V orOrMask(V)(V op1, V op2) if (isVectorType!V) { - return notEqualMask(op1, 0) | notEqualMask(op2, 0); + return (op1 != 0) | (op2 != 0); } // Private helper templates. |