1//=- AArch64.td - Define AArch64 Combine Rules ---------------*- tablegen -*-=// 2// 3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4// See https://llvm.org/LICENSE.txt for license information. 5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6// 7//===----------------------------------------------------------------------===// 8// 9// 10//===----------------------------------------------------------------------===// 11 12include "llvm/Target/GlobalISel/Combine.td" 13 14def fconstant_to_constant : GICombineRule< 15 (defs root:$root), 16 (match (wip_match_opcode G_FCONSTANT):$root, 17 [{ return matchFConstantToConstant(*${root}, MRI); }]), 18 (apply [{ applyFConstantToConstant(*${root}); }])>; 19 20def AArch64PreLegalizerCombinerHelper: GICombinerHelper< 21 "AArch64GenPreLegalizerCombinerHelper", [all_combines, 22 elide_br_by_inverting_cond, 23 fconstant_to_constant]> { 24 let DisableRuleOption = "aarch64prelegalizercombiner-disable-rule"; 25 let StateClass = "AArch64PreLegalizerCombinerHelperState"; 26 let AdditionalArguments = []; 27} 28 29// Matchdata for combines which replace a G_SHUFFLE_VECTOR with a 30// target-specific opcode. 31def shuffle_matchdata : GIDefMatchData<"ShuffleVectorPseudo">; 32 33def rev : GICombineRule< 34 (defs root:$root, shuffle_matchdata:$matchinfo), 35 (match (wip_match_opcode G_SHUFFLE_VECTOR):$root, 36 [{ return matchREV(*${root}, MRI, ${matchinfo}); }]), 37 (apply [{ applyShuffleVectorPseudo(*${root}, ${matchinfo}); }]) 38>; 39 40def zip : GICombineRule< 41 (defs root:$root, shuffle_matchdata:$matchinfo), 42 (match (wip_match_opcode G_SHUFFLE_VECTOR):$root, 43 [{ return matchZip(*${root}, MRI, ${matchinfo}); }]), 44 (apply [{ applyShuffleVectorPseudo(*${root}, ${matchinfo}); }]) 45>; 46 47def uzp : GICombineRule< 48 (defs root:$root, shuffle_matchdata:$matchinfo), 49 (match (wip_match_opcode G_SHUFFLE_VECTOR):$root, 50 [{ return matchUZP(*${root}, MRI, ${matchinfo}); }]), 51 (apply [{ applyShuffleVectorPseudo(*${root}, ${matchinfo}); }]) 52>; 53 54def dup: GICombineRule < 55 (defs root:$root, shuffle_matchdata:$matchinfo), 56 (match (wip_match_opcode G_SHUFFLE_VECTOR):$root, 57 [{ return matchDup(*${root}, MRI, ${matchinfo}); }]), 58 (apply [{ applyShuffleVectorPseudo(*${root}, ${matchinfo}); }]) 59>; 60 61def trn : GICombineRule< 62 (defs root:$root, shuffle_matchdata:$matchinfo), 63 (match (wip_match_opcode G_SHUFFLE_VECTOR):$root, 64 [{ return matchTRN(*${root}, MRI, ${matchinfo}); }]), 65 (apply [{ applyShuffleVectorPseudo(*${root}, ${matchinfo}); }]) 66>; 67 68def ext: GICombineRule < 69 (defs root:$root, shuffle_matchdata:$matchinfo), 70 (match (wip_match_opcode G_SHUFFLE_VECTOR):$root, 71 [{ return matchEXT(*${root}, MRI, ${matchinfo}); }]), 72 (apply [{ applyEXT(*${root}, ${matchinfo}); }]) 73>; 74 75// Combines which replace a G_SHUFFLE_VECTOR with a target-specific pseudo 76// instruction. 77def shuffle_vector_pseudos : GICombineGroup<[dup, rev, ext, zip, uzp, trn]>; 78 79def AArch64PostLegalizerCombinerHelper 80 : GICombinerHelper<"AArch64GenPostLegalizerCombinerHelper", 81 [erase_undef_store, combines_for_extload, 82 sext_already_extended, shuffle_vector_pseudos]> { 83 let DisableRuleOption = "aarch64postlegalizercombiner-disable-rule"; 84} 85