diff options
Diffstat (limited to 'llvm/lib/Target/AMDGPU/AMDGPUCombine.td')
| -rw-r--r-- | llvm/lib/Target/AMDGPU/AMDGPUCombine.td | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUCombine.td b/llvm/lib/Target/AMDGPU/AMDGPUCombine.td index c6273adca50f..df2f9a0fa3a9 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUCombine.td +++ b/llvm/lib/Target/AMDGPU/AMDGPUCombine.td @@ -64,26 +64,36 @@ def remove_fcanonicalize : GICombineRule< [{ return PostLegalizerHelper.matchRemoveFcanonicalize(*${fcanonicalize}, ${matchinfo}); }]), (apply [{ Helper.replaceSingleDefInstWithReg(*${fcanonicalize}, ${matchinfo}); }])>; +def foldable_fneg_matchdata : GIDefMatchData<"MachineInstr *">; + +def foldable_fneg : GICombineRule< + (defs root:$ffn, foldable_fneg_matchdata:$matchinfo), + (match (wip_match_opcode G_FNEG):$ffn, + [{ return Helper.matchFoldableFneg(*${ffn}, ${matchinfo}); }]), + (apply [{ Helper.applyFoldableFneg(*${ffn}, ${matchinfo}); }])>; + // Combines which should only apply on SI/VI def gfx6gfx7_combines : GICombineGroup<[fcmp_select_to_fmin_fmax_legacy]>; def AMDGPUPreLegalizerCombinerHelper: GICombinerHelper< - "AMDGPUGenPreLegalizerCombinerHelper", [all_combines, clamp_i64_to_i16]> { + "AMDGPUGenPreLegalizerCombinerHelper", + [all_combines, clamp_i64_to_i16, foldable_fneg]> { let DisableRuleOption = "amdgpuprelegalizercombiner-disable-rule"; let StateClass = "AMDGPUPreLegalizerCombinerHelperState"; + let AdditionalArguments = []; } def AMDGPUPostLegalizerCombinerHelper: GICombinerHelper< "AMDGPUGenPostLegalizerCombinerHelper", [all_combines, gfx6gfx7_combines, - uchar_to_float, cvt_f32_ubyteN, remove_fcanonicalize]> { + uchar_to_float, cvt_f32_ubyteN, remove_fcanonicalize, foldable_fneg]> { let DisableRuleOption = "amdgpupostlegalizercombiner-disable-rule"; let StateClass = "AMDGPUPostLegalizerCombinerHelperState"; let AdditionalArguments = []; } def AMDGPURegBankCombinerHelper : GICombinerHelper< - "AMDGPUGenRegBankCombinerHelper", [zext_trunc_fold, int_minmax_to_med3]> { + "AMDGPUGenRegBankCombinerHelper", [zext_trunc_fold, int_minmax_to_med3, ptr_add_immed_chain]> { let DisableRuleOption = "amdgpuregbankcombiner-disable-rule"; let StateClass = "AMDGPURegBankCombinerHelperState"; let AdditionalArguments = []; |
