blob: 547cdc920a3c8128e704e207b125d2c644cc3b15 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Will Deacond1515582017-10-24 11:22:46 +01002#ifndef __LINUX_COMPILER_TYPES_H
Robert P. J. Day94f582f2007-10-16 23:26:11 -07003#error "Please don't include <linux/compiler-intel.h> directly, include <linux/compiler.h> instead."
4#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07005
6#ifdef __ECC
7
8/* Some compiler specific definitions are overwritten here
9 * for Intel ECC compiler
10 */
11
12#include <asm/intrinsics.h>
13
14/* Intel ECC compiler doesn't support gcc specific asm stmts.
15 * It uses intrinsics to do the equivalent things.
16 */
Daniel Borkmannb86a50c2015-06-25 15:01:05 -070017#undef barrier
Daniel Borkmann7829fb02015-04-30 04:13:52 +020018#undef barrier_data
Linus Torvalds1da177e2005-04-16 15:20:36 -070019#undef RELOC_HIDE
Cesar Eduardo Barrosfe8c8a12013-11-25 22:00:41 -020020#undef OPTIMIZER_HIDE_VAR
Linus Torvalds1da177e2005-04-16 15:20:36 -070021
Daniel Borkmannb86a50c2015-06-25 15:01:05 -070022#define barrier() __memory_barrier()
Daniel Borkmann7829fb02015-04-30 04:13:52 +020023#define barrier_data(ptr) barrier()
24
Linus Torvalds1da177e2005-04-16 15:20:36 -070025#define RELOC_HIDE(ptr, off) \
26 ({ unsigned long __ptr; \
27 __ptr = (unsigned long) (ptr); \
28 (typeof(ptr)) (__ptr + (off)); })
29
Cesar Eduardo Barrosfe8c8a12013-11-25 22:00:41 -020030/* This should act as an optimization barrier on var.
31 * Given that this compiler does not have inline assembly, a compiler barrier
32 * is the best we can do.
33 */
34#define OPTIMIZER_HIDE_VAR(var) barrier()
35
Rusty Russellc5e631cf2007-05-06 14:51:05 -070036/* Intel ECC compiler doesn't support __builtin_types_compatible_p() */
37#define __must_be_array(a) 0
38
Linus Torvalds1da177e2005-04-16 15:20:36 -070039#endif
Borislav Petkov94909912007-05-06 14:49:17 -070040
David Woodhousecf66bb92012-12-03 16:25:40 +000041#ifndef __HAVE_BUILTIN_BSWAP16__
42/* icc has this, but it's called _bswap16 */
43#define __HAVE_BUILTIN_BSWAP16__
44#define __builtin_bswap16 _bswap16
45#endif
46
Rasmus Villemoesf0907822018-05-08 00:36:27 +020047/*
48 * icc defines __GNUC__, but does not implement the builtin overflow checkers.
49 */
50#undef COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW