[llvm] 9b2da14 - [RISCV] Add test cases for roundeven intrinsics. NFC
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 9 14:55:09 PST 2021
Author: Craig Topper
Date: 2021-11-09T14:54:41-08:00
New Revision: 9b2da1454075e31103189ebde2b73cc695f9e03d
URL: https://github.com/llvm/llvm-project/commit/9b2da1454075e31103189ebde2b73cc695f9e03d
DIFF: https://github.com/llvm/llvm-project/commit/9b2da1454075e31103189ebde2b73cc695f9e03d.diff
LOG: [RISCV] Add test cases for roundeven intrinsics. NFC
These just fall back to libcalls.
Added:
Modified:
llvm/test/CodeGen/RISCV/double-intrinsics.ll
llvm/test/CodeGen/RISCV/float-intrinsics.ll
llvm/test/CodeGen/RISCV/rv64i-single-softfloat.ll
Removed:
################################################################################
diff --git a/llvm/test/CodeGen/RISCV/double-intrinsics.ll b/llvm/test/CodeGen/RISCV/double-intrinsics.ll
index 7e77f698fb310..c03b65f515f09 100644
--- a/llvm/test/CodeGen/RISCV/double-intrinsics.ll
+++ b/llvm/test/CodeGen/RISCV/double-intrinsics.ll
@@ -643,6 +643,30 @@ define double @round_f64(double %a) nounwind {
ret double %1
}
+declare double @llvm.roundeven.f64(double)
+
+define double @roundeven_f64(double %a) nounwind {
+; RV32IFD-LABEL: roundeven_f64:
+; RV32IFD: # %bb.0:
+; RV32IFD-NEXT: addi sp, sp, -16
+; RV32IFD-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
+; RV32IFD-NEXT: call roundeven at plt
+; RV32IFD-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
+; RV32IFD-NEXT: addi sp, sp, 16
+; RV32IFD-NEXT: ret
+;
+; RV64IFD-LABEL: roundeven_f64:
+; RV64IFD: # %bb.0:
+; RV64IFD-NEXT: addi sp, sp, -16
+; RV64IFD-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
+; RV64IFD-NEXT: call roundeven at plt
+; RV64IFD-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
+; RV64IFD-NEXT: addi sp, sp, 16
+; RV64IFD-NEXT: ret
+ %1 = call double @llvm.roundeven.f64(double %a)
+ ret double %1
+}
+
declare iXLen @llvm.lrint.iXLen.f64(float)
define iXLen @lrint_f64(float %a) nounwind {
diff --git a/llvm/test/CodeGen/RISCV/float-intrinsics.ll b/llvm/test/CodeGen/RISCV/float-intrinsics.ll
index 8423ce61096df..a340d31a5f39e 100644
--- a/llvm/test/CodeGen/RISCV/float-intrinsics.ll
+++ b/llvm/test/CodeGen/RISCV/float-intrinsics.ll
@@ -587,6 +587,30 @@ define float @round_f32(float %a) nounwind {
ret float %1
}
+declare float @llvm.roundeven.f32(float)
+
+define float @roundeven_f32(float %a) nounwind {
+; RV32IF-LABEL: roundeven_f32:
+; RV32IF: # %bb.0:
+; RV32IF-NEXT: addi sp, sp, -16
+; RV32IF-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
+; RV32IF-NEXT: call roundevenf at plt
+; RV32IF-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
+; RV32IF-NEXT: addi sp, sp, 16
+; RV32IF-NEXT: ret
+;
+; RV64IF-LABEL: roundeven_f32:
+; RV64IF: # %bb.0:
+; RV64IF-NEXT: addi sp, sp, -16
+; RV64IF-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
+; RV64IF-NEXT: call roundevenf at plt
+; RV64IF-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
+; RV64IF-NEXT: addi sp, sp, 16
+; RV64IF-NEXT: ret
+ %1 = call float @llvm.roundeven.f32(float %a)
+ ret float %1
+}
+
declare iXLen @llvm.lrint.iXLen.f32(float)
define iXLen @lrint_f32(float %a) nounwind {
diff --git a/llvm/test/CodeGen/RISCV/rv64i-single-softfloat.ll b/llvm/test/CodeGen/RISCV/rv64i-single-softfloat.ll
index e250cff27a9f8..8527b117910fb 100644
--- a/llvm/test/CodeGen/RISCV/rv64i-single-softfloat.ll
+++ b/llvm/test/CodeGen/RISCV/rv64i-single-softfloat.ll
@@ -603,6 +603,21 @@ define float @fround_s(float %a) nounwind {
ret float %1
}
+declare float @llvm.roundeven.f32(float)
+
+define float @froundeven_s(float %a) nounwind {
+; RV64I-LABEL: froundeven_s:
+; RV64I: # %bb.0:
+; RV64I-NEXT: addi sp, sp, -16
+; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
+; RV64I-NEXT: call roundevenf at plt
+; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
+; RV64I-NEXT: addi sp, sp, 16
+; RV64I-NEXT: ret
+ %1 = call float @llvm.roundeven.f32(float %a)
+ ret float %1
+}
+
declare float @llvm.fpround.f32(float)
define float @fpround_s(float %a) nounwind {
More information about the llvm-commits
mailing list