llvm-project
c8b8641d - [AMDGPU] Scalarize packed FP math with fabs sources and update cost model (#236584)

Commit
1 day ago
[AMDGPU] Scalarize packed FP math with fabs sources and update cost model (#236584) Packed math instructions (v_pk_add, v_pk_mul, v_pk_fma, v_pk_min_num and v_pk_max_num) have no abs source modifier, so an fabs feeding one must be materialized as a real and per element. Scalarizing the packed operation instead lets the abs fold back into a source modifier, trading the packed instruction plus N ands for N scalar instructions. Update the TTI cost model to match: fabs stays free, and a packed f32/f64 fadd/fsub/fmul, fma/fmuladd or f64 minimumnum/maximumnum with a single-use fabs source (looking through fneg) is priced as one scalar instruction per element instead of a packed instruction. When queried by the SLP vectorizer, the operands of the scalar instruction representing the lanes are checked. Fixes: LCOMPILER-2919 --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Author
Parents
Loading