+2019-11-19 Richard Henderson <richard.henderson@linaro.org>
+
+ * config/arm/arm-c.c (arm_cpu_builtins): Use def_or_undef_macro
+ to define __GCC_ASM_FLAG_OUTPUTS__.
+ * config/arm/arm.c (thumb1_md_asm_adjust): New function.
+ (arm_option_params_internal): Swap out targetm.md_asm_adjust
+ depending on TARGET_THUMB1.
+ * doc/extend.texi (FlagOutputOperands): Document thumb1 restriction.
+
2019-11-19 Jakub Jelinek <jakub@redhat.com>
PR target/92549
if (arm_arch_notm)
builtin_define ("__ARM_ARCH_ISA_ARM");
builtin_define ("__APCS_32__");
- builtin_define ("__GCC_ASM_FLAG_OUTPUTS__");
+
+ def_or_undef_macro (pfile, "__GCC_ASM_FLAG_OUTPUTS__", !TARGET_THUMB1);
def_or_undef_macro (pfile, "__thumb__", TARGET_THUMB);
def_or_undef_macro (pfile, "__thumb2__", TARGET_THUMB2);
static bool arm_hard_regno_mode_ok (unsigned int, machine_mode);
static bool arm_modes_tieable_p (machine_mode, machine_mode);
static HOST_WIDE_INT arm_constant_alignment (const_tree, HOST_WIDE_INT);
+static rtx_insn * thumb1_md_asm_adjust (vec<rtx> &, vec<rtx> &,
+ vec<const char *> &, vec<rtx> &,
+ HARD_REG_SET &);
\f
/* Table of machine attributes. */
static const struct attribute_spec arm_attribute_table[] =
/* For THUMB2, we limit the conditional sequence to one IT block. */
if (TARGET_THUMB2)
max_insns_skipped = MIN (max_insns_skipped, MAX_INSN_PER_IT_BLOCK);
+
+ if (TARGET_THUMB1)
+ targetm.md_asm_adjust = thumb1_md_asm_adjust;
+ else
+ targetm.md_asm_adjust = arm_md_asm_adjust;
}
/* True if -mflip-thumb should next add an attribute for the default
#define TARGET_RUN_TARGET_SELFTESTS selftest::arm_run_selftests
#endif /* CHECKING_P */
+/* Worker function for TARGET_MD_ASM_ADJUST, while in thumb1 mode.
+ Unlike the arm version, we do NOT implement asm flag outputs. */
+
+rtx_insn *
+thumb1_md_asm_adjust (vec<rtx> &outputs, vec<rtx> &/*inputs*/,
+ vec<const char *> &constraints,
+ vec<rtx> &/*clobbers*/, HARD_REG_SET &/*clobbered_regs*/)
+{
+ for (unsigned i = 0, n = outputs.length (); i < n; ++i)
+ if (strncmp (constraints[i], "=@cc", 4) == 0)
+ {
+ sorry ("asm flags not supported in thumb1 mode");
+ break;
+ }
+ return NULL;
+}
+
struct gcc_target targetm = TARGET_INITIALIZER;
#include "gt-arm.h"
signed less than equal
@end table
+The flag output constraints are not supported in thumb1 mode.
+
@item x86 family
The flag output constraints for the x86 family are of the form
@samp{=@@cc@var{cond}} where @var{cond} is one of the standard
+2019-11-19 Richard Henderson <richard.henderson@linaro.org>
+
+ * testsuite/gcc.target/arm/asm-flag-3.c: Skip for thumb1.
+ * testsuite/gcc.target/arm/asm-flag-5.c: Likewise.
+ * testsuite/gcc.target/arm/asm-flag-6.c: Likewise.
+ * testsuite/gcc.target/arm/asm-flag-4.c: New test.
+
+ * testsuite/gcc.target/aarch64/asm-flag-6.c: Use %w for
+ asm inputs to cmp instruction for ILP32.
+
2019-11-19 Jakub Jelinek <jakub@redhat.com>
PR target/92549
/* Executable testcase for 'output flags.' */
/* { dg-do run } */
+#ifdef __LP64__
+#define W ""
+#else
+#define W "w"
+#endif
+
int test_bits (long nzcv)
{
long n, z, c, v;
{
long gt, lt, ge, le;
- __asm__ ("cmp %[x], %[y]"
+ __asm__ ("cmp %"W"[x], %"W"[y]"
: "=@ccgt"(gt), "=@cclt"(lt), "=@ccge"(ge), "=@ccle"(le)
: [x] "r"(x), [y] "r"(y));
{
long gt, lt, ge, le;
- __asm__ ("cmp %[x], %[y]"
+ __asm__ ("cmp %"W"[x], %"W"[y]"
: "=@cchi"(gt), "=@cclo"(lt), "=@cchs"(ge), "=@ccls"(le)
: [x] "r"(x), [y] "r"(y));
/* Test the valid @cc<cc> asm flag outputs. */
/* { dg-do compile } */
/* { dg-options "-O" } */
+/* { dg-skip-if "" { arm_thumb1 } } */
#ifndef __GCC_ASM_FLAG_OUTPUTS__
#error "missing preprocessor define"
/* Test some of the valid @cc<cc> asm flag outputs. */
/* { dg-do compile } */
/* { dg-options "-O" } */
+/* { dg-skip-if "" { arm_thumb1 } } */
#define DO(C) \
void f##C(void) { char x; asm("" : "=@cc"#C(x)); if (!x) asm(""); asm(""); }
--- /dev/null
+/* Test that we do not ice in thumb1 mode */
+/* { dg-do compile } */
+/* { dg-options "-march=armv4t" } */
+
+void __attribute__((target("arm"))) f(char *out)
+{
+ asm("" : "=@ccne"(out[0]));
+}
+
+void __attribute__((target("thumb"))) g(char *out)
+{
+ asm("" : "=@ccne"(out[0])); /* { dg-error asm flags not supported } */
+}
/* Test error conditions of asm flag outputs. */
/* { dg-do compile } */
/* { dg-options "" } */
+/* { dg-skip-if "" { arm_thumb1 } } */
void f_B(void) { _Bool x; asm("" : "=@cccc"(x)); }
void f_c(void) { char x; asm("" : "=@cccc"(x)); }
/* Executable testcase for 'output flags.' */
/* { dg-do run } */
+/* { dg-skip-if "" { arm_thumb1 } } */
int test_bits (long nzcv)
{