[llvm] [RISCV][GISel] Add ZFA FP legalization and full tests for 9 insn (PR #118723)
Luke Quinn via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 5 08:29:45 PST 2024
================
@@ -0,0 +1,78 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
+
+; RUN: llc -mtriple=riscv32 -mattr=+zfa,+zfh -global-isel < %s \
+; RUN: | FileCheck %s
+; RUN: llc -mtriple=riscv64 -mattr=+zfa,+zfh -global-isel < %s \
+; RUN: | FileCheck %s
+
+
+define half @fceil(half %a) {
+; CHECK-LABEL: fceil:
+; CHECK: # %bb.0:
+; CHECK-NEXT: fround.h fa0, fa0, rup
+; CHECK-NEXT: ret
+ %b = call half @llvm.ceil.f16(half %a)
+ ret half %b
+}
+
+define half @ffloor(half %a) {
+; CHECK-LABEL: ffloor:
+; CHECK: # %bb.0:
+; CHECK-NEXT: fround.h fa0, fa0, rdn
+; CHECK-NEXT: ret
+ %b = call half @llvm.floor.f16(half %a)
+ ret half %b
+}
+
+define half @frint(half %a) {
+; CHECK-LABEL: frint:
+; CHECK: # %bb.0:
+; CHECK-NEXT: froundnx.h fa0, fa0
+; CHECK-NEXT: ret
+ %b = call half @llvm.rint.f16(half %a)
+ ret half %b
+}
+
+define half @fnearbyint(half %a) {
+; CHECK-LABEL: fnearbyint:
+; CHECK: # %bb.0:
+; CHECK-NEXT: fround.h fa0, fa0
+; CHECK-NEXT: ret
+ %b = call half @llvm.nearbyint.f16(half %a)
+ ret half %b
+}
+
+define half @fround(half %a) {
+; CHECK-LABEL: fround:
+; CHECK: # %bb.0:
+; CHECK-NEXT: fround.h fa0, fa0, rmm
+; CHECK-NEXT: ret
+ %b = call half @llvm.round.f16(half %a)
+ ret half %b
+}
+
+define half @froundeven(half %a) {
+; CHECK-LABEL: froundeven:
+; CHECK: # %bb.0:
+; CHECK-NEXT: fround.h fa0, fa0, rne
+; CHECK-NEXT: ret
+ %b = call half @llvm.roundeven.f16(half %a)
+ ret half %b
+}
+define half @fmaximum(half %a, half %b) {
----------------
lquinn2015 wrote:
I will do better with the formatting next time! but yes this is now fixed
https://github.com/llvm/llvm-project/pull/118723
More information about the llvm-commits
mailing list