[llvm] [X86][CodeGen] Support folding memory broadcast in X86InstrInfo::foldMemoryOperandImpl (PR #79761)

Shengchen Kan via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 29 07:42:32 PST 2024


================
@@ -8341,7 +8486,10 @@ bool X86InstrInfo::unfoldMemoryOperand(
   unsigned Index = I->Flags & TB_INDEX_MASK;
   bool FoldedLoad = I->Flags & TB_FOLDED_LOAD;
   bool FoldedStore = I->Flags & TB_FOLDED_STORE;
-  bool FoldedBCast = I->Flags & TB_FOLDED_BCAST;
+  unsigned BCastType = I->Flags & TB_FOLDED_BCAST;
+  // FIXME: Support TB_BCAST_SH in getBroadcastOpcode?
+  if (BCastType == TB_BCAST_SH)
----------------
KanRobert wrote:

I added `TB_BCAST_W` entries in `getBroadcastOpcode` in this PR.  We do not have instruction named `VPBROADCASTSH`, and I don't know if we should use `VPBROADCASTW` for `TB_BCAST_SH`. 

If we do not exclude `TB_BCAST_SH` here, the `unreachable` in `getBroadcastOpcode` would be probably hit.

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


More information about the llvm-commits mailing list