Skip to content

Commit e0b23a9

Browse files
author
Christophe Lyon
committed
arm: [MVE intrinsics] rework vpnot
Implement vpnot using the new MVE builtins framework. gcc/ChangeLog: * config/arm/arm-mve-builtins-base.cc (class mve_function_vpnot): New. (vpnot): New. * config/arm/arm-mve-builtins-base.def (vpnot): New. * config/arm/arm-mve-builtins-base.h (vpnot): New. * config/arm/arm-mve-builtins-shapes.cc (struct vpnot): New. * config/arm/arm-mve-builtins-shapes.h (vpnot): New. * config/arm/arm_mve.h (vpnot): Delete. (__arm_vpnot): Delete.
1 parent de124ff commit e0b23a9

File tree

6 files changed

+38
-8
lines changed

6 files changed

+38
-8
lines changed

gcc/config/arm/arm-mve-builtins-base.cc

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1209,6 +1209,25 @@ class mve_function_scalar_shift : public function_base
12091209
}
12101210
};
12111211

1212+
1213+
/* Map the function directly to mve_vpnotv16bi, and convert the result into
1214+
HImode like we do for vcmp. */
1215+
class mve_function_vpnot : public function_base
1216+
{
1217+
public:
1218+
CONSTEXPR mve_function_vpnot (void)
1219+
{}
1220+
1221+
rtx
1222+
expand (function_expander &e) const override
1223+
{
1224+
rtx target = e.use_unpred_insn (CODE_FOR_mve_vpnotv16bi);
1225+
rtx HItarget = gen_reg_rtx (HImode);
1226+
emit_move_insn (HItarget, gen_lowpart (HImode, target));
1227+
return HItarget;
1228+
}
1229+
};
1230+
12121231
} /* end anonymous namespace */
12131232

12141233
namespace arm_mve {
@@ -1497,6 +1516,7 @@ FUNCTION (vmulltq_poly, unspec_mve_function_exact_insn_vmull_poly, (VMULLTQ_POLY
14971516
FUNCTION_WITH_RTX_M_N (vmulq, MULT, VMULQ)
14981517
FUNCTION_WITH_RTX_M_N_NO_F (vmvnq, NOT, VMVNQ)
14991518
FUNCTION (vnegq, unspec_based_mve_function_exact_insn, (NEG, NEG, NEG, -1, -1, -1, VNEGQ_M_S, -1, VNEGQ_M_F, -1, -1, -1))
1519+
FUNCTION (vpnot, mve_function_vpnot, )
15001520
FUNCTION_WITHOUT_M_N (vpselq, VPSELQ)
15011521
FUNCTION (vornq, unspec_based_mve_function_exact_insn_vorn, (-1, -1, VORNQ_M_S, VORNQ_M_U, VORNQ_M_F, -1, -1))
15021522
FUNCTION_WITH_RTX_M_N_NO_N_F (vorrq, IOR, VORRQ)

gcc/config/arm/arm-mve-builtins-base.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ DEF_MVE_FUNCTION (vmvnq, mvn, all_integer, mx_or_none)
115115
DEF_MVE_FUNCTION (vnegq, unary, all_signed, mx_or_none)
116116
DEF_MVE_FUNCTION (vornq, binary_orrq, all_integer, mx_or_none)
117117
DEF_MVE_FUNCTION (vorrq, binary_orrq, all_integer, mx_or_none)
118+
DEF_MVE_FUNCTION (vpnot, vpnot, none, none)
118119
DEF_MVE_FUNCTION (vpselq, vpsel, all_integer_with_64, none)
119120
DEF_MVE_FUNCTION (vqabsq, unary, all_signed, m_or_none)
120121
DEF_MVE_FUNCTION (vqaddq, binary_opt_n, all_integer, m_or_none)

gcc/config/arm/arm-mve-builtins-base.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ extern const function_base *const vmvnq;
146146
extern const function_base *const vnegq;
147147
extern const function_base *const vornq;
148148
extern const function_base *const vorrq;
149+
extern const function_base *const vpnot;
149150
extern const function_base *const vpselq;
150151
extern const function_base *const vqabsq;
151152
extern const function_base *const vqaddq;

gcc/config/arm/arm-mve-builtins-shapes.cc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2740,6 +2740,21 @@ struct vidwdup_def : public overloaded_base<0>
27402740
};
27412741
SHAPE (vidwdup)
27422742

2743+
/* mve_pred16_t foo_t0(mve_pred16_t)
2744+
2745+
Example: vpnot.
2746+
mve_pred16_t [__arm_]vpnot(mve_pred16_t a) */
2747+
struct vpnot_def : public nonoverloaded_base
2748+
{
2749+
void
2750+
build (function_builder &b, const function_group_info &group,
2751+
bool preserve_user_namespace) const override
2752+
{
2753+
build_all (b, "p,p", group, MODE_none, preserve_user_namespace);
2754+
}
2755+
};
2756+
SHAPE (vpnot)
2757+
27432758
/* <T0>_t vfoo[_t0](<T0>_t, <T0>_t, mve_pred16_t)
27442759
27452760
i.e. a version of the standard ternary shape in which

gcc/config/arm/arm-mve-builtins-shapes.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ namespace arm_mve
9292
extern const function_shape *const vcvtx;
9393
extern const function_shape *const viddup;
9494
extern const function_shape *const vidwdup;
95+
extern const function_shape *const vpnot;
9596
extern const function_shape *const vpsel;
9697
extern const function_shape *const vshlc;
9798

gcc/config/arm/arm_mve.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
#define vgetq_lane(__a, __idx) __arm_vgetq_lane(__a, __idx)
5151

5252

53-
#define vpnot(__a) __arm_vpnot(__a)
5453
#define vuninitializedq_u8(void) __arm_vuninitializedq_u8(void)
5554
#define vuninitializedq_u16(void) __arm_vuninitializedq_u16(void)
5655
#define vuninitializedq_u32(void) __arm_vuninitializedq_u32(void)
@@ -109,13 +108,6 @@
109108
__builtin_arm_lane_check (__ARM_NUM_LANES(__vec), \
110109
__ARM_LANEQ(__vec, __idx))
111110

112-
__extension__ extern __inline mve_pred16_t
113-
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
114-
__arm_vpnot (mve_pred16_t __a)
115-
{
116-
return __builtin_mve_vpnotv16bi (__a);
117-
}
118-
119111
__extension__ extern __inline int16x8_t
120112
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
121113
__arm_vsetq_lane_s16 (int16_t __a, int16x8_t __b, const int __idx)

0 commit comments

Comments
 (0)