To clarify...you want to move the pipe above the p-trap?
Keep in mind that anything above the p-trap is subject to becoming smelly if the pipe walls collect any body oils, dead skin, soap scum, etc. The longer that riser from the trap is, the more likely it will eventually smell. I think there is a code provision on how tall the riser can be, but don't think there is an issue with the amount of bends you want to put there, although you may be close to the maximum drop before the p-trap. There could be problems underground after the p-trap. There's a regulation that indicates how many degrees change of direction there can be without a cleanout, and that MIGHT apply. It's best to avoid making additional changes of direction.