[PATCH] D154809: [LoongArch] Add tests for (and (add x, c1), (lshr y, c2))
hev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 12 02:59:39 PDT 2023
hev updated this revision to Diff 539454.
hev added a comment.
Move the case into `test/CodeGen/LoongArch/ir-instruction/and.ll`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D154809/new/
https://reviews.llvm.org/D154809
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
@@ -424,3 +424,25 @@
%i = xor i64 %g, %h
ret i64 %i
}
+
+define i32 @and_add_lsr(i32 %x, i32 %y) {
+; LA32-LABEL: and_add_lsr:
+; LA32: # %bb.0:
+; LA32-NEXT: ori $a2, $zero, 4095
+; LA32-NEXT: add.w $a0, $a0, $a2
+; LA32-NEXT: srli.w $a1, $a1, 20
+; LA32-NEXT: and $a0, $a1, $a0
+; LA32-NEXT: ret
+;
+; LA64-LABEL: and_add_lsr:
+; LA64: # %bb.0:
+; LA64-NEXT: ori $a2, $zero, 4095
+; LA64-NEXT: add.d $a0, $a0, $a2
+; LA64-NEXT: bstrpick.d $a1, $a1, 31, 20
+; LA64-NEXT: and $a0, $a1, $a0
+; LA64-NEXT: ret
+ %1 = add i32 %x, 4095
+ %2 = lshr i32 %y, 20
+ %r = and i32 %2, %1
+ ret i32 %r
+}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154809.539454.patch
Type: text/x-patch
Size: 879 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230712/550826ce/attachment.bin>
More information about the llvm-commits
mailing list