[llvm] [AMDGPU] Improve codegen for copysign(x, fneg(y)) (PR #207178)

Madhur Kumar via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 14 01:12:42 PDT 2026


MadhurKumar004 wrote:

>It is not clear to me what the patch to DAGCombiner::visitBITCAST is for.

the visitBITCAST convert the `bitcast(fcopysign(const, fneg(x))` to `and(bitcast(fneg(x)), signbit)` before any target specific combine can see the fcopysign node. Once folded we cannot match any AMDGPU specific combine, custom lowering or Isel pattern 

The only two places where to catch this are
1. DAGCombiner - preventing the fold and preserving fcopysing
2. match the already folded and(bitcast(fneg(x)), signbit 

https://github.com/llvm/llvm-project/pull/207178


More information about the llvm-commits mailing list