[llvm] [PowerPC] Use rldimi/rlwimi to optimize build_vector (PR #67640)

Nemanja Ivanovic via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 26 12:46:19 PST 2023


================
@@ -9276,6 +9276,49 @@ bool llvm::checkConvertToNonDenormSingle(APFloat &ArgAPFloat) {
   return (!LosesInfo && !APFloatToConvert.isDenormal());
 }
 
+// Use rldimi/rlwimi to construct vectors:
+//   i32 = (i8 << 24) | (i8 << 16) | (i8 << 8) | i
+//   i32 = (i16 << 16) | i16
+//   i64 = (i32 << 32) | i32
+// And put two i64 together to get a vector.
+static SDValue tryMaskInsertVector(SDValue Op, SelectionDAG &DAG,
+                                   bool LittleEndian) {
+  EVT VT = Op.getValueType();
+  SDLoc dl(Op);
+
+  // There are already patterns for v4i32 and v2i64 construction.
+  if (VT == MVT::v16i8 || VT == MVT::v8i16) {
----------------
nemanjai wrote:

Please flip the condition and make this an early exit.

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


More information about the llvm-commits mailing list