[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
Sun Jul 9 19:20:56 PDT 2023
hev created this revision.
hev added reviewers: SixWeining, xen0n.
hev added a project: LLVM.
Herald added a project: All.
hev requested review of this revision.
Herald added a subscriber: llvm-commits.
Add tests for (and (add x, c1), (lshr y, c2)).
Signed-off-by: WANG Rui <wangrui at loongson.cn>
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D154809
Files:
llvm/test/CodeGen/LoongArch/lsr-legaladdimm.ll
Index: llvm/test/CodeGen/LoongArch/lsr-legaladdimm.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/LoongArch/lsr-legaladdimm.ll
@@ -0,0 +1,16 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc --mtriple=loongarch64 < %s | FileCheck %s
+
+define i32 @lsr_addimm(i32 %x, i32 %y) {
+; CHECK-LABEL: lsr_addimm:
+; CHECK: # %bb.0:
+; CHECK-NEXT: ori $a2, $zero, 4095
+; CHECK-NEXT: add.d $a0, $a0, $a2
+; CHECK-NEXT: bstrpick.d $a1, $a1, 31, 20
+; CHECK-NEXT: and $a0, $a1, $a0
+; CHECK-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.538491.patch
Type: text/x-patch
Size: 704 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230710/cdd4c208/attachment.bin>
More information about the llvm-commits
mailing list