static void aarch64_elf_asm_constructor (rtx, int) ATTRIBUTE_UNUSED;
static void aarch64_elf_asm_destructor (rtx, int) ATTRIBUTE_UNUSED;
static void aarch64_override_options_after_change (void);
-static int aarch64_simd_valid_immediate (rtx, enum machine_mode, int, rtx *,
+static bool aarch64_simd_valid_immediate (rtx, enum machine_mode, int, rtx *,
int *, unsigned char *, int *, int *);
static bool aarch64_vector_mode_supported_p (enum machine_mode);
static unsigned bit_count (unsigned HOST_WIDE_INT);
we now decompose CONST_INTs according to expand_mov_immediate. */
if ((GET_CODE (x) == CONST_VECTOR
&& aarch64_simd_valid_immediate (x, mode, false,
- NULL, NULL, NULL, NULL, NULL) != -1)
+ NULL, NULL, NULL, NULL, NULL))
|| CONST_INT_P (x) || aarch64_valid_floating_const (mode, x))
return !targetm.cannot_force_const_mem (mode, x);
return aarch64_float_const_representable_p (x0);
}
-/* TODO: This function returns values similar to those
- returned by neon_valid_immediate in gcc/config/arm/arm.c
- but the API here is different enough that these magic numbers
- are not used. It should be sufficient to return true or false. */
-static int
+/* Return true for valid and false for invalid. */
+static bool
aarch64_simd_valid_immediate (rtx op, enum machine_mode mode, int inverse,
rtx *modconst, int *elementwidth,
unsigned char *elementchar,
if (!(simd_imm_zero
|| aarch64_vect_float_const_representable_p (op)))
- return -1;
+ return false;
- if (modconst)
- *modconst = CONST_VECTOR_ELT (op, 0);
+ if (modconst)
+ *modconst = CONST_VECTOR_ELT (op, 0);
- if (elementwidth)
- *elementwidth = elem_width;
+ if (elementwidth)
+ *elementwidth = elem_width;
- if (elementchar)
- *elementchar = sizetochar (elem_width);
+ if (elementchar)
+ *elementchar = sizetochar (elem_width);
- if (shift)
- *shift = 0;
+ if (shift)
+ *shift = 0;
- if (simd_imm_zero)
- return 19;
- else
- return 18;
+ return true;
}
/* Splat vector constant out into a byte vector. */
if (immtype == -1
|| (immtype >= 12 && immtype <= 15)
|| immtype == 18)
- return -1;
+ return false;
if (elementwidth)
}
}
- return immtype;
+ return (immtype >= 0);
#undef CHECK
}
int tmpwidth;
unsigned char tmpwidthc;
int tmpmvn = 0, tmpshift = 0;
- int retval = aarch64_simd_valid_immediate (op, mode, 0, &tmpconst,
+ bool retval = aarch64_simd_valid_immediate (op, mode, 0, &tmpconst,
&tmpwidth, &tmpwidthc,
&tmpmvn, &tmpshift);
- if (retval == -1)
+ if (!retval)
return 0;
if (modconst)