gimple *
find_bswap_or_nop (gimple *stmt, struct symbolic_number *n, bool *bswap)
{
+ tree type_size = TYPE_SIZE_UNIT (gimple_expr_type (stmt));
+ if (!tree_fits_uhwi_p (type_size))
+ return NULL;
+
/* The last parameter determines the depth search limit. It usually
correlates directly to the number n of bytes to be touched. We
increase that number by 2 * (log2(n) + 1) here in order to also
cover signed -> unsigned conversions of the src operand as can be seen
in libgcc, and for initial shift/and operation of the src operand. */
- int limit = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (gimple_expr_type (stmt)));
+ int limit = tree_to_uhwi (type_size);
limit += 2 * (1 + (int) ceil_log2 ((unsigned HOST_WIDE_INT) limit));
gimple *ins_stmt = find_bswap_or_nop_1 (stmt, n, limit);
--- /dev/null
+/* { dg-options "-O2" } */
+
+#include <arm_sve.h>
+
+static svbool_t visinf_vo_vf(svfloat32_t d)
+{
+ return svcmpeq_n_f32 (svptrue_b8 (),
+ svabs_f32_x (svptrue_b8 (), d),
+ __builtin_inff ());
+}
+
+const svint32_t _ZGVsNxv_ilogbf(svfloat32_t d)
+{
+ svint32_t e = svreinterpret_s32_f32 (svdup_n_f32 (0.0f));
+ e = svsel_s32 (svcmpne_f32 (svptrue_b8(), d, d),
+ svdup_n_s32 (2147483647),
+ e);
+ e = svsel_s32 (visinf_vo_vf (d),
+ svdup_n_s32 (0x7fffffff),
+ e);
+ return e;
+}