[all-commits] [llvm/llvm-project] 92bcc4: [LoongArch] Add support for vector FP_ROUND from v...

Zhaoxin Yang via All-commits all-commits at lists.llvm.org
Sat Oct 18 00:13:13 PDT 2025


  Branch: refs/heads/users/ylzsx/opt-vector-fptrunc
  Home:   https://github.com/llvm/llvm-project
  Commit: 92bcc4b7aea5542b6d758b71b1506c2fe62256c0
      https://github.com/llvm/llvm-project/commit/92bcc4b7aea5542b6d758b71b1506c2fe62256c0
  Author: yangzhaoxin <yangzhaoxin at loongson.cn>
  Date:   2025-10-18 (Sat, 18 Oct 2025)

  Changed paths:
    M llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp
    M llvm/lib/Target/LoongArch/LoongArchISelLowering.h
    M llvm/lib/Target/LoongArch/LoongArchLASXInstrInfo.td
    M llvm/lib/Target/LoongArch/LoongArchLSXInstrInfo.td
    M llvm/test/CodeGen/LoongArch/lasx/ir-instruction/fptrunc.ll
    M llvm/test/CodeGen/LoongArch/lsx/ir-instruction/fptrunc.ll

  Log Message:
  -----------
  [LoongArch] Add support for vector FP_ROUND from vxf64 to vxf32

In LoongArch, [x]vfcvt.s.d intstructions require two vector registers
for v4f64->v4f32, v8f64->v8f32 conversions.

This patch handles these cases:
- For FP_ROUND v2f64->v2f32(illegal), add a customized v2f32 widening
  to convert it into a target-specific LoongArchISD::VFCVT.
- For FP_ROUND v4f64->v4f32, on LSX platforms, v4f64 is illegal and will
  be split into two v2f64->v2f32, resulting in two LoongArchISD::VFCVT.
  Finally, they are combined into a single node during combining
  LoongArchISD::VPACKEV. On LASX platforms, v4f64->v4f32 can directly
  lower to vfcvt.s.d in lowerFP_ROUND.
- For FP_ROUND v8f64->v8f32, on LASX platforms, v8f64 is illegal and
  will be split into two v4f64->v4f32 and then combine using
  ISD::CONCAT_VECTORS, so xvfcvt.s.d is generated during its
  combination.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list