[llvm] [MIPS]Remove unnecessary SLL instructions on MIPS64el (PR #109386)

YunQiang Su via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 9 05:47:45 PDT 2024


================
@@ -1213,6 +1214,27 @@ static SDValue performSHLCombine(SDNode *N, SelectionDAG &DAG,
                      DAG.getConstant(SMSize, DL, MVT::i32));
 }
 
+static SDValue performSignExtendCombine(SDNode *N, SelectionDAG &DAG,
+                                        TargetLowering::DAGCombinerInfo &DCI,
+                                        const MipsSubtarget &Subtarget) {
+  SDValue N0 = N->getOperand(0);
+  EVT VT = N->getValueType(0);
+
+  // Pattern match XOR.
+  //  $dst = sign_extend (xor (trunc $src), imm)
----------------
wzssyqa wrote:

For example, if `$src=0x12345678`; `imm=0xffff`.

lets `truncate it to i8`, then it will be `0x78`,  the result will be ~0x78.
lets `truncate it to i16`, then it will be `0x5678`,  the result will be ~0x5678.

https://github.com/llvm/llvm-project/pull/109386


More information about the llvm-commits mailing list