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

Lu Weining via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 27 18:11:03 PDT 2023


This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rG73a2eecb217d: [LoongArch] Pre-commit test for bstrins optimization (authored by SixWeining).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158831/new/

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.553820.patch
Type: text/x-patch
Size: 939 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230828/37d1d7ce/attachment.bin>


More information about the llvm-commits mailing list