llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-backend-loongarch Author: Jay Foad (jayfoad) <details> <summary>Changes</summary> fceil, ffloor, ftrunc and froundeven of an FP scalar are selected to a splat of element 0 of the FPR viewed as an LSX vector, a vector rounding instruction, and an extract of element 0. Only element 0 is used, so use INSERT_SUBREG into an IMPLICIT_DEF instead of SUBREG_TO_REG, which means that the instruction defining the FPR also defined the rest of the vector register. Co-Authored-By: Claude Opus 5.5 <noreply@<!-- -->anthropic.com> --- <sub>Stack created with <a href="https://github.com/github/gh-stack">GitHub Stacks CLI</a> • <a href="https://gh.io/stacks-feedback">Give Feedback 💬</a></sub> --- Full diff: https://github.com/llvm/llvm-project/pull/242329.diff 1 Files Affected: - (modified) llvm/lib/Target/LoongArch/LoongArchLSXInstrInfo.td (+16-8) ``````````diff diff --git a/llvm/lib/Target/LoongArch/LoongArchLSXInstrInfo.td b/llvm/lib/Target/LoongArch/LoongArchLSXInstrInfo.td index 42599cd6f2cda..c4ccd06ed6ca6 100644 --- a/llvm/lib/Target/LoongArch/LoongArchLSXInstrInfo.td +++ b/llvm/lib/Target/LoongArch/LoongArchLSXInstrInfo.td @@ -3508,28 +3508,36 @@ def : Pat<(loongarch_vfrsqrte v2f64:$src), // Vector floating-point conversion def : Pat<(f32 (fceil FPR32:$fj)), (f32 (EXTRACT_SUBREG (VFRINTRP_S (VREPLVEI_W - (SUBREG_TO_REG FPR32:$fj, sub_32), 0)), sub_32))>; + (INSERT_SUBREG (IMPLICIT_DEF), FPR32:$fj, sub_32), 0)), + sub_32))>; def : Pat<(f64 (fceil FPR64:$fj)), (f64 (EXTRACT_SUBREG (VFRINTRP_D (VREPLVEI_D - (SUBREG_TO_REG FPR64:$fj, sub_64), 0)), sub_64))>; + (INSERT_SUBREG (IMPLICIT_DEF), FPR64:$fj, sub_64), 0)), + sub_64))>; def : Pat<(f32 (ffloor FPR32:$fj)), (f32 (EXTRACT_SUBREG (VFRINTRM_S (VREPLVEI_W - (SUBREG_TO_REG FPR32:$fj, sub_32), 0)), sub_32))>; + (INSERT_SUBREG (IMPLICIT_DEF), FPR32:$fj, sub_32), 0)), + sub_32))>; def : Pat<(f64 (ffloor FPR64:$fj)), (f64 (EXTRACT_SUBREG (VFRINTRM_D (VREPLVEI_D - (SUBREG_TO_REG FPR64:$fj, sub_64), 0)), sub_64))>; + (INSERT_SUBREG (IMPLICIT_DEF), FPR64:$fj, sub_64), 0)), + sub_64))>; def : Pat<(f32 (ftrunc FPR32:$fj)), (f32 (EXTRACT_SUBREG (VFRINTRZ_S (VREPLVEI_W - (SUBREG_TO_REG FPR32:$fj, sub_32), 0)), sub_32))>; + (INSERT_SUBREG (IMPLICIT_DEF), FPR32:$fj, sub_32), 0)), + sub_32))>; def : Pat<(f64 (ftrunc FPR64:$fj)), (f64 (EXTRACT_SUBREG (VFRINTRZ_D (VREPLVEI_D - (SUBREG_TO_REG FPR64:$fj, sub_64), 0)), sub_64))>; + (INSERT_SUBREG (IMPLICIT_DEF), FPR64:$fj, sub_64), 0)), + sub_64))>; def : Pat<(f32 (froundeven FPR32:$fj)), (f32 (EXTRACT_SUBREG (VFRINTRNE_S (VREPLVEI_W - (SUBREG_TO_REG FPR32:$fj, sub_32), 0)), sub_32))>; + (INSERT_SUBREG (IMPLICIT_DEF), FPR32:$fj, sub_32), 0)), + sub_32))>; def : Pat<(f64 (froundeven FPR64:$fj)), (f64 (EXTRACT_SUBREG (VFRINTRNE_D (VREPLVEI_D - (SUBREG_TO_REG FPR64:$fj, sub_64), 0)), sub_64))>; + (INSERT_SUBREG (IMPLICIT_DEF), FPR64:$fj, sub_64), 0)), + sub_64))>; defm : PatVrF<fceil, "VFRINTRP">; defm : PatVrF<ffloor, "VFRINTRM">; `````````` </details> https://github.com/llvm/llvm-project/pull/242329 _______________________________________________ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
