[llvm] [GISel] Convert zext nneg to sext if it is cheaper (PR #93856)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Fri May 31 03:31:52 PDT 2024
================
@@ -101,3 +101,13 @@ entry:
%0 = urem i64 %a, %b
ret i64 %0
}
+
+define i64 @zext_nneg_i32_i64(i32 %a) {
+; RV64IM-LABEL: zext_nneg_i32_i64:
+; RV64IM: # %bb.0: # %entry
+; RV64IM-NEXT: sext.w a0, a0
+; RV64IM-NEXT: ret
+entry:
+ %b = zext nneg i32 %a to i64
+ ret i64 %b
+}
----------------
dtcxzyw wrote:
Sorry, I cannot provide vector tests as both RISC-V and LoongArch only handle scalar i32 -> i64.
https://github.com/llvm/llvm-project/blob/a65771fce4a2f25f16d4b3918ad6a11370637f7b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp#L1881-L1883
https://github.com/llvm/llvm-project/blob/a65771fce4a2f25f16d4b3918ad6a11370637f7b/llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp#L4982-L4985
https://github.com/llvm/llvm-project/pull/93856
More information about the llvm-commits
mailing list