[llvm] 487a070 - [LoongArch][NFC] Pre-commit tests for sign-extension removal with div32 enabled

WANG Rui via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 5 01:39:38 PST 2024


Author: WANG Rui
Date: 2024-12-05T17:40:28+08:00
New Revision: 487a070bebdc1252b83e45f8990704b31c6264f1

URL: https://github.com/llvm/llvm-project/commit/487a070bebdc1252b83e45f8990704b31c6264f1
DIFF: https://github.com/llvm/llvm-project/commit/487a070bebdc1252b83e45f8990704b31c6264f1.diff

LOG: [LoongArch][NFC] Pre-commit tests for sign-extension removal with div32 enabled

Added: 
    

Modified: 
    llvm/test/CodeGen/LoongArch/ir-instruction/sdiv-udiv-srem-urem-div32.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/CodeGen/LoongArch/ir-instruction/sdiv-udiv-srem-urem-div32.ll b/llvm/test/CodeGen/LoongArch/ir-instruction/sdiv-udiv-srem-urem-div32.ll
index 1d81a367ffdc51..7e7518154e8397 100644
--- a/llvm/test/CodeGen/LoongArch/ir-instruction/sdiv-udiv-srem-urem-div32.ll
+++ b/llvm/test/CodeGen/LoongArch/ir-instruction/sdiv-udiv-srem-urem-div32.ll
@@ -73,3 +73,26 @@ define i32 @modwu(i64 %a, i64 %b) {
   %r = urem i32 %conv1, %conv2
   ret i32 %r
 }
+
+define signext i32 @sextw_rmv(i32 signext %a, i32 signext %b, i32 signext %c) {
+; LA64-LABEL: sextw_rmv:
+; LA64:       # %bb.0: # %entry
+; LA64-NEXT:    mul.w $a0, $a1, $a0
+; LA64-NEXT:    div.w $a1, $a2, $a0
+; LA64-NEXT:    sltu $a0, $a1, $a0
+; LA64-NEXT:    ret
+;
+; LA64-DIV32-LABEL: sextw_rmv:
+; LA64-DIV32:       # %bb.0: # %entry
+; LA64-DIV32-NEXT:    mul.d $a0, $a1, $a0
+; LA64-DIV32-NEXT:    addi.w $a1, $a0, 0
+; LA64-DIV32-NEXT:    div.w $a0, $a2, $a0
+; LA64-DIV32-NEXT:    sltu $a0, $a0, $a1
+; LA64-DIV32-NEXT:    ret
+entry:
+  %mul = mul nsw i32 %b, %a
+  %div = sdiv i32 %c, %mul
+  %cmp = icmp ult i32 %div, %mul
+  %conv = zext i1 %cmp to i32
+  ret i32 %conv
+}


        


More information about the llvm-commits mailing list