There are 4 instruction which has Inconsistent ImmMustBeMultipleOf in the function PPCInstrInfo::instrHasImmForm, they are LFS, LFD, STFS, STFD.
For example LFS:
2651 bool PPCInstrInfo::instrHasImmForm(const MachineInstr &MI, ImmInstrInfo &III, bool PostRA) const { 2653 unsigned Opc = MI.getOpcode(); ... 2661 III.ImmMustBeMultipleOf = 1; ... 2664 switch (Opc) { ... 2880 case PPC::LFSX: III.ImmOpcode = PPC::LFS; break; ... 2961 case PPC::STXSSPX: 2976 III.ImmMustBeMultipleOf = 4; ... 2977 switch(Opc) { ... 2983 case PPC::LXSSPX: 2984 if (PostRA) { 2985 if (isVFReg(MI.getOperand(0).getReg())) 2986 III.ImmOpcode = PPC::LXSSP; 2987 else 2988 III.ImmOpcode = PPC::LFS; 2989 break; 2990 } ... } ... } ... }
For the ImmInstrInfo::ImmMustBeMultipleOf is used to describe the immediate multiple information of the instruction LFS. So for the same instruction LFS, it should have same immediate multiple information.
But from above code, we can see in the line 2880, the instruction LFS has the immediate multiple 1 byte, but in the line 2988, its value is 4 byte. They are inconsistent.
This bug will result in below pattern can not be optimized.
addi r2, 99 lxsspx f1, 0, r2
In fact, this pattern should be optimized to:
lfs f1, 99(r2)