From 21cebf90b6547434d1ccb3f09287d02c1e8d2004 Mon Sep 17 00:00:00 2001 From: Kyrylo Tkachov Date: Tue, 16 Oct 2018 17:28:56 +0000 Subject: [PATCH] [AArch64] Use @ pattern to eliminate switch statement in one more place We can use the new '@' modifier to MD patterns to generate mode-parametrised gen_ functions for the despeculate_copy patterns and therefore remove the switch on modes in aarch64.c that is used to pick the right generator. This simplifies the code. * config/aarch64/aarch64.md (despeculate_copy): Rename to... (@despeculate_copy): ... This. * config/aarch64/aarch64.c (aarch64_speculation_safe_value): Remove switch statement. From-SVN: r265210 --- gcc/ChangeLog | 8 ++++++++ gcc/config/aarch64/aarch64.c | 21 +-------------------- gcc/config/aarch64/aarch64.md | 2 +- 3 files changed, 10 insertions(+), 21 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index dfcc0d38b6b..b398d1bef1f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2018-10-16 Kyrylo Tkachov + + * config/aarch64/aarch64.md (despeculate_copy): + Rename to... + (@despeculate_copy): ... This. + * config/aarch64/aarch64.c (aarch64_speculation_safe_value): Remove + switch statement. + 2018-10-16 Rainer Orth * config.gcc: Obsolete *-*-solaris2.10*. diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 4c779082665..54f57463e97 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -17969,26 +17969,7 @@ aarch64_speculation_safe_value (machine_mode mode, if (!aarch64_reg_or_zero (failval, mode)) failval = copy_to_mode_reg (mode, failval); - switch (mode) - { - case E_QImode: - emit_insn (gen_despeculate_copyqi (result, val, failval)); - break; - case E_HImode: - emit_insn (gen_despeculate_copyhi (result, val, failval)); - break; - case E_SImode: - emit_insn (gen_despeculate_copysi (result, val, failval)); - break; - case E_DImode: - emit_insn (gen_despeculate_copydi (result, val, failval)); - break; - case E_TImode: - emit_insn (gen_despeculate_copyti (result, val, failval)); - break; - default: - gcc_unreachable (); - } + emit_insn (gen_despeculate_copy (mode, result, val, failval)); return result; } diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md index 58e9962ae24..d7473418a8e 100644 --- a/gcc/config/aarch64/aarch64.md +++ b/gcc/config/aarch64/aarch64.md @@ -6716,7 +6716,7 @@ ;; Support for __builtin_speculation_safe_value when we have speculation ;; tracking enabled. Use the speculation tracker to decide whether to ;; copy operand 1 to the target, or to copy the fail value (operand 2). -(define_expand "despeculate_copy" +(define_expand "@despeculate_copy" [(set (match_operand:ALLI_TI 0 "register_operand" "=r") (unspec_volatile:ALLI_TI [(match_operand:ALLI_TI 1 "register_operand" "r") -- 2.30.2