Skip to content

Commit

Permalink
parisc: optimize mtsp(0,sr) inline assembly
Browse files Browse the repository at this point in the history
If the value which should be moved into a space register is zero, we can
optimize the inline assembly to become "mtsp %r0,%srX".

Signed-off-by: Helge Deller <deller@gmx.de>
Cc: <stable@vger.kernel.org> # 3.10
  • Loading branch information
hdeller committed Jul 9, 2013
1 parent 594174d commit 92b5992
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions arch/parisc/include/asm/special_insns.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,12 @@ static inline void set_eiem(unsigned long val)
cr; \
})

#define mtsp(gr, cr) \
__asm__ __volatile__("mtsp %0,%1" \
#define mtsp(val, cr) \
{ if (__builtin_constant_p(val) && ((val) == 0)) \
__asm__ __volatile__("mtsp %%r0,%0" : : "i" (cr) : "memory"); \
else \
__asm__ __volatile__("mtsp %0,%1" \
: /* no outputs */ \
: "r" (gr), "i" (cr) : "memory")
: "r" (val), "i" (cr) : "memory"); }

#endif /* __PARISC_SPECIAL_INSNS_H */

0 comments on commit 92b5992

Please sign in to comment.