[llvm] 4ff6205 - [LoongArch] Add test for scalar FP rounding (#114968)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 5 05:21:24 PST 2024
Author: ZhaoQi
Date: 2024-11-05T21:21:20+08:00
New Revision: 4ff62052c832197054e3672df730579adce984bf
URL: https://github.com/llvm/llvm-project/commit/4ff62052c832197054e3672df730579adce984bf
DIFF: https://github.com/llvm/llvm-project/commit/4ff62052c832197054e3672df730579adce984bf.diff
LOG: [LoongArch] Add test for scalar FP rounding (#114968)
Added:
llvm/test/CodeGen/LoongArch/fp-rounding.ll
Modified:
Removed:
################################################################################
diff --git a/llvm/test/CodeGen/LoongArch/fp-rounding.ll b/llvm/test/CodeGen/LoongArch/fp-rounding.ll
new file mode 100644
index 00000000000000..19c4e3fb573da9
--- /dev/null
+++ b/llvm/test/CodeGen/LoongArch/fp-rounding.ll
@@ -0,0 +1,124 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
+; RUN: llc --mtriple=loongarch64 --mattr=-lsx < %s | FileCheck %s --check-prefix=NOLSX
+; RUN: llc --mtriple=loongarch64 --mattr=+lsx < %s | FileCheck %s --check-prefix=LSX
+
+;; ceilf
+define float @ceil_f32(float %i) nounwind {
+; NOLSX-LABEL: ceil_f32:
+; NOLSX: # %bb.0: # %entry
+; NOLSX-NEXT: b %plt(ceilf)
+;
+; LSX-LABEL: ceil_f32:
+; LSX: # %bb.0: # %entry
+; LSX-NEXT: b %plt(ceilf)
+entry:
+ %0 = call float @llvm.ceil.f32(float %i)
+ ret float %0
+}
+
+;; ceil
+define double @ceil_f64(double %i) nounwind {
+; NOLSX-LABEL: ceil_f64:
+; NOLSX: # %bb.0: # %entry
+; NOLSX-NEXT: b %plt(ceil)
+;
+; LSX-LABEL: ceil_f64:
+; LSX: # %bb.0: # %entry
+; LSX-NEXT: b %plt(ceil)
+entry:
+ %0 = call double @llvm.ceil.f64(double %i)
+ ret double %0
+}
+
+;; floorf
+define float @floor_f32(float %i) nounwind {
+; NOLSX-LABEL: floor_f32:
+; NOLSX: # %bb.0: # %entry
+; NOLSX-NEXT: b %plt(floorf)
+;
+; LSX-LABEL: floor_f32:
+; LSX: # %bb.0: # %entry
+; LSX-NEXT: b %plt(floorf)
+entry:
+ %0 = call float @llvm.floor.f32(float %i)
+ ret float %0
+}
+
+;; floor
+define double @floor_f64(double %i) nounwind {
+; NOLSX-LABEL: floor_f64:
+; NOLSX: # %bb.0: # %entry
+; NOLSX-NEXT: b %plt(floor)
+;
+; LSX-LABEL: floor_f64:
+; LSX: # %bb.0: # %entry
+; LSX-NEXT: b %plt(floor)
+entry:
+ %0 = call double @llvm.floor.f64(double %i)
+ ret double %0
+}
+
+;; truncf
+define float @trunc_f32(float %i) nounwind {
+; NOLSX-LABEL: trunc_f32:
+; NOLSX: # %bb.0: # %entry
+; NOLSX-NEXT: b %plt(truncf)
+;
+; LSX-LABEL: trunc_f32:
+; LSX: # %bb.0: # %entry
+; LSX-NEXT: b %plt(truncf)
+entry:
+ %0 = call float @llvm.trunc.f32(float %i)
+ ret float %0
+}
+
+;; trunc
+define double @trunc_f64(double %i) nounwind {
+; NOLSX-LABEL: trunc_f64:
+; NOLSX: # %bb.0: # %entry
+; NOLSX-NEXT: b %plt(trunc)
+;
+; LSX-LABEL: trunc_f64:
+; LSX: # %bb.0: # %entry
+; LSX-NEXT: b %plt(trunc)
+entry:
+ %0 = call double @llvm.trunc.f64(double %i)
+ ret double %0
+}
+
+;; roundevenf
+define float @roundeven_f32(float %i) nounwind {
+; NOLSX-LABEL: roundeven_f32:
+; NOLSX: # %bb.0: # %entry
+; NOLSX-NEXT: b %plt(roundevenf)
+;
+; LSX-LABEL: roundeven_f32:
+; LSX: # %bb.0: # %entry
+; LSX-NEXT: b %plt(roundevenf)
+entry:
+ %0 = call float @llvm.roundeven.f32(float %i)
+ ret float %0
+}
+
+;; roundeven
+define double @roundeven_f64(double %i) nounwind {
+; NOLSX-LABEL: roundeven_f64:
+; NOLSX: # %bb.0: # %entry
+; NOLSX-NEXT: b %plt(roundeven)
+;
+; LSX-LABEL: roundeven_f64:
+; LSX: # %bb.0: # %entry
+; LSX-NEXT: b %plt(roundeven)
+entry:
+ %0 = call double @llvm.roundeven.f64(double %i)
+ ret double %0
+}
+
+declare float @llvm.ceil.f32(float)
+declare double @llvm.ceil.f64(double)
+declare float @llvm.floor.f32(float)
+declare double @llvm.floor.f64(double)
+declare float @llvm.trunc.f32(float)
+declare double @llvm.trunc.f64(double)
+declare float @llvm.roundeven.f32(float)
+declare double @llvm.roundeven.f64(double)
More information about the llvm-commits
mailing list