[llvm] [RISCV] Select and/or/xor with certain constants to Zbb ANDN/ORN/XNOR (PR #120221)
Piotr Fusik via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 18 05:57:15 PST 2024
================
@@ -273,37 +240,21 @@ define i32 @compl(i32 %x) {
}
define i32 @orlow12(i32 %x) {
-; RV32-LABEL: orlow12:
-; RV32: # %bb.0:
-; RV32-NEXT: lui a1, 1
-; RV32-NEXT: addi a1, a1, -1
-; RV32-NEXT: or a0, a0, a1
-; RV32-NEXT: ret
-;
-; RV64-LABEL: orlow12:
-; RV64: # %bb.0:
-; RV64-NEXT: lui a1, 1
-; RV64-NEXT: addiw a1, a1, -1
-; RV64-NEXT: or a0, a0, a1
-; RV64-NEXT: ret
+; CHECK-LABEL: orlow12:
+; CHECK: # %bb.0:
+; CHECK-NEXT: lui a1, 1048575
+; CHECK-NEXT: orn a0, a0, a1
+; CHECK-NEXT: ret
%or = or i32 %x, 4095
ret i32 %or
}
define i32 @xorlow12(i32 %x) {
----------------
pfusik wrote:
Similar to the above.
xori a0, a0, 2047
binvi a0, a0, 11
https://github.com/llvm/llvm-project/pull/120221
More information about the llvm-commits
mailing list