Skip to content

Commit

Permalink
stress-ng.h, stress-version.h: Add ICC support for alignment hinting
Browse files Browse the repository at this point in the history
ICC allows one to use the alignment attribute, so allow this for ICC
with version > 2021.0.0

Signed-off-by: Colin Ian King <[email protected]>
  • Loading branch information
ColinIanKing committed Apr 29, 2022
1 parent 27aa0b0 commit 4a9412c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 18 deletions.
20 changes: 2 additions & 18 deletions stress-ng.h
Original file line number Diff line number Diff line change
Expand Up @@ -644,30 +644,19 @@ typedef struct {
#endif

#if ((defined(__GNUC__) && NEED_GNUC(3, 3, 0)) || \
(defined(__clang__) && NEED_CLANG(3, 0, 0))) && \
(defined(__clang__) && NEED_CLANG(3, 0, 0)) || \
(defined(__ICC) && NEED_ICC(2021, 0, 0))) && \
!defined(__PCC__)
#define ALIGNED(a) __attribute__((aligned(a)))
#else
#define ALIGNED(a)
#endif

/* Force alignment to nearest 128 bytes */
#if ((defined(__GNUC__) && NEED_GNUC(3, 3, 0)) || \
(defined(__clang__) && NEED_CLANG(3, 0, 0))) && \
defined(HAVE_ALIGNED_128)
#define ALIGN128 ALIGNED(128)
#else
#define ALIGN128
#endif

/* Force alignment to nearest 64 bytes */
#if ((defined(__GNUC__) && NEED_GNUC(3, 3, 0)) || \
(defined(__clang__) && NEED_CLANG(3, 0, 0))) && \
defined(HAVE_ALIGNED_64)
#define ALIGN64 ALIGNED(64)
#else
#define ALIGN64
#endif

#if (defined(__GNUC__) && NEED_GNUC(4, 6, 0)) || \
(defined(__clang__) && NEED_CLANG(3, 0, 0))
Expand All @@ -676,12 +665,7 @@ typedef struct {
#define SECTION(s)
#endif

/* Choose cacheline alignment */
#if defined(ALIGN128)
#define ALIGN_CACHELINE ALIGN128
#else
#define ALIGN_CACHELINE ALIGN64
#endif

/* GCC hot attribute */
#if (defined(__GNUC__) && NEED_GNUC(4, 6, 0)) || \
Expand Down
11 changes: 11 additions & 0 deletions stress-version.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,15 @@
#else
#define NEED_CLANG(major, minor, patchlevel) (0)
#endif

#if defined(__ICC) && \
defined(__INTEL_COMPILER) && \
defined(__INTEL_COMPILER_UPDATE)
#define NEED_ICC(major, minor, patchlevel) \
STRESS_VERSION_NUMBER(major, minor, patchlevel) <= \
STRESS_VERSION_NUMBER(__INTEL_COMPILER, __INTEL_COMPILER_UPDATE, 0)
#else
#define NEED_ICC(major, minor, patchlevel) (0)
#endif

#endif

0 comments on commit 4a9412c

Please sign in to comment.