[llvm] 99b8c46 - [RISCV] Restore non-constant srem test I accidentally deleted. NFC
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Sat Jul 10 18:02:47 PDT 2021
Author: Craig Topper
Date: 2021-07-10T18:02:13-07:00
New Revision: 99b8c4682865f54498f47389f673df5d6a3558cd
URL: https://github.com/llvm/llvm-project/commit/99b8c4682865f54498f47389f673df5d6a3558cd
DIFF: https://github.com/llvm/llvm-project/commit/99b8c4682865f54498f47389f673df5d6a3558cd.diff
LOG: [RISCV] Restore non-constant srem test I accidentally deleted. NFC
Added:
Modified:
llvm/test/CodeGen/RISCV/rem.ll
Removed:
################################################################################
diff --git a/llvm/test/CodeGen/RISCV/rem.ll b/llvm/test/CodeGen/RISCV/rem.ll
index bda53ce9731d..87f75586a5b2 100644
--- a/llvm/test/CodeGen/RISCV/rem.ll
+++ b/llvm/test/CodeGen/RISCV/rem.ll
@@ -85,11 +85,45 @@ define i32 @urem_constant_lhs(i32 %a) nounwind {
ret i32 %1
}
-define i32 @srem(i32 %a) nounwind {
+define i32 @srem(i32 %a, i32 %b) nounwind {
; RV32I-LABEL: srem:
; RV32I: # %bb.0:
; RV32I-NEXT: addi sp, sp, -16
; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
+; RV32I-NEXT: call __modsi3 at plt
+; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
+; RV32I-NEXT: addi sp, sp, 16
+; RV32I-NEXT: ret
+;
+; RV32IM-LABEL: srem:
+; RV32IM: # %bb.0:
+; RV32IM-NEXT: rem a0, a0, a1
+; RV32IM-NEXT: ret
+;
+; RV64I-LABEL: srem:
+; RV64I: # %bb.0:
+; RV64I-NEXT: addi sp, sp, -16
+; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
+; RV64I-NEXT: sext.w a0, a0
+; RV64I-NEXT: sext.w a1, a1
+; RV64I-NEXT: call __moddi3 at plt
+; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
+; RV64I-NEXT: addi sp, sp, 16
+; RV64I-NEXT: ret
+;
+; RV64IM-LABEL: srem:
+; RV64IM: # %bb.0:
+; RV64IM-NEXT: remw a0, a0, a1
+; RV64IM-NEXT: ret
+ %1 = srem i32 %a, %b
+ ret i32 %1
+}
+
+define i32 @srem_constant_lhs(i32 %a) nounwind {
+; RV32I-LABEL: srem_constant_lhs:
+; RV32I: # %bb.0:
+; RV32I-NEXT: addi sp, sp, -16
+; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
; RV32I-NEXT: mv a1, a0
; RV32I-NEXT: addi a0, zero, -10
; RV32I-NEXT: call __modsi3 at plt
@@ -97,13 +131,13 @@ define i32 @srem(i32 %a) nounwind {
; RV32I-NEXT: addi sp, sp, 16
; RV32I-NEXT: ret
;
-; RV32IM-LABEL: srem:
+; RV32IM-LABEL: srem_constant_lhs:
; RV32IM: # %bb.0:
; RV32IM-NEXT: addi a1, zero, -10
; RV32IM-NEXT: rem a0, a1, a0
; RV32IM-NEXT: ret
;
-; RV64I-LABEL: srem:
+; RV64I-LABEL: srem_constant_lhs:
; RV64I: # %bb.0:
; RV64I-NEXT: addi sp, sp, -16
; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
@@ -114,7 +148,7 @@ define i32 @srem(i32 %a) nounwind {
; RV64I-NEXT: addi sp, sp, 16
; RV64I-NEXT: ret
;
-; RV64IM-LABEL: srem:
+; RV64IM-LABEL: srem_constant_lhs:
; RV64IM: # %bb.0:
; RV64IM-NEXT: addi a1, zero, -10
; RV64IM-NEXT: remw a0, a1, a0
More information about the llvm-commits
mailing list