[AArch64] Use @ pattern to eliminate switch statement in one more place
authorKyrylo Tkachov <kyrylo.tkachov@arm.com>
Tue, 16 Oct 2018 17:28:56 +0000 (17:28 +0000)
committerKyrylo Tkachov <ktkachov@gcc.gnu.org>
Tue, 16 Oct 2018 17:28:56 +0000 (17:28 +0000)
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<ALLI_TI:mode>):
Rename to...
(@despeculate_copy<ALLI_TI:mode>): ... This.
* config/aarch64/aarch64.c (aarch64_speculation_safe_value): Remove
switch statement.

From-SVN: r265210

gcc/ChangeLog
gcc/config/aarch64/aarch64.c
gcc/config/aarch64/aarch64.md

index dfcc0d38b6be1c1509221ea8a0a4ef09a71d498d..b398d1bef1fce160e13eb6d2925c33f572fce2a7 100644 (file)
@@ -1,3 +1,11 @@
+2018-10-16  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
+
+       * config/aarch64/aarch64.md (despeculate_copy<ALLI_TI:mode>):
+       Rename to...
+       (@despeculate_copy<ALLI_TI:mode>): ... This.
+       * config/aarch64/aarch64.c (aarch64_speculation_safe_value): Remove
+       switch statement.
+
 2018-10-16  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
        * config.gcc: Obsolete *-*-solaris2.10*.
index 4c7790826658539f71f2fd9eb9ea0329081938be..54f57463e97fabade59b7fa097594dd8735d58d5 100644 (file)
@@ -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;
 }
 
index 58e9962ae249518b3786b295e4690df9ac326bc3..d7473418a8eb62b2757017cd1675493f86e41ef4 100644 (file)
 ;; 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<ALLI_TI:mode>"
+(define_expand "@despeculate_copy<ALLI_TI:mode>"
   [(set (match_operand:ALLI_TI 0 "register_operand" "=r")
        (unspec_volatile:ALLI_TI
         [(match_operand:ALLI_TI 1 "register_operand" "r")