[llvm] 82434c7 - [LoongArch] Add test cases for div/mod to cover various extended combinations of 32-bit integers. NFC
WANG Rui via llvm-commits
llvm-commits at lists.llvm.org
Tue May 14 08:19:23 PDT 2024
Author: WANG Rui
Date: 2024-05-14T23:18:56+08:00
New Revision: 82434c70b792c4a3773515f8d3172df11e4e615f
URL: https://github.com/llvm/llvm-project/commit/82434c70b792c4a3773515f8d3172df11e4e615f
DIFF: https://github.com/llvm/llvm-project/commit/82434c70b792c4a3773515f8d3172df11e4e615f.diff
LOG: [LoongArch] Add test cases for div/mod to cover various extended combinations of 32-bit integers. NFC
Added:
Modified:
llvm/test/CodeGen/LoongArch/ir-instruction/sdiv-udiv-srem-urem.ll
Removed:
################################################################################
diff --git a/llvm/test/CodeGen/LoongArch/ir-instruction/sdiv-udiv-srem-urem.ll b/llvm/test/CodeGen/LoongArch/ir-instruction/sdiv-udiv-srem-urem.ll
index 381f69bb46f8f..2064c398948fe 100644
--- a/llvm/test/CodeGen/LoongArch/ir-instruction/sdiv-udiv-srem-urem.ll
+++ b/llvm/test/CodeGen/LoongArch/ir-instruction/sdiv-udiv-srem-urem.ll
@@ -148,6 +148,113 @@ entry:
ret i32 %r
}
+define i32 @sdiv_ui32_si32_si32(i32 signext %a, i32 signext %b) {
+; LA32-LABEL: sdiv_ui32_si32_si32:
+; LA32: # %bb.0: # %entry
+; LA32-NEXT: div.w $a0, $a0, $a1
+; LA32-NEXT: ret
+;
+; LA64-LABEL: sdiv_ui32_si32_si32:
+; LA64: # %bb.0: # %entry
+; LA64-NEXT: div.d $a0, $a0, $a1
+; LA64-NEXT: ret
+;
+; LA32-TRAP-LABEL: sdiv_ui32_si32_si32:
+; LA32-TRAP: # %bb.0: # %entry
+; LA32-TRAP-NEXT: div.w $a0, $a0, $a1
+; LA32-TRAP-NEXT: bnez $a1, .LBB4_2
+; LA32-TRAP-NEXT: # %bb.1: # %entry
+; LA32-TRAP-NEXT: break 7
+; LA32-TRAP-NEXT: .LBB4_2: # %entry
+; LA32-TRAP-NEXT: ret
+;
+; LA64-TRAP-LABEL: sdiv_ui32_si32_si32:
+; LA64-TRAP: # %bb.0: # %entry
+; LA64-TRAP-NEXT: div.d $a0, $a0, $a1
+; LA64-TRAP-NEXT: bnez $a1, .LBB4_2
+; LA64-TRAP-NEXT: # %bb.1: # %entry
+; LA64-TRAP-NEXT: break 7
+; LA64-TRAP-NEXT: .LBB4_2: # %entry
+; LA64-TRAP-NEXT: ret
+entry:
+ %r = sdiv i32 %a, %b
+ ret i32 %r
+}
+
+define signext i32 @sdiv_si32_ui32_ui32(i32 %a, i32 %b) {
+; LA32-LABEL: sdiv_si32_ui32_ui32:
+; LA32: # %bb.0: # %entry
+; LA32-NEXT: div.w $a0, $a0, $a1
+; LA32-NEXT: ret
+;
+; LA64-LABEL: sdiv_si32_ui32_ui32:
+; LA64: # %bb.0: # %entry
+; LA64-NEXT: addi.w $a1, $a1, 0
+; LA64-NEXT: addi.w $a0, $a0, 0
+; LA64-NEXT: div.d $a0, $a0, $a1
+; LA64-NEXT: addi.w $a0, $a0, 0
+; LA64-NEXT: ret
+;
+; LA32-TRAP-LABEL: sdiv_si32_ui32_ui32:
+; LA32-TRAP: # %bb.0: # %entry
+; LA32-TRAP-NEXT: div.w $a0, $a0, $a1
+; LA32-TRAP-NEXT: bnez $a1, .LBB5_2
+; LA32-TRAP-NEXT: # %bb.1: # %entry
+; LA32-TRAP-NEXT: break 7
+; LA32-TRAP-NEXT: .LBB5_2: # %entry
+; LA32-TRAP-NEXT: ret
+;
+; LA64-TRAP-LABEL: sdiv_si32_ui32_ui32:
+; LA64-TRAP: # %bb.0: # %entry
+; LA64-TRAP-NEXT: addi.w $a1, $a1, 0
+; LA64-TRAP-NEXT: addi.w $a0, $a0, 0
+; LA64-TRAP-NEXT: div.d $a0, $a0, $a1
+; LA64-TRAP-NEXT: bnez $a1, .LBB5_2
+; LA64-TRAP-NEXT: # %bb.1: # %entry
+; LA64-TRAP-NEXT: break 7
+; LA64-TRAP-NEXT: .LBB5_2: # %entry
+; LA64-TRAP-NEXT: addi.w $a0, $a0, 0
+; LA64-TRAP-NEXT: ret
+entry:
+ %r = sdiv i32 %a, %b
+ ret i32 %r
+}
+
+define signext i32 @sdiv_si32_si32_si32(i32 signext %a, i32 signext %b) {
+; LA32-LABEL: sdiv_si32_si32_si32:
+; LA32: # %bb.0: # %entry
+; LA32-NEXT: div.w $a0, $a0, $a1
+; LA32-NEXT: ret
+;
+; LA64-LABEL: sdiv_si32_si32_si32:
+; LA64: # %bb.0: # %entry
+; LA64-NEXT: div.d $a0, $a0, $a1
+; LA64-NEXT: addi.w $a0, $a0, 0
+; LA64-NEXT: ret
+;
+; LA32-TRAP-LABEL: sdiv_si32_si32_si32:
+; LA32-TRAP: # %bb.0: # %entry
+; LA32-TRAP-NEXT: div.w $a0, $a0, $a1
+; LA32-TRAP-NEXT: bnez $a1, .LBB6_2
+; LA32-TRAP-NEXT: # %bb.1: # %entry
+; LA32-TRAP-NEXT: break 7
+; LA32-TRAP-NEXT: .LBB6_2: # %entry
+; LA32-TRAP-NEXT: ret
+;
+; LA64-TRAP-LABEL: sdiv_si32_si32_si32:
+; LA64-TRAP: # %bb.0: # %entry
+; LA64-TRAP-NEXT: div.d $a0, $a0, $a1
+; LA64-TRAP-NEXT: bnez $a1, .LBB6_2
+; LA64-TRAP-NEXT: # %bb.1: # %entry
+; LA64-TRAP-NEXT: break 7
+; LA64-TRAP-NEXT: .LBB6_2: # %entry
+; LA64-TRAP-NEXT: addi.w $a0, $a0, 0
+; LA64-TRAP-NEXT: ret
+entry:
+ %r = sdiv i32 %a, %b
+ ret i32 %r
+}
+
define i64 @sdiv_i64(i64 %a, i64 %b) {
; LA32-LABEL: sdiv_i64:
; LA32: # %bb.0: # %entry
@@ -179,10 +286,10 @@ define i64 @sdiv_i64(i64 %a, i64 %b) {
; LA64-TRAP-LABEL: sdiv_i64:
; LA64-TRAP: # %bb.0: # %entry
; LA64-TRAP-NEXT: div.d $a0, $a0, $a1
-; LA64-TRAP-NEXT: bnez $a1, .LBB4_2
+; LA64-TRAP-NEXT: bnez $a1, .LBB7_2
; LA64-TRAP-NEXT: # %bb.1: # %entry
; LA64-TRAP-NEXT: break 7
-; LA64-TRAP-NEXT: .LBB4_2: # %entry
+; LA64-TRAP-NEXT: .LBB7_2: # %entry
; LA64-TRAP-NEXT: ret
entry:
%r = sdiv i64 %a, %b
@@ -230,10 +337,10 @@ define i8 @udiv_i8(i8 %a, i8 %b) {
; LA32-TRAP-NEXT: andi $a1, $a1, 255
; LA32-TRAP-NEXT: andi $a0, $a0, 255
; LA32-TRAP-NEXT: div.wu $a0, $a0, $a1
-; LA32-TRAP-NEXT: bnez $a1, .LBB6_2
+; LA32-TRAP-NEXT: bnez $a1, .LBB9_2
; LA32-TRAP-NEXT: # %bb.1: # %entry
; LA32-TRAP-NEXT: break 7
-; LA32-TRAP-NEXT: .LBB6_2: # %entry
+; LA32-TRAP-NEXT: .LBB9_2: # %entry
; LA32-TRAP-NEXT: ret
;
; LA64-TRAP-LABEL: udiv_i8:
@@ -241,10 +348,10 @@ define i8 @udiv_i8(i8 %a, i8 %b) {
; LA64-TRAP-NEXT: andi $a1, $a1, 255
; LA64-TRAP-NEXT: andi $a0, $a0, 255
; LA64-TRAP-NEXT: div.du $a0, $a0, $a1
-; LA64-TRAP-NEXT: bnez $a1, .LBB6_2
+; LA64-TRAP-NEXT: bnez $a1, .LBB9_2
; LA64-TRAP-NEXT: # %bb.1: # %entry
; LA64-TRAP-NEXT: break 7
-; LA64-TRAP-NEXT: .LBB6_2: # %entry
+; LA64-TRAP-NEXT: .LBB9_2: # %entry
; LA64-TRAP-NEXT: ret
entry:
%r = udiv i8 %a, %b
@@ -271,10 +378,10 @@ define i16 @udiv_i16(i16 %a, i16 %b) {
; LA32-TRAP-NEXT: bstrpick.w $a1, $a1, 15, 0
; LA32-TRAP-NEXT: bstrpick.w $a0, $a0, 15, 0
; LA32-TRAP-NEXT: div.wu $a0, $a0, $a1
-; LA32-TRAP-NEXT: bnez $a1, .LBB7_2
+; LA32-TRAP-NEXT: bnez $a1, .LBB10_2
; LA32-TRAP-NEXT: # %bb.1: # %entry
; LA32-TRAP-NEXT: break 7
-; LA32-TRAP-NEXT: .LBB7_2: # %entry
+; LA32-TRAP-NEXT: .LBB10_2: # %entry
; LA32-TRAP-NEXT: ret
;
; LA64-TRAP-LABEL: udiv_i16:
@@ -282,10 +389,10 @@ define i16 @udiv_i16(i16 %a, i16 %b) {
; LA64-TRAP-NEXT: bstrpick.d $a1, $a1, 15, 0
; LA64-TRAP-NEXT: bstrpick.d $a0, $a0, 15, 0
; LA64-TRAP-NEXT: div.du $a0, $a0, $a1
-; LA64-TRAP-NEXT: bnez $a1, .LBB7_2
+; LA64-TRAP-NEXT: bnez $a1, .LBB10_2
; LA64-TRAP-NEXT: # %bb.1: # %entry
; LA64-TRAP-NEXT: break 7
-; LA64-TRAP-NEXT: .LBB7_2: # %entry
+; LA64-TRAP-NEXT: .LBB10_2: # %entry
; LA64-TRAP-NEXT: ret
entry:
%r = udiv i16 %a, %b
@@ -308,10 +415,10 @@ define i32 @udiv_i32(i32 %a, i32 %b) {
; LA32-TRAP-LABEL: udiv_i32:
; LA32-TRAP: # %bb.0: # %entry
; LA32-TRAP-NEXT: div.wu $a0, $a0, $a1
-; LA32-TRAP-NEXT: bnez $a1, .LBB8_2
+; LA32-TRAP-NEXT: bnez $a1, .LBB11_2
; LA32-TRAP-NEXT: # %bb.1: # %entry
; LA32-TRAP-NEXT: break 7
-; LA32-TRAP-NEXT: .LBB8_2: # %entry
+; LA32-TRAP-NEXT: .LBB11_2: # %entry
; LA32-TRAP-NEXT: ret
;
; LA64-TRAP-LABEL: udiv_i32:
@@ -319,10 +426,125 @@ define i32 @udiv_i32(i32 %a, i32 %b) {
; LA64-TRAP-NEXT: bstrpick.d $a1, $a1, 31, 0
; LA64-TRAP-NEXT: bstrpick.d $a0, $a0, 31, 0
; LA64-TRAP-NEXT: div.du $a0, $a0, $a1
-; LA64-TRAP-NEXT: bnez $a1, .LBB8_2
+; LA64-TRAP-NEXT: bnez $a1, .LBB11_2
+; LA64-TRAP-NEXT: # %bb.1: # %entry
+; LA64-TRAP-NEXT: break 7
+; LA64-TRAP-NEXT: .LBB11_2: # %entry
+; LA64-TRAP-NEXT: ret
+entry:
+ %r = udiv i32 %a, %b
+ ret i32 %r
+}
+
+define i32 @udiv_ui32_si32_si32(i32 signext %a, i32 signext %b) {
+; LA32-LABEL: udiv_ui32_si32_si32:
+; LA32: # %bb.0: # %entry
+; LA32-NEXT: div.wu $a0, $a0, $a1
+; LA32-NEXT: ret
+;
+; LA64-LABEL: udiv_ui32_si32_si32:
+; LA64: # %bb.0: # %entry
+; LA64-NEXT: bstrpick.d $a1, $a1, 31, 0
+; LA64-NEXT: bstrpick.d $a0, $a0, 31, 0
+; LA64-NEXT: div.du $a0, $a0, $a1
+; LA64-NEXT: ret
+;
+; LA32-TRAP-LABEL: udiv_ui32_si32_si32:
+; LA32-TRAP: # %bb.0: # %entry
+; LA32-TRAP-NEXT: div.wu $a0, $a0, $a1
+; LA32-TRAP-NEXT: bnez $a1, .LBB12_2
+; LA32-TRAP-NEXT: # %bb.1: # %entry
+; LA32-TRAP-NEXT: break 7
+; LA32-TRAP-NEXT: .LBB12_2: # %entry
+; LA32-TRAP-NEXT: ret
+;
+; LA64-TRAP-LABEL: udiv_ui32_si32_si32:
+; LA64-TRAP: # %bb.0: # %entry
+; LA64-TRAP-NEXT: bstrpick.d $a1, $a1, 31, 0
+; LA64-TRAP-NEXT: bstrpick.d $a0, $a0, 31, 0
+; LA64-TRAP-NEXT: div.du $a0, $a0, $a1
+; LA64-TRAP-NEXT: bnez $a1, .LBB12_2
+; LA64-TRAP-NEXT: # %bb.1: # %entry
+; LA64-TRAP-NEXT: break 7
+; LA64-TRAP-NEXT: .LBB12_2: # %entry
+; LA64-TRAP-NEXT: ret
+entry:
+ %r = udiv i32 %a, %b
+ ret i32 %r
+}
+
+define signext i32 @udiv_si32_ui32_ui32(i32 %a, i32 %b) {
+; LA32-LABEL: udiv_si32_ui32_ui32:
+; LA32: # %bb.0: # %entry
+; LA32-NEXT: div.wu $a0, $a0, $a1
+; LA32-NEXT: ret
+;
+; LA64-LABEL: udiv_si32_ui32_ui32:
+; LA64: # %bb.0: # %entry
+; LA64-NEXT: bstrpick.d $a1, $a1, 31, 0
+; LA64-NEXT: bstrpick.d $a0, $a0, 31, 0
+; LA64-NEXT: div.du $a0, $a0, $a1
+; LA64-NEXT: addi.w $a0, $a0, 0
+; LA64-NEXT: ret
+;
+; LA32-TRAP-LABEL: udiv_si32_ui32_ui32:
+; LA32-TRAP: # %bb.0: # %entry
+; LA32-TRAP-NEXT: div.wu $a0, $a0, $a1
+; LA32-TRAP-NEXT: bnez $a1, .LBB13_2
+; LA32-TRAP-NEXT: # %bb.1: # %entry
+; LA32-TRAP-NEXT: break 7
+; LA32-TRAP-NEXT: .LBB13_2: # %entry
+; LA32-TRAP-NEXT: ret
+;
+; LA64-TRAP-LABEL: udiv_si32_ui32_ui32:
+; LA64-TRAP: # %bb.0: # %entry
+; LA64-TRAP-NEXT: bstrpick.d $a1, $a1, 31, 0
+; LA64-TRAP-NEXT: bstrpick.d $a0, $a0, 31, 0
+; LA64-TRAP-NEXT: div.du $a0, $a0, $a1
+; LA64-TRAP-NEXT: bnez $a1, .LBB13_2
+; LA64-TRAP-NEXT: # %bb.1: # %entry
+; LA64-TRAP-NEXT: break 7
+; LA64-TRAP-NEXT: .LBB13_2: # %entry
+; LA64-TRAP-NEXT: addi.w $a0, $a0, 0
+; LA64-TRAP-NEXT: ret
+entry:
+ %r = udiv i32 %a, %b
+ ret i32 %r
+}
+
+define signext i32 @udiv_si32_si32_si32(i32 signext %a, i32 signext %b) {
+; LA32-LABEL: udiv_si32_si32_si32:
+; LA32: # %bb.0: # %entry
+; LA32-NEXT: div.wu $a0, $a0, $a1
+; LA32-NEXT: ret
+;
+; LA64-LABEL: udiv_si32_si32_si32:
+; LA64: # %bb.0: # %entry
+; LA64-NEXT: bstrpick.d $a1, $a1, 31, 0
+; LA64-NEXT: bstrpick.d $a0, $a0, 31, 0
+; LA64-NEXT: div.du $a0, $a0, $a1
+; LA64-NEXT: addi.w $a0, $a0, 0
+; LA64-NEXT: ret
+;
+; LA32-TRAP-LABEL: udiv_si32_si32_si32:
+; LA32-TRAP: # %bb.0: # %entry
+; LA32-TRAP-NEXT: div.wu $a0, $a0, $a1
+; LA32-TRAP-NEXT: bnez $a1, .LBB14_2
+; LA32-TRAP-NEXT: # %bb.1: # %entry
+; LA32-TRAP-NEXT: break 7
+; LA32-TRAP-NEXT: .LBB14_2: # %entry
+; LA32-TRAP-NEXT: ret
+;
+; LA64-TRAP-LABEL: udiv_si32_si32_si32:
+; LA64-TRAP: # %bb.0: # %entry
+; LA64-TRAP-NEXT: bstrpick.d $a1, $a1, 31, 0
+; LA64-TRAP-NEXT: bstrpick.d $a0, $a0, 31, 0
+; LA64-TRAP-NEXT: div.du $a0, $a0, $a1
+; LA64-TRAP-NEXT: bnez $a1, .LBB14_2
; LA64-TRAP-NEXT: # %bb.1: # %entry
; LA64-TRAP-NEXT: break 7
-; LA64-TRAP-NEXT: .LBB8_2: # %entry
+; LA64-TRAP-NEXT: .LBB14_2: # %entry
+; LA64-TRAP-NEXT: addi.w $a0, $a0, 0
; LA64-TRAP-NEXT: ret
entry:
%r = udiv i32 %a, %b
@@ -360,10 +582,10 @@ define i64 @udiv_i64(i64 %a, i64 %b) {
; LA64-TRAP-LABEL: udiv_i64:
; LA64-TRAP: # %bb.0: # %entry
; LA64-TRAP-NEXT: div.du $a0, $a0, $a1
-; LA64-TRAP-NEXT: bnez $a1, .LBB9_2
+; LA64-TRAP-NEXT: bnez $a1, .LBB15_2
; LA64-TRAP-NEXT: # %bb.1: # %entry
; LA64-TRAP-NEXT: break 7
-; LA64-TRAP-NEXT: .LBB9_2: # %entry
+; LA64-TRAP-NEXT: .LBB15_2: # %entry
; LA64-TRAP-NEXT: ret
entry:
%r = udiv i64 %a, %b
@@ -415,10 +637,10 @@ define i8 @srem_i8(i8 %a, i8 %b) {
; LA32-TRAP-NEXT: ext.w.b $a1, $a1
; LA32-TRAP-NEXT: ext.w.b $a0, $a0
; LA32-TRAP-NEXT: mod.w $a0, $a0, $a1
-; LA32-TRAP-NEXT: bnez $a1, .LBB11_2
+; LA32-TRAP-NEXT: bnez $a1, .LBB17_2
; LA32-TRAP-NEXT: # %bb.1: # %entry
; LA32-TRAP-NEXT: break 7
-; LA32-TRAP-NEXT: .LBB11_2: # %entry
+; LA32-TRAP-NEXT: .LBB17_2: # %entry
; LA32-TRAP-NEXT: ret
;
; LA64-TRAP-LABEL: srem_i8:
@@ -426,10 +648,10 @@ define i8 @srem_i8(i8 %a, i8 %b) {
; LA64-TRAP-NEXT: ext.w.b $a1, $a1
; LA64-TRAP-NEXT: ext.w.b $a0, $a0
; LA64-TRAP-NEXT: mod.d $a0, $a0, $a1
-; LA64-TRAP-NEXT: bnez $a1, .LBB11_2
+; LA64-TRAP-NEXT: bnez $a1, .LBB17_2
; LA64-TRAP-NEXT: # %bb.1: # %entry
; LA64-TRAP-NEXT: break 7
-; LA64-TRAP-NEXT: .LBB11_2: # %entry
+; LA64-TRAP-NEXT: .LBB17_2: # %entry
; LA64-TRAP-NEXT: ret
entry:
%r = srem i8 %a, %b
@@ -456,10 +678,10 @@ define i16 @srem_i16(i16 %a, i16 %b) {
; LA32-TRAP-NEXT: ext.w.h $a1, $a1
; LA32-TRAP-NEXT: ext.w.h $a0, $a0
; LA32-TRAP-NEXT: mod.w $a0, $a0, $a1
-; LA32-TRAP-NEXT: bnez $a1, .LBB12_2
+; LA32-TRAP-NEXT: bnez $a1, .LBB18_2
; LA32-TRAP-NEXT: # %bb.1: # %entry
; LA32-TRAP-NEXT: break 7
-; LA32-TRAP-NEXT: .LBB12_2: # %entry
+; LA32-TRAP-NEXT: .LBB18_2: # %entry
; LA32-TRAP-NEXT: ret
;
; LA64-TRAP-LABEL: srem_i16:
@@ -467,10 +689,10 @@ define i16 @srem_i16(i16 %a, i16 %b) {
; LA64-TRAP-NEXT: ext.w.h $a1, $a1
; LA64-TRAP-NEXT: ext.w.h $a0, $a0
; LA64-TRAP-NEXT: mod.d $a0, $a0, $a1
-; LA64-TRAP-NEXT: bnez $a1, .LBB12_2
+; LA64-TRAP-NEXT: bnez $a1, .LBB18_2
; LA64-TRAP-NEXT: # %bb.1: # %entry
; LA64-TRAP-NEXT: break 7
-; LA64-TRAP-NEXT: .LBB12_2: # %entry
+; LA64-TRAP-NEXT: .LBB18_2: # %entry
; LA64-TRAP-NEXT: ret
entry:
%r = srem i16 %a, %b
@@ -493,10 +715,10 @@ define i32 @srem_i32(i32 %a, i32 %b) {
; LA32-TRAP-LABEL: srem_i32:
; LA32-TRAP: # %bb.0: # %entry
; LA32-TRAP-NEXT: mod.w $a0, $a0, $a1
-; LA32-TRAP-NEXT: bnez $a1, .LBB13_2
+; LA32-TRAP-NEXT: bnez $a1, .LBB19_2
; LA32-TRAP-NEXT: # %bb.1: # %entry
; LA32-TRAP-NEXT: break 7
-; LA32-TRAP-NEXT: .LBB13_2: # %entry
+; LA32-TRAP-NEXT: .LBB19_2: # %entry
; LA32-TRAP-NEXT: ret
;
; LA64-TRAP-LABEL: srem_i32:
@@ -504,10 +726,113 @@ define i32 @srem_i32(i32 %a, i32 %b) {
; LA64-TRAP-NEXT: addi.w $a1, $a1, 0
; LA64-TRAP-NEXT: addi.w $a0, $a0, 0
; LA64-TRAP-NEXT: mod.d $a0, $a0, $a1
-; LA64-TRAP-NEXT: bnez $a1, .LBB13_2
+; LA64-TRAP-NEXT: bnez $a1, .LBB19_2
; LA64-TRAP-NEXT: # %bb.1: # %entry
; LA64-TRAP-NEXT: break 7
-; LA64-TRAP-NEXT: .LBB13_2: # %entry
+; LA64-TRAP-NEXT: .LBB19_2: # %entry
+; LA64-TRAP-NEXT: ret
+entry:
+ %r = srem i32 %a, %b
+ ret i32 %r
+}
+
+define i32 @srem_ui32_si32_si32(i32 signext %a, i32 signext %b) {
+; LA32-LABEL: srem_ui32_si32_si32:
+; LA32: # %bb.0: # %entry
+; LA32-NEXT: mod.w $a0, $a0, $a1
+; LA32-NEXT: ret
+;
+; LA64-LABEL: srem_ui32_si32_si32:
+; LA64: # %bb.0: # %entry
+; LA64-NEXT: mod.d $a0, $a0, $a1
+; LA64-NEXT: ret
+;
+; LA32-TRAP-LABEL: srem_ui32_si32_si32:
+; LA32-TRAP: # %bb.0: # %entry
+; LA32-TRAP-NEXT: mod.w $a0, $a0, $a1
+; LA32-TRAP-NEXT: bnez $a1, .LBB20_2
+; LA32-TRAP-NEXT: # %bb.1: # %entry
+; LA32-TRAP-NEXT: break 7
+; LA32-TRAP-NEXT: .LBB20_2: # %entry
+; LA32-TRAP-NEXT: ret
+;
+; LA64-TRAP-LABEL: srem_ui32_si32_si32:
+; LA64-TRAP: # %bb.0: # %entry
+; LA64-TRAP-NEXT: mod.d $a0, $a0, $a1
+; LA64-TRAP-NEXT: bnez $a1, .LBB20_2
+; LA64-TRAP-NEXT: # %bb.1: # %entry
+; LA64-TRAP-NEXT: break 7
+; LA64-TRAP-NEXT: .LBB20_2: # %entry
+; LA64-TRAP-NEXT: ret
+entry:
+ %r = srem i32 %a, %b
+ ret i32 %r
+}
+
+define signext i32 @srem_si32_ui32_ui32(i32 %a, i32 %b) {
+; LA32-LABEL: srem_si32_ui32_ui32:
+; LA32: # %bb.0: # %entry
+; LA32-NEXT: mod.w $a0, $a0, $a1
+; LA32-NEXT: ret
+;
+; LA64-LABEL: srem_si32_ui32_ui32:
+; LA64: # %bb.0: # %entry
+; LA64-NEXT: addi.w $a1, $a1, 0
+; LA64-NEXT: addi.w $a0, $a0, 0
+; LA64-NEXT: mod.d $a0, $a0, $a1
+; LA64-NEXT: ret
+;
+; LA32-TRAP-LABEL: srem_si32_ui32_ui32:
+; LA32-TRAP: # %bb.0: # %entry
+; LA32-TRAP-NEXT: mod.w $a0, $a0, $a1
+; LA32-TRAP-NEXT: bnez $a1, .LBB21_2
+; LA32-TRAP-NEXT: # %bb.1: # %entry
+; LA32-TRAP-NEXT: break 7
+; LA32-TRAP-NEXT: .LBB21_2: # %entry
+; LA32-TRAP-NEXT: ret
+;
+; LA64-TRAP-LABEL: srem_si32_ui32_ui32:
+; LA64-TRAP: # %bb.0: # %entry
+; LA64-TRAP-NEXT: addi.w $a1, $a1, 0
+; LA64-TRAP-NEXT: addi.w $a0, $a0, 0
+; LA64-TRAP-NEXT: mod.d $a0, $a0, $a1
+; LA64-TRAP-NEXT: bnez $a1, .LBB21_2
+; LA64-TRAP-NEXT: # %bb.1: # %entry
+; LA64-TRAP-NEXT: break 7
+; LA64-TRAP-NEXT: .LBB21_2: # %entry
+; LA64-TRAP-NEXT: ret
+entry:
+ %r = srem i32 %a, %b
+ ret i32 %r
+}
+
+define signext i32 @srem_si32_si32_si32(i32 signext %a, i32 signext %b) {
+; LA32-LABEL: srem_si32_si32_si32:
+; LA32: # %bb.0: # %entry
+; LA32-NEXT: mod.w $a0, $a0, $a1
+; LA32-NEXT: ret
+;
+; LA64-LABEL: srem_si32_si32_si32:
+; LA64: # %bb.0: # %entry
+; LA64-NEXT: mod.d $a0, $a0, $a1
+; LA64-NEXT: ret
+;
+; LA32-TRAP-LABEL: srem_si32_si32_si32:
+; LA32-TRAP: # %bb.0: # %entry
+; LA32-TRAP-NEXT: mod.w $a0, $a0, $a1
+; LA32-TRAP-NEXT: bnez $a1, .LBB22_2
+; LA32-TRAP-NEXT: # %bb.1: # %entry
+; LA32-TRAP-NEXT: break 7
+; LA32-TRAP-NEXT: .LBB22_2: # %entry
+; LA32-TRAP-NEXT: ret
+;
+; LA64-TRAP-LABEL: srem_si32_si32_si32:
+; LA64-TRAP: # %bb.0: # %entry
+; LA64-TRAP-NEXT: mod.d $a0, $a0, $a1
+; LA64-TRAP-NEXT: bnez $a1, .LBB22_2
+; LA64-TRAP-NEXT: # %bb.1: # %entry
+; LA64-TRAP-NEXT: break 7
+; LA64-TRAP-NEXT: .LBB22_2: # %entry
; LA64-TRAP-NEXT: ret
entry:
%r = srem i32 %a, %b
@@ -545,10 +870,10 @@ define i64 @srem_i64(i64 %a, i64 %b) {
; LA64-TRAP-LABEL: srem_i64:
; LA64-TRAP: # %bb.0: # %entry
; LA64-TRAP-NEXT: mod.d $a0, $a0, $a1
-; LA64-TRAP-NEXT: bnez $a1, .LBB14_2
+; LA64-TRAP-NEXT: bnez $a1, .LBB23_2
; LA64-TRAP-NEXT: # %bb.1: # %entry
; LA64-TRAP-NEXT: break 7
-; LA64-TRAP-NEXT: .LBB14_2: # %entry
+; LA64-TRAP-NEXT: .LBB23_2: # %entry
; LA64-TRAP-NEXT: ret
entry:
%r = srem i64 %a, %b
@@ -600,10 +925,10 @@ define i8 @urem_i8(i8 %a, i8 %b) {
; LA32-TRAP-NEXT: andi $a1, $a1, 255
; LA32-TRAP-NEXT: andi $a0, $a0, 255
; LA32-TRAP-NEXT: mod.wu $a0, $a0, $a1
-; LA32-TRAP-NEXT: bnez $a1, .LBB16_2
+; LA32-TRAP-NEXT: bnez $a1, .LBB25_2
; LA32-TRAP-NEXT: # %bb.1: # %entry
; LA32-TRAP-NEXT: break 7
-; LA32-TRAP-NEXT: .LBB16_2: # %entry
+; LA32-TRAP-NEXT: .LBB25_2: # %entry
; LA32-TRAP-NEXT: ret
;
; LA64-TRAP-LABEL: urem_i8:
@@ -611,10 +936,10 @@ define i8 @urem_i8(i8 %a, i8 %b) {
; LA64-TRAP-NEXT: andi $a1, $a1, 255
; LA64-TRAP-NEXT: andi $a0, $a0, 255
; LA64-TRAP-NEXT: mod.du $a0, $a0, $a1
-; LA64-TRAP-NEXT: bnez $a1, .LBB16_2
+; LA64-TRAP-NEXT: bnez $a1, .LBB25_2
; LA64-TRAP-NEXT: # %bb.1: # %entry
; LA64-TRAP-NEXT: break 7
-; LA64-TRAP-NEXT: .LBB16_2: # %entry
+; LA64-TRAP-NEXT: .LBB25_2: # %entry
; LA64-TRAP-NEXT: ret
entry:
%r = urem i8 %a, %b
@@ -641,10 +966,10 @@ define i16 @urem_i16(i16 %a, i16 %b) {
; LA32-TRAP-NEXT: bstrpick.w $a1, $a1, 15, 0
; LA32-TRAP-NEXT: bstrpick.w $a0, $a0, 15, 0
; LA32-TRAP-NEXT: mod.wu $a0, $a0, $a1
-; LA32-TRAP-NEXT: bnez $a1, .LBB17_2
+; LA32-TRAP-NEXT: bnez $a1, .LBB26_2
; LA32-TRAP-NEXT: # %bb.1: # %entry
; LA32-TRAP-NEXT: break 7
-; LA32-TRAP-NEXT: .LBB17_2: # %entry
+; LA32-TRAP-NEXT: .LBB26_2: # %entry
; LA32-TRAP-NEXT: ret
;
; LA64-TRAP-LABEL: urem_i16:
@@ -652,10 +977,10 @@ define i16 @urem_i16(i16 %a, i16 %b) {
; LA64-TRAP-NEXT: bstrpick.d $a1, $a1, 15, 0
; LA64-TRAP-NEXT: bstrpick.d $a0, $a0, 15, 0
; LA64-TRAP-NEXT: mod.du $a0, $a0, $a1
-; LA64-TRAP-NEXT: bnez $a1, .LBB17_2
+; LA64-TRAP-NEXT: bnez $a1, .LBB26_2
; LA64-TRAP-NEXT: # %bb.1: # %entry
; LA64-TRAP-NEXT: break 7
-; LA64-TRAP-NEXT: .LBB17_2: # %entry
+; LA64-TRAP-NEXT: .LBB26_2: # %entry
; LA64-TRAP-NEXT: ret
entry:
%r = urem i16 %a, %b
@@ -678,10 +1003,10 @@ define i32 @urem_i32(i32 %a, i32 %b) {
; LA32-TRAP-LABEL: urem_i32:
; LA32-TRAP: # %bb.0: # %entry
; LA32-TRAP-NEXT: mod.wu $a0, $a0, $a1
-; LA32-TRAP-NEXT: bnez $a1, .LBB18_2
+; LA32-TRAP-NEXT: bnez $a1, .LBB27_2
; LA32-TRAP-NEXT: # %bb.1: # %entry
; LA32-TRAP-NEXT: break 7
-; LA32-TRAP-NEXT: .LBB18_2: # %entry
+; LA32-TRAP-NEXT: .LBB27_2: # %entry
; LA32-TRAP-NEXT: ret
;
; LA64-TRAP-LABEL: urem_i32:
@@ -689,10 +1014,125 @@ define i32 @urem_i32(i32 %a, i32 %b) {
; LA64-TRAP-NEXT: bstrpick.d $a1, $a1, 31, 0
; LA64-TRAP-NEXT: bstrpick.d $a0, $a0, 31, 0
; LA64-TRAP-NEXT: mod.du $a0, $a0, $a1
-; LA64-TRAP-NEXT: bnez $a1, .LBB18_2
+; LA64-TRAP-NEXT: bnez $a1, .LBB27_2
; LA64-TRAP-NEXT: # %bb.1: # %entry
; LA64-TRAP-NEXT: break 7
-; LA64-TRAP-NEXT: .LBB18_2: # %entry
+; LA64-TRAP-NEXT: .LBB27_2: # %entry
+; LA64-TRAP-NEXT: ret
+entry:
+ %r = urem i32 %a, %b
+ ret i32 %r
+}
+
+define i32 @urem_ui32_si32_si32(i32 signext %a, i32 signext %b) {
+; LA32-LABEL: urem_ui32_si32_si32:
+; LA32: # %bb.0: # %entry
+; LA32-NEXT: mod.wu $a0, $a0, $a1
+; LA32-NEXT: ret
+;
+; LA64-LABEL: urem_ui32_si32_si32:
+; LA64: # %bb.0: # %entry
+; LA64-NEXT: bstrpick.d $a1, $a1, 31, 0
+; LA64-NEXT: bstrpick.d $a0, $a0, 31, 0
+; LA64-NEXT: mod.du $a0, $a0, $a1
+; LA64-NEXT: ret
+;
+; LA32-TRAP-LABEL: urem_ui32_si32_si32:
+; LA32-TRAP: # %bb.0: # %entry
+; LA32-TRAP-NEXT: mod.wu $a0, $a0, $a1
+; LA32-TRAP-NEXT: bnez $a1, .LBB28_2
+; LA32-TRAP-NEXT: # %bb.1: # %entry
+; LA32-TRAP-NEXT: break 7
+; LA32-TRAP-NEXT: .LBB28_2: # %entry
+; LA32-TRAP-NEXT: ret
+;
+; LA64-TRAP-LABEL: urem_ui32_si32_si32:
+; LA64-TRAP: # %bb.0: # %entry
+; LA64-TRAP-NEXT: bstrpick.d $a1, $a1, 31, 0
+; LA64-TRAP-NEXT: bstrpick.d $a0, $a0, 31, 0
+; LA64-TRAP-NEXT: mod.du $a0, $a0, $a1
+; LA64-TRAP-NEXT: bnez $a1, .LBB28_2
+; LA64-TRAP-NEXT: # %bb.1: # %entry
+; LA64-TRAP-NEXT: break 7
+; LA64-TRAP-NEXT: .LBB28_2: # %entry
+; LA64-TRAP-NEXT: ret
+entry:
+ %r = urem i32 %a, %b
+ ret i32 %r
+}
+
+define signext i32 @urem_si32_ui32_ui32(i32 %a, i32 %b) {
+; LA32-LABEL: urem_si32_ui32_ui32:
+; LA32: # %bb.0: # %entry
+; LA32-NEXT: mod.wu $a0, $a0, $a1
+; LA32-NEXT: ret
+;
+; LA64-LABEL: urem_si32_ui32_ui32:
+; LA64: # %bb.0: # %entry
+; LA64-NEXT: bstrpick.d $a1, $a1, 31, 0
+; LA64-NEXT: bstrpick.d $a0, $a0, 31, 0
+; LA64-NEXT: mod.du $a0, $a0, $a1
+; LA64-NEXT: addi.w $a0, $a0, 0
+; LA64-NEXT: ret
+;
+; LA32-TRAP-LABEL: urem_si32_ui32_ui32:
+; LA32-TRAP: # %bb.0: # %entry
+; LA32-TRAP-NEXT: mod.wu $a0, $a0, $a1
+; LA32-TRAP-NEXT: bnez $a1, .LBB29_2
+; LA32-TRAP-NEXT: # %bb.1: # %entry
+; LA32-TRAP-NEXT: break 7
+; LA32-TRAP-NEXT: .LBB29_2: # %entry
+; LA32-TRAP-NEXT: ret
+;
+; LA64-TRAP-LABEL: urem_si32_ui32_ui32:
+; LA64-TRAP: # %bb.0: # %entry
+; LA64-TRAP-NEXT: bstrpick.d $a1, $a1, 31, 0
+; LA64-TRAP-NEXT: bstrpick.d $a0, $a0, 31, 0
+; LA64-TRAP-NEXT: mod.du $a0, $a0, $a1
+; LA64-TRAP-NEXT: bnez $a1, .LBB29_2
+; LA64-TRAP-NEXT: # %bb.1: # %entry
+; LA64-TRAP-NEXT: break 7
+; LA64-TRAP-NEXT: .LBB29_2: # %entry
+; LA64-TRAP-NEXT: addi.w $a0, $a0, 0
+; LA64-TRAP-NEXT: ret
+entry:
+ %r = urem i32 %a, %b
+ ret i32 %r
+}
+
+define signext i32 @urem_si32_si32_si32(i32 signext %a, i32 signext %b) {
+; LA32-LABEL: urem_si32_si32_si32:
+; LA32: # %bb.0: # %entry
+; LA32-NEXT: mod.wu $a0, $a0, $a1
+; LA32-NEXT: ret
+;
+; LA64-LABEL: urem_si32_si32_si32:
+; LA64: # %bb.0: # %entry
+; LA64-NEXT: bstrpick.d $a1, $a1, 31, 0
+; LA64-NEXT: bstrpick.d $a0, $a0, 31, 0
+; LA64-NEXT: mod.du $a0, $a0, $a1
+; LA64-NEXT: addi.w $a0, $a0, 0
+; LA64-NEXT: ret
+;
+; LA32-TRAP-LABEL: urem_si32_si32_si32:
+; LA32-TRAP: # %bb.0: # %entry
+; LA32-TRAP-NEXT: mod.wu $a0, $a0, $a1
+; LA32-TRAP-NEXT: bnez $a1, .LBB30_2
+; LA32-TRAP-NEXT: # %bb.1: # %entry
+; LA32-TRAP-NEXT: break 7
+; LA32-TRAP-NEXT: .LBB30_2: # %entry
+; LA32-TRAP-NEXT: ret
+;
+; LA64-TRAP-LABEL: urem_si32_si32_si32:
+; LA64-TRAP: # %bb.0: # %entry
+; LA64-TRAP-NEXT: bstrpick.d $a1, $a1, 31, 0
+; LA64-TRAP-NEXT: bstrpick.d $a0, $a0, 31, 0
+; LA64-TRAP-NEXT: mod.du $a0, $a0, $a1
+; LA64-TRAP-NEXT: bnez $a1, .LBB30_2
+; LA64-TRAP-NEXT: # %bb.1: # %entry
+; LA64-TRAP-NEXT: break 7
+; LA64-TRAP-NEXT: .LBB30_2: # %entry
+; LA64-TRAP-NEXT: addi.w $a0, $a0, 0
; LA64-TRAP-NEXT: ret
entry:
%r = urem i32 %a, %b
@@ -730,10 +1170,10 @@ define i64 @urem_i64(i64 %a, i64 %b) {
; LA64-TRAP-LABEL: urem_i64:
; LA64-TRAP: # %bb.0: # %entry
; LA64-TRAP-NEXT: mod.du $a0, $a0, $a1
-; LA64-TRAP-NEXT: bnez $a1, .LBB19_2
+; LA64-TRAP-NEXT: bnez $a1, .LBB31_2
; LA64-TRAP-NEXT: # %bb.1: # %entry
; LA64-TRAP-NEXT: break 7
-; LA64-TRAP-NEXT: .LBB19_2: # %entry
+; LA64-TRAP-NEXT: .LBB31_2: # %entry
; LA64-TRAP-NEXT: ret
entry:
%r = urem i64 %a, %b
More information about the llvm-commits
mailing list