Add "memory" as a clobber for bswap inline assembly.
This had been causing Camellia (the only cipher that uses these macros) to fail when compiling "out-of-the-box" with gcc version "4.3.3-5ubuntu4". I think because the compiler had no idea any memory access was going on in these macros. Adding "memory" as a clobber solves the problem, but is probably overkill. I suspect that if we specify the constraint for y differently, we could get rid of both "memory" and __volatile__, which would allow the compiler to optimize much more. Also, in gcc versions that support it, we should probably use the bswap builtins instead.
This commit is contained in:
		
							parent
							
								
									ee7c031ddf
								
							
						
					
					
						commit
						cefff85550
					
				| @ -105,13 +105,13 @@ asm __volatile__ (               \ | ||||
|    "bswapq %0     \n\t"          \ | ||||
|    "movq   %0,(%1)\n\t"          \ | ||||
|    "bswapq %0     \n\t"          \ | ||||
|       ::"r"(x), "r"(y)); | ||||
|    ::"r"(x), "r"(y): "memory"); | ||||
| 
 | ||||
| #define LOAD64H(x, y)          \ | ||||
| asm __volatile__ (             \ | ||||
|    "movq (%1),%0\n\t"          \ | ||||
|    "bswapq %0\n\t"             \ | ||||
|    :"=r"(x): "r"(y)); | ||||
|    :"=r"(x): "r"(y): "memory"); | ||||
| 
 | ||||
| #else | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user