Closed Bug 1359333 Opened 4 years ago Closed 4 years ago

Add support for detecting AES-NI

Categories

(Core :: mozglue, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: franziskus, Assigned: franziskus)

References

Details

Attachments

(1 file)

No description provided.
Assignee: nobody → franziskuskiefer
Blocks: 1359335
Comment on attachment 8861327 [details]
Bug 1359333 - detect aes-ni support,

https://reviewboard.mozilla.org/r/133308/#review136866

glandium is on PTO for a while, stealing review.  I think if you just remove the `#define`, possibly with a comment about how there's no preprocessor symbol for AES support, things will work out as you expect.

::: mozglue/build/SSE.h:140
(Diff revision 1)
>  #endif
>  #ifdef __AVX2__
>    // It's ok to use AVX instructions based on the -march option.
>    #define MOZILLA_PRESUME_AVX2 1
>  #endif
> +#define MOZILLA_PRESUME_AES 0

This can't be right...

::: mozglue/build/SSE.h:222
(Diff revision 1)
>      extern bool MFBT_DATA avx_enabled;
>  #endif
>  #if !defined(MOZILLA_PRESUME_AVX2)
>      extern bool MFBT_DATA avx2_enabled;
>  #endif
> +#if !defined(MOZILLA_PRESUME_AES)

...because you're checking `!defined` in all these cases, and based on the above, `MOZILLA_PRESUME_AES` is always defined.
Attachment #8861327 - Flags: review-
Comment on attachment 8861327 [details]
Bug 1359333 - detect aes-ni support,

Canceling glandium's review for reasons already stated.
Attachment #8861327 - Flags: review?(mh+mozilla)
Comment on attachment 8861327 [details]
Bug 1359333 - detect aes-ni support,

https://reviewboard.mozilla.org/r/133308/#review139680

r=me with the issue below fixed.  I think we should have

```
#ifdef __AES__
  // It's ok to use AES instructions based on the -march option.
  #define MOZILLA_PRESUME_AES 1
#endif
```

unless you disagree?

::: mozglue/build/SSE.h:140
(Diff revision 2)
>  #endif
>  #ifdef __AVX2__
>    // It's ok to use AVX instructions based on the -march option.
>    #define MOZILLA_PRESUME_AVX2 1
>  #endif
> +// There's no preprocessor symbol for __AES__

Really?  GCC 4.9 and above on my machine with `-march=native` define `__AES__`...
Attachment #8861327 - Flags: review?(nfroyd) → review+
https://hg.mozilla.org/mozilla-central/rev/94600876bb6e
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in before you can comment on or make changes to this bug.