[all-commits] [llvm/llvm-project] 559a9d: [LoongArch] Custom lower FP_TO_FP16 and FP16_TO_FP...

Ami-zhang via All-commits all-commits at lists.llvm.org
Mon Jun 2 23:26:07 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 559a9db5f5d06a6ebd62ef5bc66aa92b66840f2b
      https://github.com/llvm/llvm-project/commit/559a9db5f5d06a6ebd62ef5bc66aa92b66840f2b
  Author: Ami-zhang <zhanglimin at loongson.cn>
  Date:   2025-06-03 (Tue, 03 Jun 2025)

  Changed paths:
    M llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp
    M llvm/lib/Target/LoongArch/LoongArchISelLowering.h
    A llvm/test/CodeGen/LoongArch/calling-conv-half.ll
    M llvm/test/CodeGen/LoongArch/fp16-promote.ll
    A llvm/test/CodeGen/LoongArch/issue97975.ll
    A llvm/test/CodeGen/LoongArch/issue97981.ll

  Log Message:
  -----------
  [LoongArch] Custom lower FP_TO_FP16 and FP16_TO_FP to correct ABI of libcall (#141702)

This change passes 'half' in the lower 16 bits of an f32 value with F/D
ABI. LoongArch currently lacks a hardware extension for the fp16 data
type, and the ABI manual now documents the half-precision floating-point
type following FP calling conventions.

Previously, we maintained the 'half' type in its 16-bit format between
operations. Regardless of whether the F extension is enabled, the value
would be passed in the lower 16 bits of a GPR in its 'half' format.

With this patch, depending on the ABI in use, the value will be passed
either in an FPR or a GPR in 'half' format. This ensures consistency
with the bits location when the fp16 hardware extension is enabled.

Co-authored-by: WANG Rui <wangrui at loongson.cn>



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