[llvm] [Mips] Optimize `or (and $src1, mask0), (shl $src2, mask1)` to `ins` (PR #103017)
YunQiang Su via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 5 05:47:56 PDT 2024
================
@@ -0,0 +1,60 @@
+; RUN: llc -O3 -mcpu=mips32r2 -mtriple=mipsel-linux-gnu < %s -o - \
+; RUN: | FileCheck %s --check-prefixes=MIPS32R2
+; RUN: llc -O3 -mcpu=mips64r2 -march=mips64el < %s \
+; RUN: | FileCheck %s --check-prefixes=MIPS64R2
+
+define i32 @or_and_shl(i32 %a, i32 %b) {
+; MIPS32R2-LABEL: or_and_shl:
+; MIPS32R2: # %bb.0: # %entry
+; MIPS32R2-NEXT: ins $4, $5, 31, 1
+; MIPS32R2-NEXT: jr $ra
+; MIPS32R2-NEXT: move $2, $4
+
+entry:
----------------
wzssyqa wrote:
I don't think this is correct.
if `%b` is `0`, and `%a` is 0x80000000.
The IR code, the result should be `0x80000000`,
while the result of 'INS' will be 0.
https://github.com/llvm/llvm-project/pull/103017
More information about the llvm-commits
mailing list