Shifting encoding value


I am a newbie trying to implement a proprietary target.
I want to encode the value which involves shifting of binary encoding
of the operand value.

Currently i have the following in the td file

class XFForm_1<bits<4> opcode, int shift, dag OOL, dag IOL, string asmstr,
              InstrItinClass itin, list<dag> pattern>
  : I16_2<opcode, OOL, IOL, asmstr, itin> {
  bits<4> RS;
  bits<8> Addr;

  let Pattern = pattern;

  let Inst{4-7} = Addr{0-3}; // Displacement
  let Inst{8-11} = RZ; // Dest
  let Inst{12-15} = Addr{7-4}; // Base Reg

The issue is that in the final encoding the displacement value should
be shifted 1,2 or 3 bits depending on the type of the instruction. So
for that i am passing the argument 'shift' into the class


def X_STW : XFForm_1<13, 2, (outs), (ins gprc:$rS, memri:$src),
                  "se_stw $rZ, $src", IC_LdSt,

The issue that i am facing is for the displacement calculation i tried
the following :

  let Inst{4-7} = !srl(Addr{0-3}, shift); // Displacement

Though the compiler builds, i dont see the change. Infact after the
change now the .inc file does have displacement calculation at all.
I think the current solution that i have is to have different 'memri'
operand variants depending on the shift amount.
But i would like to know if there is any better solution.

Please CC me in your replay as i have not subscribed to the list yet.