Re: [PATCH v2] xfrm: branchless addr4_match() on 64-bit

2017-03-27 Thread Alexey Dobriyan
On Mon, Mar 27, 2017 at 1:37 PM, Steffen Klassert wrote: > On Sat, Mar 25, 2017 at 07:41:17PM +0300, Alexey Dobriyan wrote: >> After (no branches): >> >> movr8d,0x20 >> movrdx,0x >> movesi,DWORD PTR [rsi+0x2c] >> movecx,r8d >> subcl

Re: [PATCH v2] xfrm: branchless addr4_match() on 64-bit

2017-03-27 Thread Steffen Klassert
On Sat, Mar 25, 2017 at 07:41:17PM +0300, Alexey Dobriyan wrote: > Current addr4_match() code has special test for /0 prefixes because of > standard required undefined behaviour. However, it is possible to omit > it on 64-bit because shifting can be done within a 64-bit register and > then truncate

[PATCH v2] xfrm: branchless addr4_match() on 64-bit

2017-03-25 Thread Alexey Dobriyan
Current addr4_match() code has special test for /0 prefixes because of standard required undefined behaviour. However, it is possible to omit it on 64-bit because shifting can be done within a 64-bit register and then truncated to the expected value (which is 0 mask). Implicit truncation by htonl(