x86_64-gcc.c

来自「开源项目openssl的源码」· C语言 代码 · 共 35 行

C
35
字号
/* * x86_64 BIGNUM accelerator version 0.1, December 2002. * * Implemented by Andy Polyakov <appro@fy.chalmers.se> for the OpenSSL * project. * * Rights for redistribution and usage in source and binary forms are * granted according to the OpenSSL license. Warranty of any kind is * disclaimed. * * Q. Version 0.1? It doesn't sound like Andy, he used to assign real *    versions, like 1.0... * A. Well, that's because this code is basically a quick-n-dirty *    proof-of-concept hack. As you can see it's implemented with *    inline assembler, which means that you're bound to GCC and that *    there must be a room for fine-tuning. * * Q. Why inline assembler? * A. x86_64 features own ABI I'm not familiar with. Which is why *    I decided to let the compiler take care of subroutine *    prologue/epilogue as well as register allocation. * * Q. How much faster does it get? * A. Unfortunately people sitting on x86_64 hardware are prohibited *    to disclose the performance numbers, so they (SuSE labs to be *    specific) wouldn't tell me. However! Very similar coding technique *    (reaching out for 128-bit result from 64x64-bit multiplication) *    results in >3 times performance improvement on MIPS and I see no *    reason why gain on x86_64 would be so much different:-) */#define BN_ULONG unsigned long/* * "m"(a), "+m"(r)	is the way to favor DirectPath 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?