[PATCH] D158831: [LoongArch] Pre-commit test for bstrins optimization

Lu Weining via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 25 03:13:23 PDT 2023


SixWeining created this revision.
SixWeining added reviewers: xen0n, xry111, wangleiat.
Herald added a project: All.
SixWeining requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D158831

Files:
  llvm/test/CodeGen/LoongArch/ir-instruction/and.ll


Index: llvm/test/CodeGen/LoongArch/ir-instruction/and.ll
===================================================================
--- llvm/test/CodeGen/LoongArch/ir-instruction/and.ll
+++ llvm/test/CodeGen/LoongArch/ir-instruction/and.ll
@@ -425,6 +425,25 @@
   ret i64 %i
 }
 
+;; TODO: this can be codegened to bstrins.[wd] $a0, $zero, 23, 16.
+define i64 @and_i64_0xffffffffff00ffff(i64 %a) {
+; LA32-LABEL: and_i64_0xffffffffff00ffff:
+; LA32:       # %bb.0:
+; LA32-NEXT:    lu12i.w $a2, -4081
+; LA32-NEXT:    ori $a2, $a2, 4095
+; LA32-NEXT:    and $a0, $a0, $a2
+; LA32-NEXT:    ret
+;
+; LA64-LABEL: and_i64_0xffffffffff00ffff:
+; LA64:       # %bb.0:
+; LA64-NEXT:    lu12i.w $a1, -4081
+; LA64-NEXT:    ori $a1, $a1, 4095
+; LA64-NEXT:    and $a0, $a0, $a1
+; LA64-NEXT:    ret
+  %b = and i64 %a, 18446744073692839935
+  ret i64 %b
+}
+
 define i32 @and_add_lsr(i32 %x, i32 %y) {
 ; LA32-LABEL: and_add_lsr:
 ; LA32:       # %bb.0:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158831.553427.patch
Type: text/x-patch
Size: 939 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230825/fed8f4bc/attachment.bin>


More information about the llvm-commits mailing list