From 08e5c90524554cac7c4170808ff4bf0568387ea4 Mon Sep 17 00:00:00 2001 From: Dmitry Babokin Date: Mon, 6 Aug 2018 14:17:03 -0700 Subject: [PATCH] Enabling LLVM 8.0 --- alloy.py | 15 ++++++++++----- builtins/dispatch.ll | 2 ++ builtins/target-knl.ll | 4 ++++ builtins/target-skx.ll | 4 ++++ builtins/util.m4 | 12 ++++++++++++ cbackend.cpp | 8 ++++++-- ispc.h | 16 ++++++++-------- ispc_version.h | 3 ++- 8 files changed, 48 insertions(+), 16 deletions(-) diff --git a/alloy.py b/alloy.py index 310d95f340..bb61d1f8ae 100755 --- a/alloy.py +++ b/alloy.py @@ -137,6 +137,9 @@ def checkout_LLVM(component, use_git, version_LLVM, revision, target_dir, from_v if version_LLVM == "trunk": SVN_PATH="trunk" GIT_BRANCH="master" + elif version_LLVM == "7_0": + SVN_PATH="branches/release_70" + GIT_BRANCH="release_70" elif version_LLVM == "6_0": SVN_PATH="tags/RELEASE_600/final" GIT_BRANCH="release_60" @@ -559,8 +562,10 @@ def build_ispc(version_LLVM, make): temp = "5_0" if version_LLVM == "6.0": temp = "6_0" - if version_LLVM == "trunk": + if version_LLVM == "7.0": temp = "7_0" + if version_LLVM == "trunk": + temp = "8_0" os.environ["LLVM_VERSION"] = "LLVM_" + temp try_do_LLVM("clean ISPC for building", "msbuild ispc.vcxproj /t:clean", True) try_do_LLVM("build ISPC with LLVM version " + version_LLVM + " ", "msbuild ispc.vcxproj /V:m /p:Platform=Win32 /p:Configuration=Release /t:rebuild", True) @@ -700,7 +705,7 @@ def validation_run(only, only_targets, reference_branch, number, notify, update, archs.append("x86-64") if "native" in only: sde_targets_t = [] - for i in ["3.2", "3.3", "3.4", "3.5", "3.6", "3.7", "3.8", "3.9", "4.0", "5.0", "6.0", "trunk"]: + for i in ["3.2", "3.3", "3.4", "3.5", "3.6", "3.7", "3.8", "3.9", "4.0", "5.0", "6.0", "7.0", "trunk"]: if i in only: LLVM.append(i) if "current" in only: @@ -986,7 +991,7 @@ def Main(): if os.environ.get("SMTP_ISPC") == None: error("you have no SMTP_ISPC in your environment for option notify", 1) if options.only != "": - test_only_r = " 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9 4.0 5.0 6.0 trunk current build stability performance x86 x86-64 x86_64 -O0 -O2 native debug nodebug " + test_only_r = " 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9 4.0 5.0 6.0 7.0 trunk current build stability performance x86 x86-64 x86_64 -O0 -O2 native debug nodebug " test_only = options.only.split(" ") for iterator in test_only: if not (" " + iterator + " " in test_only_r): @@ -1099,7 +1104,7 @@ def format_epilog(self, formatter): llvm_group = OptionGroup(parser, "Options for building LLVM", "These options must be used with -b option.") llvm_group.add_option('--version', dest='version', - help='version of llvm to build: 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9 4.0 5.0 6.0 trunk. Default: trunk', default="trunk") + help='version of llvm to build: 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9 4.0 5.0 6.0 7.0 trunk. Default: trunk', default="trunk") llvm_group.add_option('--with-gcc-toolchain', dest='gcc_toolchain_path', help='GCC install dir to use when building clang. It is important to set when ' + 'you have alternative gcc installation. Note that otherwise gcc from standard ' + @@ -1142,7 +1147,7 @@ def format_epilog(self, formatter): run_group.add_option('--only', dest='only', help='set types of tests. Possible values:\n' + '-O0, -O2, x86, x86-64, stability (test only stability), performance (test only performance),\n' + - 'build (only build with different LLVM), 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4.0, 5.0, 6.0, trunk, native (do not use SDE),\n' + + 'build (only build with different LLVM), 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4.0, 5.0, 6.0, 7.0, trunk, native (do not use SDE),\n' + 'current (do not rebuild ISPC), debug (only with debug info), nodebug (only without debug info, default).', default="") run_group.add_option('--perf_LLVM', dest='perf_llvm', diff --git a/builtins/dispatch.ll b/builtins/dispatch.ll index 03c70012d6..bad9a6365d 100644 --- a/builtins/dispatch.ll +++ b/builtins/dispatch.ll @@ -159,6 +159,8 @@ define(`PTR_OP_ARGS', LLVM_VERSION, LLVM_6_0, ``$1 , $1 *'', LLVM_VERSION, LLVM_7_0, + ``$1 , $1 *'', + LLVM_VERSION, LLVM_8_0, ``$1 , $1 *'', ``$1 *'' ) diff --git a/builtins/target-knl.ll b/builtins/target-knl.ll index 9b0cef7750..ac85f546ef 100644 --- a/builtins/target-knl.ll +++ b/builtins/target-knl.ll @@ -44,6 +44,8 @@ ifelse(LLVM_VERSION, LLVM_3_7, LLVM_VERSION, LLVM_6_0, `include(`target-avx512-common.ll')', LLVM_VERSION, LLVM_7_0, + `include(`target-avx512-common.ll')', + LLVM_VERSION, LLVM_8_0, `include(`target-avx512-common.ll')' ) @@ -76,6 +78,8 @@ ifelse(LLVM_VERSION, LLVM_3_7, LLVM_VERSION, LLVM_6_0, rcp_rsqrt_varying_float_knl(), LLVM_VERSION, LLVM_7_0, + rcp_rsqrt_varying_float_knl(), + LLVM_VERSION, LLVM_8_0, rcp_rsqrt_varying_float_knl() ) diff --git a/builtins/target-skx.ll b/builtins/target-skx.ll index fd9cebb8bf..0eb43d2d18 100644 --- a/builtins/target-skx.ll +++ b/builtins/target-skx.ll @@ -43,6 +43,8 @@ ifelse(LLVM_VERSION, LLVM_3_8, LLVM_VERSION, LLVM_6_0, `include(`target-avx512-common.ll')', LLVM_VERSION, LLVM_7_0, + `include(`target-avx512-common.ll')', + LLVM_VERSION, LLVM_8_0, `include(`target-avx512-common.ll')' ) @@ -96,6 +98,8 @@ ifelse(LLVM_VERSION, LLVM_3_8, LLVM_VERSION, LLVM_6_0, rcp_rsqrt_varying_float_skx(), LLVM_VERSION, LLVM_7_0, + rcp_rsqrt_varying_float_skx(), + LLVM_VERSION, LLVM_8_0, rcp_rsqrt_varying_float_skx() ) diff --git a/builtins/util.m4 b/builtins/util.m4 index d251c2ffa5..d5ab6b522a 100644 --- a/builtins/util.m4 +++ b/builtins/util.m4 @@ -65,6 +65,8 @@ define(`PTR_OP_ARGS', LLVM_VERSION, LLVM_6_0, ``$1 , $1 *'', LLVM_VERSION, LLVM_7_0, + ``$1 , $1 *'', + LLVM_VERSION, LLVM_8_0, ``$1 , $1 *'', ``$1 *'' ) @@ -85,6 +87,8 @@ define(`MdORi64', ``i64'', LLVM_VERSION, LLVM_7_0, ``i64'', + LLVM_VERSION, LLVM_8_0, + ``i64'', ``double'' ) ) @@ -102,6 +106,8 @@ define(`MfORi32', ``i32'', LLVM_VERSION, LLVM_7_0, ``i32'', + LLVM_VERSION, LLVM_8_0, + ``i32'', ``float'' ) ) @@ -1622,6 +1628,9 @@ define <$1 x $2> @__atomic_compare_exchange_$3_global($2* %ptr, <$1 x $2> %cmp, ',LLVM_VERSION,LLVM_7_0,` %r_LANE_ID_t = cmpxchg $2 * %ptr, $2 %cmp_LANE_ID, $2 %val_LANE_ID seq_cst seq_cst %r_LANE_ID = extractvalue { $2, i1 } %r_LANE_ID_t, 0 + ',LLVM_VERSION,LLVM_8_0,` + %r_LANE_ID_t = cmpxchg $2 * %ptr, $2 %cmp_LANE_ID, $2 %val_LANE_ID seq_cst seq_cst + %r_LANE_ID = extractvalue { $2, i1 } %r_LANE_ID_t, 0 ',` %r_LANE_ID = cmpxchg $2 * %ptr, $2 %cmp_LANE_ID, $2 %val_LANE_ID seq_cst ') @@ -1662,6 +1671,9 @@ define $2 @__atomic_compare_exchange_uniform_$3_global($2* %ptr, $2 %cmp, ',LLVM_VERSION,LLVM_7_0,` %r_t = cmpxchg $2 * %ptr, $2 %cmp, $2 %val seq_cst seq_cst %r = extractvalue { $2, i1 } %r_t, 0 + ',LLVM_VERSION,LLVM_8_0,` + %r_t = cmpxchg $2 * %ptr, $2 %cmp, $2 %val seq_cst seq_cst + %r = extractvalue { $2, i1 } %r_t, 0 ',` %r = cmpxchg $2 * %ptr, $2 %cmp, $2 %val seq_cst ') diff --git a/cbackend.cpp b/cbackend.cpp index 8b548dfae5..b5d0177586 100644 --- a/cbackend.cpp +++ b/cbackend.cpp @@ -4193,7 +4193,9 @@ void CWriter::lowerIntrinsics(llvm::Function &F) { #elif ISPC_LLVM_VERSION <= ISPC_LLVM_6_0 /* LLVM 3.3-6.0 */ #include "llvm/IR/Intrinsics.gen" #else /* LLVM 7.0+ */ - #include "llvm/IR/Intrinsics.inc" +// This looks completely broken, even in 3.2, need to figure out what's going on here +// and how to fix it (if needed). +// #include "llvm/IR/Intrinsics.inc" #endif #undef Intrinsic #undef GET_GCC_BUILTIN_NAME @@ -4427,7 +4429,9 @@ bool CWriter::visitBuiltinCall(llvm::CallInst &I, llvm::Intrinsic::ID ID, #elif ISPC_LLVM_VERSION <= ISPC_LLVM_6_0 /* LLVM 3.3-6.0 */ #include "llvm/IR/Intrinsics.gen" #else /* LLVM 7.0+ */ - #include "llvm/IR/Intrinsics.inc" +// This looks completely broken, even in 3.2, need to figure out what's going on here +// and how to fix it (if needed). +// #include "llvm/IR/Intrinsics.inc" #endif #undef Intrinsic #undef GET_GCC_BUILTIN_NAME diff --git a/ispc.h b/ispc.h index 0d84196fce..74e0baf78a 100644 --- a/ispc.h +++ b/ispc.h @@ -41,7 +41,7 @@ #include "ispc_version.h" #if ISPC_LLVM_VERSION < OLDEST_SUPPORTED_LLVM || ISPC_LLVM_VERSION > LATEST_SUPPORTED_LLVM -#error "Only LLVM 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4.0, 5.0, 6.0 and 7.0 development branch are supported" +#error "Only LLVM 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4.0, 5.0, 6.0, 7.0 and 8.0 development branch are supported" #endif #if defined(_WIN32) || defined(_WIN64) @@ -268,7 +268,7 @@ class Target { ISA getISA() const {return m_isa;} - std::string getTreatGenericAsSmth() const {return m_treatGenericAsSmth;} + std::string getTreatGenericAsSmth() const {return m_treatGenericAsSmth;} std::string getArch() const {return m_arch;} @@ -299,11 +299,11 @@ class Target { bool hasScatter() const {return m_hasScatter;} bool hasTranscendentals() const {return m_hasTranscendentals;} - + bool hasTrigonometry() const {return m_hasTrigonometry;} - + bool hasRsqrtd() const {return m_hasRsqrtd;} - + bool hasRcpd() const {return m_hasRcpd;} bool hasVecPrefetch() const {return m_hasVecPrefetch;} @@ -408,13 +408,13 @@ class Target { /** Indicates whether the target has support for transcendentals (beyond sqrt, which we assume that all of them handle). */ bool m_hasTranscendentals; - + /** Indicates whether the target has ISA support for trigonometry */ bool m_hasTrigonometry; - + /** Indicates whether there is an ISA double precision rsqrt. */ bool m_hasRsqrtd; - + /** Indicates whether there is an ISA double precision rcp. */ bool m_hasRcpd; diff --git a/ispc_version.h b/ispc_version.h index 91c6adc09d..b47758a00f 100644 --- a/ispc_version.h +++ b/ispc_version.h @@ -55,9 +55,10 @@ #define ISPC_LLVM_5_0 50000 #define ISPC_LLVM_6_0 60000 #define ISPC_LLVM_7_0 70000 +#define ISPC_LLVM_8_0 80000 #define OLDEST_SUPPORTED_LLVM ISPC_LLVM_3_2 -#define LATEST_SUPPORTED_LLVM ISPC_LLVM_7_0 +#define LATEST_SUPPORTED_LLVM ISPC_LLVM_8_0 #ifdef __ispc__xstr #undef __ispc__xstr