[all-commits] [llvm/llvm-project] 41b951: [RISCV] Fix int16 -> __fp16 conversion code gen

Kito Cheng via All-commits all-commits at lists.llvm.org
Fri Apr 29 20:10:57 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 41b951c92931b65c25485b224901d8cb00163b8e
      https://github.com/llvm/llvm-project/commit/41b951c92931b65c25485b224901d8cb00163b8e
  Author: Kito Cheng <kito.cheng at sifive.com>
  Date:   2022-04-30 (Sat, 30 Apr 2022)

  Changed paths:
    M clang/lib/Basic/Targets/RISCV.h
    M clang/test/CodeGen/RISCV/__fp16-convert.c

  Log Message:
  -----------
  [RISCV] Fix int16 -> __fp16 conversion code gen

clang emit wrong code sequence for `int16`(`short`) to `__fp16` conversion,
and that should fix the code gen directly is the right way I think,
but I found there is a FIXME comment in clang/Basic/TargetInfo.h say
that's should be removed in future so I think just let swich to using
generic LLVM IR rather than llvm.convert.to.fp16 intrinsics code gen
path is enough.

```
  /// Check whether llvm intrinsics such as llvm.convert.to.fp16 should be used
  /// to convert to and from __fp16.
  /// FIXME: This function should be removed once all targets stop using the
  /// conversion intrinsics.
  virtual bool useFP16ConversionIntrinsics() const {
    return true;
  }
```

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D124509




More information about the All-commits mailing list