-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[RISCV][GISel] Add ZFA FP legalization and full tests for 9 insn #118723
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@llvm/pr-subscribers-backend-risc-v Author: Luke Quinn (lquinn2015) ChangesFull diff: https://github.com/llvm/llvm-project/pull/118723.diff 4 Files Affected:
diff --git a/llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp b/llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp
index 456ca9894e6a7d..be5a3364948071 100644
--- a/llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp
+++ b/llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp
@@ -582,10 +582,13 @@ RISCVLegalizerInfo::RISCVLegalizerInfo(const RISCVSubtarget &ST)
.libcallFor(ST.is64Bit(), {{s32, s128}, {s64, s128}});
// FIXME: We can do custom inline expansion like SelectionDAG.
- // FIXME: Legal with Zfa.
getActionDefinitionsBuilder({G_FCEIL, G_FFLOOR, G_FRINT, G_FNEARBYINT,
G_INTRINSIC_TRUNC, G_INTRINSIC_ROUND,
- G_INTRINSIC_ROUNDEVEN})
+ G_INTRINSIC_ROUNDEVEN, G_FMAXIMUM, G_FMINIMUM})
+
+ .legalFor(ST.hasStdExtZfa() /*ST.hasStdExtF()*/, {s32})
+ .legalFor(ST.hasStdExtZfa() & ST.hasStdExtD() , {s64})
+ .legalFor(ST.hasStdExtZfa() & ST.hasStdExtZfh(), {s16})
.libcallFor({s32, s64});
getActionDefinitionsBuilder({G_FCOS, G_FSIN, G_FTAN, G_FPOW, G_FLOG, G_FLOG2,
diff --git a/llvm/test/CodeGen/RISCV/GlobalISel/legalizer/legalize-zfa-f16.ll b/llvm/test/CodeGen/RISCV/GlobalISel/legalizer/legalize-zfa-f16.ll
new file mode 100644
index 00000000000000..7e8d6d8758c5e8
--- /dev/null
+++ b/llvm/test/CodeGen/RISCV/GlobalISel/legalizer/legalize-zfa-f16.ll
@@ -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 --check-prefixes=CHECK-ZFA-f16
+; RUN: llc -mtriple=riscv64 -mattr=+zfa,+zfh -global-isel < %s \
+; RUN: | FileCheck %s --check-prefixes=CHECK-ZFA-f16
+
+
+define half @fceil(half %a) {
+; CHECK-ZFA-f16-LABEL: fceil:
+; CHECK-ZFA-f16: # %bb.0:
+; CHECK-ZFA-f16-NEXT: fround.h fa0, fa0, rup
+; CHECK-ZFA-f16-NEXT: ret
+ %b = call half @llvm.ceil.f16(half %a)
+ ret half %b
+}
+
+define half @ffloor(half %a) {
+; CHECK-ZFA-f16-LABEL: ffloor:
+; CHECK-ZFA-f16: # %bb.0:
+; CHECK-ZFA-f16-NEXT: fround.h fa0, fa0, rdn
+; CHECK-ZFA-f16-NEXT: ret
+ %b = call half @llvm.floor.f16(half %a)
+ ret half %b
+}
+
+define half @frint(half %a) {
+; CHECK-ZFA-f16-LABEL: frint:
+; CHECK-ZFA-f16: # %bb.0:
+; CHECK-ZFA-f16-NEXT: froundnx.h fa0, fa0
+; CHECK-ZFA-f16-NEXT: ret
+ %b = call half @llvm.rint.f16(half %a)
+ ret half %b
+}
+
+define half @fnearbyint(half %a) {
+; CHECK-ZFA-f16-LABEL: fnearbyint:
+; CHECK-ZFA-f16: # %bb.0:
+; CHECK-ZFA-f16-NEXT: fround.h fa0, fa0
+; CHECK-ZFA-f16-NEXT: ret
+ %b = call half @llvm.nearbyint.f16(half %a)
+ ret half %b
+}
+
+define half @fround(half %a) {
+; CHECK-ZFA-f16-LABEL: fround:
+; CHECK-ZFA-f16: # %bb.0:
+; CHECK-ZFA-f16-NEXT: fround.h fa0, fa0, rmm
+; CHECK-ZFA-f16-NEXT: ret
+ %b = call half @llvm.round.f16(half %a)
+ ret half %b
+}
+
+define half @froundeven(half %a) {
+; CHECK-ZFA-f16-LABEL: froundeven:
+; CHECK-ZFA-f16: # %bb.0:
+; CHECK-ZFA-f16-NEXT: fround.h fa0, fa0, rne
+; CHECK-ZFA-f16-NEXT: ret
+ %b = call half @llvm.roundeven.f16(half %a)
+ ret half %b
+}
+define half @fmaximum(half %a, half %b) {
+; CHECK-ZFA-f16-LABEL: fmaximum:
+; CHECK-ZFA-f16: # %bb.0:
+; CHECK-ZFA-f16-NEXT: fmaxm.h fa0, fa0, fa1
+; CHECK-ZFA-f16-NEXT: ret
+ %c = call half @llvm.maximum.f16(half %a, half %b)
+ ret half %c
+}
+
+define half @fminimum(half %a, half %b) {
+; CHECK-ZFA-f16-LABEL: fminimum:
+; CHECK-ZFA-f16: # %bb.0:
+; CHECK-ZFA-f16-NEXT: fminm.h fa0, fa0, fa1
+; CHECK-ZFA-f16-NEXT: ret
+ %c = call half @llvm.minimum.f16(half %a, half %b)
+ ret half %c
+}
diff --git a/llvm/test/CodeGen/RISCV/GlobalISel/legalizer/legalize-zfa-f32.ll b/llvm/test/CodeGen/RISCV/GlobalISel/legalizer/legalize-zfa-f32.ll
new file mode 100644
index 00000000000000..66c57518173bf3
--- /dev/null
+++ b/llvm/test/CodeGen/RISCV/GlobalISel/legalizer/legalize-zfa-f32.ll
@@ -0,0 +1,79 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
+
+; RUN: llc -mtriple=riscv32 -mattr=+zfa -global-isel < %s \
+; RUN: | FileCheck %s --check-prefixes=CHECK-ZFA-f32
+; RUN: llc -mtriple=riscv64 -mattr=+zfa -global-isel < %s \
+; RUN: | FileCheck %s --check-prefixes=CHECK-ZFA-f32
+
+
+define float @fceil(float %a) {
+; CHECK-ZFA-f32-LABEL: fceil:
+; CHECK-ZFA-f32: # %bb.0:
+; CHECK-ZFA-f32-NEXT: fround.s fa0, fa0, rup
+; CHECK-ZFA-f32-NEXT: ret
+ %b = call float @llvm.ceil.f32(float %a)
+ ret float %b
+}
+
+define float @ffloor(float %a) {
+; CHECK-ZFA-f32-LABEL: ffloor:
+; CHECK-ZFA-f32: # %bb.0:
+; CHECK-ZFA-f32-NEXT: fround.s fa0, fa0, rdn
+; CHECK-ZFA-f32-NEXT: ret
+ %b = call float @llvm.floor.f32(float %a)
+ ret float %b
+}
+
+define float @frint(float %a) {
+; CHECK-ZFA-f32-LABEL: frint:
+; CHECK-ZFA-f32: # %bb.0:
+; CHECK-ZFA-f32-NEXT: froundnx.s fa0, fa0
+; CHECK-ZFA-f32-NEXT: ret
+ %b = call float @llvm.rint.f32(float %a)
+ ret float %b
+}
+
+define float @fnearbyint(float %a) {
+; CHECK-ZFA-f32-LABEL: fnearbyint:
+; CHECK-ZFA-f32: # %bb.0:
+; CHECK-ZFA-f32-NEXT: fround.s fa0, fa0
+; CHECK-ZFA-f32-NEXT: ret
+ %b = call float @llvm.nearbyint.f32(float %a)
+ ret float %b
+}
+
+define float @fround(float %a) {
+; CHECK-ZFA-f32-LABEL: fround:
+; CHECK-ZFA-f32: # %bb.0:
+; CHECK-ZFA-f32-NEXT: fround.s fa0, fa0, rmm
+; CHECK-ZFA-f32-NEXT: ret
+ %b = call float @llvm.round.f32(float %a)
+ ret float %b
+}
+
+define float @fmaximum(float %a, float %b) {
+; CHECK-ZFA-f32-LABEL: fmaximum:
+; CHECK-ZFA-f32: # %bb.0:
+; CHECK-ZFA-f32-NEXT: fmaxm.s fa0, fa0, fa1
+; CHECK-ZFA-f32-NEXT: ret
+ %c = call float @llvm.maximum.f32(float %a, float %b)
+ ret float %c
+}
+
+define float @fminimum(float %a, float %b) {
+; CHECK-ZFA-f32-LABEL: fminimum:
+; CHECK-ZFA-f32: # %bb.0:
+; CHECK-ZFA-f32-NEXT: fminm.s fa0, fa0, fa1
+; CHECK-ZFA-f32-NEXT: ret
+ %c = call float @llvm.minimum.f32(float %a, float %b)
+ ret float %c
+}
+
+define float @froundeven(float %a) {
+; CHECK-ZFA-f32-LABEL: froundeven:
+; CHECK-ZFA-f32: # %bb.0:
+; CHECK-ZFA-f32-NEXT: fround.s fa0, fa0, rne
+; CHECK-ZFA-f32-NEXT: ret
+ %b = call float @llvm.roundeven.f32(float %a)
+ ret float %b
+}
diff --git a/llvm/test/CodeGen/RISCV/GlobalISel/legalizer/legalize-zfa-f64.ll b/llvm/test/CodeGen/RISCV/GlobalISel/legalizer/legalize-zfa-f64.ll
new file mode 100644
index 00000000000000..b24303071e5648
--- /dev/null
+++ b/llvm/test/CodeGen/RISCV/GlobalISel/legalizer/legalize-zfa-f64.ll
@@ -0,0 +1,79 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
+
+; RUN: llc -mtriple=riscv32 -mattr=+zfa,d -global-isel < %s \
+; RUN: | FileCheck %s --check-prefixes=CHECK-ZFA-f64
+; RUN: llc -mtriple=riscv64 -mattr=+zfa,d -global-isel < %s \
+; RUN: | FileCheck %s --check-prefixes=CHECK-ZFA-f64
+
+
+define double @fceil(double %a) {
+; CHECK-ZFA-f64-LABEL: fceil:
+; CHECK-ZFA-f64: # %bb.0:
+; CHECK-ZFA-f64-NEXT: fround.d fa0, fa0, rup
+; CHECK-ZFA-f64-NEXT: ret
+ %b = call double @llvm.ceil.f64(double %a)
+ ret double %b
+}
+
+define double @ffloor(double %a) {
+; CHECK-ZFA-f64-LABEL: ffloor:
+; CHECK-ZFA-f64: # %bb.0:
+; CHECK-ZFA-f64-NEXT: fround.d fa0, fa0, rdn
+; CHECK-ZFA-f64-NEXT: ret
+ %b = call double @llvm.floor.f64(double %a)
+ ret double %b
+}
+
+define double @frint(double %a) {
+; CHECK-ZFA-f64-LABEL: frint:
+; CHECK-ZFA-f64: # %bb.0:
+; CHECK-ZFA-f64-NEXT: froundnx.d fa0, fa0
+; CHECK-ZFA-f64-NEXT: ret
+ %b = call double @llvm.rint.f64(double %a)
+ ret double %b
+}
+
+define double @fnearbyint(double %a) {
+; CHECK-ZFA-f64-LABEL: fnearbyint:
+; CHECK-ZFA-f64: # %bb.0:
+; CHECK-ZFA-f64-NEXT: fround.d fa0, fa0
+; CHECK-ZFA-f64-NEXT: ret
+ %b = call double @llvm.nearbyint.f64(double %a)
+ ret double %b
+}
+
+define double @fround(double %a) {
+; CHECK-ZFA-f64-LABEL: fround:
+; CHECK-ZFA-f64: # %bb.0:
+; CHECK-ZFA-f64-NEXT: fround.d fa0, fa0, rmm
+; CHECK-ZFA-f64-NEXT: ret
+ %b = call double @llvm.round.f64(double %a)
+ ret double %b
+}
+
+define double @froundeven(double %a) {
+; CHECK-ZFA-f64-LABEL: froundeven:
+; CHECK-ZFA-f64: # %bb.0:
+; CHECK-ZFA-f64-NEXT: fround.d fa0, fa0, rne
+; CHECK-ZFA-f64-NEXT: ret
+ %b = call double @llvm.roundeven.f64(double %a)
+ ret double %b
+}
+
+define double @fmaximum(double %a, double %b) {
+; CHECK-ZFA-f64-LABEL: fmaximum:
+; CHECK-ZFA-f64: # %bb.0:
+; CHECK-ZFA-f64-NEXT: fmaxm.d fa0, fa0, fa1
+; CHECK-ZFA-f64-NEXT: ret
+ %c = call double @llvm.maximum.f64(double %a, double %b)
+ ret double %c
+}
+
+define double @fminimum(double %a, double %b) {
+; CHECK-ZFA-f64-LABEL: fminimum:
+; CHECK-ZFA-f64: # %bb.0:
+; CHECK-ZFA-f64-NEXT: fminm.d fa0, fa0, fa1
+; CHECK-ZFA-f64-NEXT: ret
+ %c = call double @llvm.minimum.f64(double %a, double %b)
+ ret double %c
+}
|
|
@llvm/pr-subscribers-llvm-globalisel Author: Luke Quinn (lquinn2015) ChangesFull diff: https://github.com/llvm/llvm-project/pull/118723.diff 4 Files Affected:
diff --git a/llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp b/llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp
index 456ca9894e6a7d..be5a3364948071 100644
--- a/llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp
+++ b/llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp
@@ -582,10 +582,13 @@ RISCVLegalizerInfo::RISCVLegalizerInfo(const RISCVSubtarget &ST)
.libcallFor(ST.is64Bit(), {{s32, s128}, {s64, s128}});
// FIXME: We can do custom inline expansion like SelectionDAG.
- // FIXME: Legal with Zfa.
getActionDefinitionsBuilder({G_FCEIL, G_FFLOOR, G_FRINT, G_FNEARBYINT,
G_INTRINSIC_TRUNC, G_INTRINSIC_ROUND,
- G_INTRINSIC_ROUNDEVEN})
+ G_INTRINSIC_ROUNDEVEN, G_FMAXIMUM, G_FMINIMUM})
+
+ .legalFor(ST.hasStdExtZfa() /*ST.hasStdExtF()*/, {s32})
+ .legalFor(ST.hasStdExtZfa() & ST.hasStdExtD() , {s64})
+ .legalFor(ST.hasStdExtZfa() & ST.hasStdExtZfh(), {s16})
.libcallFor({s32, s64});
getActionDefinitionsBuilder({G_FCOS, G_FSIN, G_FTAN, G_FPOW, G_FLOG, G_FLOG2,
diff --git a/llvm/test/CodeGen/RISCV/GlobalISel/legalizer/legalize-zfa-f16.ll b/llvm/test/CodeGen/RISCV/GlobalISel/legalizer/legalize-zfa-f16.ll
new file mode 100644
index 00000000000000..7e8d6d8758c5e8
--- /dev/null
+++ b/llvm/test/CodeGen/RISCV/GlobalISel/legalizer/legalize-zfa-f16.ll
@@ -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 --check-prefixes=CHECK-ZFA-f16
+; RUN: llc -mtriple=riscv64 -mattr=+zfa,+zfh -global-isel < %s \
+; RUN: | FileCheck %s --check-prefixes=CHECK-ZFA-f16
+
+
+define half @fceil(half %a) {
+; CHECK-ZFA-f16-LABEL: fceil:
+; CHECK-ZFA-f16: # %bb.0:
+; CHECK-ZFA-f16-NEXT: fround.h fa0, fa0, rup
+; CHECK-ZFA-f16-NEXT: ret
+ %b = call half @llvm.ceil.f16(half %a)
+ ret half %b
+}
+
+define half @ffloor(half %a) {
+; CHECK-ZFA-f16-LABEL: ffloor:
+; CHECK-ZFA-f16: # %bb.0:
+; CHECK-ZFA-f16-NEXT: fround.h fa0, fa0, rdn
+; CHECK-ZFA-f16-NEXT: ret
+ %b = call half @llvm.floor.f16(half %a)
+ ret half %b
+}
+
+define half @frint(half %a) {
+; CHECK-ZFA-f16-LABEL: frint:
+; CHECK-ZFA-f16: # %bb.0:
+; CHECK-ZFA-f16-NEXT: froundnx.h fa0, fa0
+; CHECK-ZFA-f16-NEXT: ret
+ %b = call half @llvm.rint.f16(half %a)
+ ret half %b
+}
+
+define half @fnearbyint(half %a) {
+; CHECK-ZFA-f16-LABEL: fnearbyint:
+; CHECK-ZFA-f16: # %bb.0:
+; CHECK-ZFA-f16-NEXT: fround.h fa0, fa0
+; CHECK-ZFA-f16-NEXT: ret
+ %b = call half @llvm.nearbyint.f16(half %a)
+ ret half %b
+}
+
+define half @fround(half %a) {
+; CHECK-ZFA-f16-LABEL: fround:
+; CHECK-ZFA-f16: # %bb.0:
+; CHECK-ZFA-f16-NEXT: fround.h fa0, fa0, rmm
+; CHECK-ZFA-f16-NEXT: ret
+ %b = call half @llvm.round.f16(half %a)
+ ret half %b
+}
+
+define half @froundeven(half %a) {
+; CHECK-ZFA-f16-LABEL: froundeven:
+; CHECK-ZFA-f16: # %bb.0:
+; CHECK-ZFA-f16-NEXT: fround.h fa0, fa0, rne
+; CHECK-ZFA-f16-NEXT: ret
+ %b = call half @llvm.roundeven.f16(half %a)
+ ret half %b
+}
+define half @fmaximum(half %a, half %b) {
+; CHECK-ZFA-f16-LABEL: fmaximum:
+; CHECK-ZFA-f16: # %bb.0:
+; CHECK-ZFA-f16-NEXT: fmaxm.h fa0, fa0, fa1
+; CHECK-ZFA-f16-NEXT: ret
+ %c = call half @llvm.maximum.f16(half %a, half %b)
+ ret half %c
+}
+
+define half @fminimum(half %a, half %b) {
+; CHECK-ZFA-f16-LABEL: fminimum:
+; CHECK-ZFA-f16: # %bb.0:
+; CHECK-ZFA-f16-NEXT: fminm.h fa0, fa0, fa1
+; CHECK-ZFA-f16-NEXT: ret
+ %c = call half @llvm.minimum.f16(half %a, half %b)
+ ret half %c
+}
diff --git a/llvm/test/CodeGen/RISCV/GlobalISel/legalizer/legalize-zfa-f32.ll b/llvm/test/CodeGen/RISCV/GlobalISel/legalizer/legalize-zfa-f32.ll
new file mode 100644
index 00000000000000..66c57518173bf3
--- /dev/null
+++ b/llvm/test/CodeGen/RISCV/GlobalISel/legalizer/legalize-zfa-f32.ll
@@ -0,0 +1,79 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
+
+; RUN: llc -mtriple=riscv32 -mattr=+zfa -global-isel < %s \
+; RUN: | FileCheck %s --check-prefixes=CHECK-ZFA-f32
+; RUN: llc -mtriple=riscv64 -mattr=+zfa -global-isel < %s \
+; RUN: | FileCheck %s --check-prefixes=CHECK-ZFA-f32
+
+
+define float @fceil(float %a) {
+; CHECK-ZFA-f32-LABEL: fceil:
+; CHECK-ZFA-f32: # %bb.0:
+; CHECK-ZFA-f32-NEXT: fround.s fa0, fa0, rup
+; CHECK-ZFA-f32-NEXT: ret
+ %b = call float @llvm.ceil.f32(float %a)
+ ret float %b
+}
+
+define float @ffloor(float %a) {
+; CHECK-ZFA-f32-LABEL: ffloor:
+; CHECK-ZFA-f32: # %bb.0:
+; CHECK-ZFA-f32-NEXT: fround.s fa0, fa0, rdn
+; CHECK-ZFA-f32-NEXT: ret
+ %b = call float @llvm.floor.f32(float %a)
+ ret float %b
+}
+
+define float @frint(float %a) {
+; CHECK-ZFA-f32-LABEL: frint:
+; CHECK-ZFA-f32: # %bb.0:
+; CHECK-ZFA-f32-NEXT: froundnx.s fa0, fa0
+; CHECK-ZFA-f32-NEXT: ret
+ %b = call float @llvm.rint.f32(float %a)
+ ret float %b
+}
+
+define float @fnearbyint(float %a) {
+; CHECK-ZFA-f32-LABEL: fnearbyint:
+; CHECK-ZFA-f32: # %bb.0:
+; CHECK-ZFA-f32-NEXT: fround.s fa0, fa0
+; CHECK-ZFA-f32-NEXT: ret
+ %b = call float @llvm.nearbyint.f32(float %a)
+ ret float %b
+}
+
+define float @fround(float %a) {
+; CHECK-ZFA-f32-LABEL: fround:
+; CHECK-ZFA-f32: # %bb.0:
+; CHECK-ZFA-f32-NEXT: fround.s fa0, fa0, rmm
+; CHECK-ZFA-f32-NEXT: ret
+ %b = call float @llvm.round.f32(float %a)
+ ret float %b
+}
+
+define float @fmaximum(float %a, float %b) {
+; CHECK-ZFA-f32-LABEL: fmaximum:
+; CHECK-ZFA-f32: # %bb.0:
+; CHECK-ZFA-f32-NEXT: fmaxm.s fa0, fa0, fa1
+; CHECK-ZFA-f32-NEXT: ret
+ %c = call float @llvm.maximum.f32(float %a, float %b)
+ ret float %c
+}
+
+define float @fminimum(float %a, float %b) {
+; CHECK-ZFA-f32-LABEL: fminimum:
+; CHECK-ZFA-f32: # %bb.0:
+; CHECK-ZFA-f32-NEXT: fminm.s fa0, fa0, fa1
+; CHECK-ZFA-f32-NEXT: ret
+ %c = call float @llvm.minimum.f32(float %a, float %b)
+ ret float %c
+}
+
+define float @froundeven(float %a) {
+; CHECK-ZFA-f32-LABEL: froundeven:
+; CHECK-ZFA-f32: # %bb.0:
+; CHECK-ZFA-f32-NEXT: fround.s fa0, fa0, rne
+; CHECK-ZFA-f32-NEXT: ret
+ %b = call float @llvm.roundeven.f32(float %a)
+ ret float %b
+}
diff --git a/llvm/test/CodeGen/RISCV/GlobalISel/legalizer/legalize-zfa-f64.ll b/llvm/test/CodeGen/RISCV/GlobalISel/legalizer/legalize-zfa-f64.ll
new file mode 100644
index 00000000000000..b24303071e5648
--- /dev/null
+++ b/llvm/test/CodeGen/RISCV/GlobalISel/legalizer/legalize-zfa-f64.ll
@@ -0,0 +1,79 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
+
+; RUN: llc -mtriple=riscv32 -mattr=+zfa,d -global-isel < %s \
+; RUN: | FileCheck %s --check-prefixes=CHECK-ZFA-f64
+; RUN: llc -mtriple=riscv64 -mattr=+zfa,d -global-isel < %s \
+; RUN: | FileCheck %s --check-prefixes=CHECK-ZFA-f64
+
+
+define double @fceil(double %a) {
+; CHECK-ZFA-f64-LABEL: fceil:
+; CHECK-ZFA-f64: # %bb.0:
+; CHECK-ZFA-f64-NEXT: fround.d fa0, fa0, rup
+; CHECK-ZFA-f64-NEXT: ret
+ %b = call double @llvm.ceil.f64(double %a)
+ ret double %b
+}
+
+define double @ffloor(double %a) {
+; CHECK-ZFA-f64-LABEL: ffloor:
+; CHECK-ZFA-f64: # %bb.0:
+; CHECK-ZFA-f64-NEXT: fround.d fa0, fa0, rdn
+; CHECK-ZFA-f64-NEXT: ret
+ %b = call double @llvm.floor.f64(double %a)
+ ret double %b
+}
+
+define double @frint(double %a) {
+; CHECK-ZFA-f64-LABEL: frint:
+; CHECK-ZFA-f64: # %bb.0:
+; CHECK-ZFA-f64-NEXT: froundnx.d fa0, fa0
+; CHECK-ZFA-f64-NEXT: ret
+ %b = call double @llvm.rint.f64(double %a)
+ ret double %b
+}
+
+define double @fnearbyint(double %a) {
+; CHECK-ZFA-f64-LABEL: fnearbyint:
+; CHECK-ZFA-f64: # %bb.0:
+; CHECK-ZFA-f64-NEXT: fround.d fa0, fa0
+; CHECK-ZFA-f64-NEXT: ret
+ %b = call double @llvm.nearbyint.f64(double %a)
+ ret double %b
+}
+
+define double @fround(double %a) {
+; CHECK-ZFA-f64-LABEL: fround:
+; CHECK-ZFA-f64: # %bb.0:
+; CHECK-ZFA-f64-NEXT: fround.d fa0, fa0, rmm
+; CHECK-ZFA-f64-NEXT: ret
+ %b = call double @llvm.round.f64(double %a)
+ ret double %b
+}
+
+define double @froundeven(double %a) {
+; CHECK-ZFA-f64-LABEL: froundeven:
+; CHECK-ZFA-f64: # %bb.0:
+; CHECK-ZFA-f64-NEXT: fround.d fa0, fa0, rne
+; CHECK-ZFA-f64-NEXT: ret
+ %b = call double @llvm.roundeven.f64(double %a)
+ ret double %b
+}
+
+define double @fmaximum(double %a, double %b) {
+; CHECK-ZFA-f64-LABEL: fmaximum:
+; CHECK-ZFA-f64: # %bb.0:
+; CHECK-ZFA-f64-NEXT: fmaxm.d fa0, fa0, fa1
+; CHECK-ZFA-f64-NEXT: ret
+ %c = call double @llvm.maximum.f64(double %a, double %b)
+ ret double %c
+}
+
+define double @fminimum(double %a, double %b) {
+; CHECK-ZFA-f64-LABEL: fminimum:
+; CHECK-ZFA-f64: # %bb.0:
+; CHECK-ZFA-f64-NEXT: fminm.d fa0, fa0, fa1
+; CHECK-ZFA-f64-NEXT: ret
+ %c = call double @llvm.minimum.f64(double %a, double %b)
+ ret double %c
+}
|
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
llvm/test/CodeGen/RISCV/GlobalISel/legalizer/legalize-zfa-f16.ll
Outdated
Show resolved
Hide resolved
llvm/test/CodeGen/RISCV/GlobalISel/legalizer/legalize-zfa-f16.ll
Outdated
Show resolved
Hide resolved
llvm/test/CodeGen/RISCV/GlobalISel/legalizer/legalize-zfa-f16.ll
Outdated
Show resolved
Hide resolved
6d106ae to
892e94c
Compare
|
Still failing the MIR check validaton for G_MINIMUM and G_MAXIMUM i don't know why perhaps my test isn't covering something up |
df9d9c1 to
664dbd6
Compare
664dbd6 to
b320f16
Compare
b320f16 to
00e5487
Compare
|
@topperc - I updated the legalizer check i did not include the ZFA extension in the Sweep. Rather I added the alias opcode. Let me know if that makes sense. If we add the extension it passes the extra rules as "Oks" |
00e5487 to
21b5e76
Compare
Signed-off-by: Luke Quinn <[email protected]>
21b5e76 to
45ea394
Compare
topperc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
No description provided.