This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: Enable Intel AES/CLMUL
On Fri, Apr 4, 2008 at 4:07 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> > OK. So, we require user to pass at least -msse2 in addition to
> > -maes/-mclmul then? The errors will be informative, so there will be
> > no confusion.
> >
>
> Here is the updated patch. I don't think we should require adding
> -msse2 explicitly for -maes/-mclmul since they won't work at all
> without SSE2. However, if -mno-sse2 is used, user will get an eror:
I really don't like the idea of switching SSE2 without user explicitly
requesting it. We already have something similar with -mcx16; this
compile flag doesn't switch -m64, although it applies only there.
Another rationale: when __builtin version is used (although not
recommended), adding -maes/-mclmul without -msse2 will result in a
function call that will pass its __v2di parameters through the stack
(this also somehow opens the door for a backup implementation for
targets without HW support or even without SSE):
typedef long long __v2di attribute ((vector_size (16)));
__v2di __builtin_ia32_aes...(__v2di A, __v2di B)
{
...
}
This will work just fine even without SSE (although a warning about
changed ABI will be issued). We can even add AES functionality to the
library this way (hint, hint ;)
And using intrinsic, the situation will be actually just reversed to
the situation you described below.
>
> bash-3.2$ cat x.c
> #include <wmmintrin.h>
> bash-3.2$ ./xgcc -B./ -m32 -c x.c
> In file included from ./include/wmmintrin.h:34,
> from x.c:1:
> ./include/emmintrin.h:34:3: error: #error "SSE2 instruction set not
> enabled"
> In file included from x.c:1:
> ./include/wmmintrin.h:37:3: error: #error "AES/PCLMUL instructions not
> enabled"
> bash-3.2$ ./xgcc -B./ -m32 -c x.c -maes
> bash-3.2$ ./xgcc -B./ -m32 -c x.c -maes -mno-sse2
> In file included from ./include/wmmintrin.h:34,
> from x.c:1:
> ./include/emmintrin.h:34:3: error: #error "SSE2 instruction set not
> enabled"
> In file included from x.c:1:
> ./include/wmmintrin.h:37:3: error: #error "AES/PCLMUL instructions not
> enabled"
> bash-3.2$
>
> I also changed clmul/CLMUL to pclmul/PCLMUL. OK to install?
No problems with the name change.
The patch is OK, but please can you reconsider SSE2 requirement?
Thanks,
Uros.