Hi all,
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.
Bootstrapped and tested on aarch64-none-linux-gnu.
Ok for trunk?
Thanks,
Kyrill
2018-10-16 Kyrylo Tkachov <[email protected]>
* 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.
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 34d08a075221fd4c098e9b5e8fabd8fe3948d285..03041c5af99e52de8f5b4d8342e93ef2b90985bc 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -17968,26 +17968,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 4170d3fbb00c733a1411e726a67af17052800307..32d6f138232c617213f0d3488db49cb3546eb0a9 100644
--- a/gcc/config/aarch64/aarch64.md
+++ b/gcc/config/aarch64/aarch64.md
@@ -6743,7 +6743,7 @@ (define_insn "speculation_barrier"
;; 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")