forked from OSchip/llvm-project
[WebAssembly] Add unimplemented-simd128 feature, gate builtins
Summary: Depends on D56501. Also adds a macro define `__wasm_unimplemented_simd128__` for feature detection of unimplemented SIMD builtins. Reviewers: aheejin, dschuff Subscribers: sbc100, jgravelle-google, sunfish, kristina, cfe-commits, rrwinterton llvm-svn: 350909
This commit is contained in:
parent
f57a247df7
commit
b7b9fdc114
|
@ -16,6 +16,10 @@
|
|||
|
||||
// The format of this database matches clang/Basic/Builtins.def.
|
||||
|
||||
#if defined(BUILTIN) && !defined(TARGET_BUILTIN)
|
||||
# define TARGET_BUILTIN(ID, TYPE, ATTRS, FEATURE) BUILTIN(ID, TYPE, ATTRS)
|
||||
#endif
|
||||
|
||||
// Query the current memory size, and increase the current memory size.
|
||||
// Note that memory.size is not "c" (readnone) because it must be sequenced
|
||||
// with respect to memory.grow calls.
|
||||
|
@ -30,9 +34,15 @@ BUILTIN(__builtin_wasm_mem_grow, "zIiz", "n")
|
|||
BUILTIN(__builtin_wasm_current_memory, "z", "n")
|
||||
BUILTIN(__builtin_wasm_grow_memory, "zz", "n")
|
||||
|
||||
// Floating point min/max
|
||||
BUILTIN(__builtin_wasm_min_f32, "fff", "nc")
|
||||
BUILTIN(__builtin_wasm_max_f32, "fff", "nc")
|
||||
BUILTIN(__builtin_wasm_min_f64, "ddd", "nc")
|
||||
BUILTIN(__builtin_wasm_max_f64, "ddd", "nc")
|
||||
|
||||
// Exception handling builtins.
|
||||
BUILTIN(__builtin_wasm_throw, "vUiv*", "r")
|
||||
BUILTIN(__builtin_wasm_rethrow, "v", "r")
|
||||
TARGET_BUILTIN(__builtin_wasm_throw, "vUiv*", "r", "exception-handling")
|
||||
TARGET_BUILTIN(__builtin_wasm_rethrow, "v", "r", "exception-handling")
|
||||
|
||||
// Atomic wait and notify.
|
||||
BUILTIN(__builtin_wasm_atomic_wait_i32, "ii*iLLi", "n")
|
||||
|
@ -40,73 +50,68 @@ BUILTIN(__builtin_wasm_atomic_wait_i64, "iLLi*LLiLLi", "n")
|
|||
BUILTIN(__builtin_wasm_atomic_notify, "Uii*Ui", "n")
|
||||
|
||||
// Saturating fp-to-int conversions
|
||||
BUILTIN(__builtin_wasm_trunc_saturate_s_i32_f32, "if", "nc")
|
||||
BUILTIN(__builtin_wasm_trunc_saturate_u_i32_f32, "if", "nc")
|
||||
BUILTIN(__builtin_wasm_trunc_saturate_s_i32_f64, "id", "nc")
|
||||
BUILTIN(__builtin_wasm_trunc_saturate_u_i32_f64, "id", "nc")
|
||||
BUILTIN(__builtin_wasm_trunc_saturate_s_i64_f32, "LLif", "nc")
|
||||
BUILTIN(__builtin_wasm_trunc_saturate_u_i64_f32, "LLif", "nc")
|
||||
BUILTIN(__builtin_wasm_trunc_saturate_s_i64_f64, "LLid", "nc")
|
||||
BUILTIN(__builtin_wasm_trunc_saturate_u_i64_f64, "LLid", "nc")
|
||||
|
||||
// Floating point min/max
|
||||
BUILTIN(__builtin_wasm_min_f32, "fff", "nc")
|
||||
BUILTIN(__builtin_wasm_max_f32, "fff", "nc")
|
||||
BUILTIN(__builtin_wasm_min_f64, "ddd", "nc")
|
||||
BUILTIN(__builtin_wasm_max_f64, "ddd", "nc")
|
||||
TARGET_BUILTIN(__builtin_wasm_trunc_saturate_s_i32_f32, "if", "nc", "nontrapping-fptoint")
|
||||
TARGET_BUILTIN(__builtin_wasm_trunc_saturate_u_i32_f32, "if", "nc", "nontrapping-fptoint")
|
||||
TARGET_BUILTIN(__builtin_wasm_trunc_saturate_s_i32_f64, "id", "nc", "nontrapping-fptoint")
|
||||
TARGET_BUILTIN(__builtin_wasm_trunc_saturate_u_i32_f64, "id", "nc", "nontrapping-fptoint")
|
||||
TARGET_BUILTIN(__builtin_wasm_trunc_saturate_s_i64_f32, "LLif", "nc", "nontrapping-fptoint")
|
||||
TARGET_BUILTIN(__builtin_wasm_trunc_saturate_u_i64_f32, "LLif", "nc", "nontrapping-fptoint")
|
||||
TARGET_BUILTIN(__builtin_wasm_trunc_saturate_s_i64_f64, "LLid", "nc", "nontrapping-fptoint")
|
||||
TARGET_BUILTIN(__builtin_wasm_trunc_saturate_u_i64_f64, "LLid", "nc", "nontrapping-fptoint")
|
||||
|
||||
// SIMD builtins
|
||||
BUILTIN(__builtin_wasm_extract_lane_s_i8x16, "iV16cIi", "nc")
|
||||
BUILTIN(__builtin_wasm_extract_lane_u_i8x16, "iV16cIi", "nc")
|
||||
BUILTIN(__builtin_wasm_extract_lane_s_i16x8, "iV8sIi", "nc")
|
||||
BUILTIN(__builtin_wasm_extract_lane_u_i16x8, "iV8sIi", "nc")
|
||||
BUILTIN(__builtin_wasm_extract_lane_i32x4, "iV4iIi", "nc")
|
||||
BUILTIN(__builtin_wasm_extract_lane_i64x2, "LLiV2LLiIi", "nc")
|
||||
BUILTIN(__builtin_wasm_extract_lane_f32x4, "fV4fIi", "nc")
|
||||
BUILTIN(__builtin_wasm_extract_lane_f64x2, "dV2dIi", "nc")
|
||||
TARGET_BUILTIN(__builtin_wasm_extract_lane_s_i8x16, "iV16cIi", "nc", "simd128")
|
||||
TARGET_BUILTIN(__builtin_wasm_extract_lane_u_i8x16, "iV16cIi", "nc", "unimplemented-simd128")
|
||||
TARGET_BUILTIN(__builtin_wasm_extract_lane_s_i16x8, "iV8sIi", "nc", "simd128")
|
||||
TARGET_BUILTIN(__builtin_wasm_extract_lane_u_i16x8, "iV8sIi", "nc", "unimplemented-simd128")
|
||||
TARGET_BUILTIN(__builtin_wasm_extract_lane_i32x4, "iV4iIi", "nc", "simd128")
|
||||
TARGET_BUILTIN(__builtin_wasm_extract_lane_i64x2, "LLiV2LLiIi", "nc", "unimplemented-simd128")
|
||||
TARGET_BUILTIN(__builtin_wasm_extract_lane_f32x4, "fV4fIi", "nc", "simd128")
|
||||
TARGET_BUILTIN(__builtin_wasm_extract_lane_f64x2, "dV2dIi", "nc", "unimplemented-simd128")
|
||||
|
||||
BUILTIN(__builtin_wasm_replace_lane_i8x16, "V16cV16cIii", "nc")
|
||||
BUILTIN(__builtin_wasm_replace_lane_i16x8, "V8sV8sIii", "nc")
|
||||
BUILTIN(__builtin_wasm_replace_lane_i32x4, "V4iV4iIii", "nc")
|
||||
BUILTIN(__builtin_wasm_replace_lane_i64x2, "V2LLiV2LLiIiLLi", "nc")
|
||||
BUILTIN(__builtin_wasm_replace_lane_f32x4, "V4fV4fIif", "nc")
|
||||
BUILTIN(__builtin_wasm_replace_lane_f64x2, "V2dV2dIid", "nc")
|
||||
TARGET_BUILTIN(__builtin_wasm_replace_lane_i8x16, "V16cV16cIii", "nc", "simd128")
|
||||
TARGET_BUILTIN(__builtin_wasm_replace_lane_i16x8, "V8sV8sIii", "nc", "simd128")
|
||||
TARGET_BUILTIN(__builtin_wasm_replace_lane_i32x4, "V4iV4iIii", "nc", "simd128")
|
||||
TARGET_BUILTIN(__builtin_wasm_replace_lane_i64x2, "V2LLiV2LLiIiLLi", "nc", "unimplemented-simd128")
|
||||
TARGET_BUILTIN(__builtin_wasm_replace_lane_f32x4, "V4fV4fIif", "nc", "simd128")
|
||||
TARGET_BUILTIN(__builtin_wasm_replace_lane_f64x2, "V2dV2dIid", "nc", "unimplemented-simd128")
|
||||
|
||||
BUILTIN(__builtin_wasm_add_saturate_s_i8x16, "V16cV16cV16c", "nc")
|
||||
BUILTIN(__builtin_wasm_add_saturate_u_i8x16, "V16cV16cV16c", "nc")
|
||||
BUILTIN(__builtin_wasm_add_saturate_s_i16x8, "V8sV8sV8s", "nc")
|
||||
BUILTIN(__builtin_wasm_add_saturate_u_i16x8, "V8sV8sV8s", "nc")
|
||||
TARGET_BUILTIN(__builtin_wasm_add_saturate_s_i8x16, "V16cV16cV16c", "nc", "simd128")
|
||||
TARGET_BUILTIN(__builtin_wasm_add_saturate_u_i8x16, "V16cV16cV16c", "nc", "simd128")
|
||||
TARGET_BUILTIN(__builtin_wasm_add_saturate_s_i16x8, "V8sV8sV8s", "nc", "simd128")
|
||||
TARGET_BUILTIN(__builtin_wasm_add_saturate_u_i16x8, "V8sV8sV8s", "nc", "simd128")
|
||||
|
||||
BUILTIN(__builtin_wasm_sub_saturate_s_i8x16, "V16cV16cV16c", "nc")
|
||||
BUILTIN(__builtin_wasm_sub_saturate_u_i8x16, "V16cV16cV16c", "nc")
|
||||
BUILTIN(__builtin_wasm_sub_saturate_s_i16x8, "V8sV8sV8s", "nc")
|
||||
BUILTIN(__builtin_wasm_sub_saturate_u_i16x8, "V8sV8sV8s", "nc")
|
||||
TARGET_BUILTIN(__builtin_wasm_sub_saturate_s_i8x16, "V16cV16cV16c", "nc", "simd128")
|
||||
TARGET_BUILTIN(__builtin_wasm_sub_saturate_u_i8x16, "V16cV16cV16c", "nc", "simd128")
|
||||
TARGET_BUILTIN(__builtin_wasm_sub_saturate_s_i16x8, "V8sV8sV8s", "nc", "simd128")
|
||||
TARGET_BUILTIN(__builtin_wasm_sub_saturate_u_i16x8, "V8sV8sV8s", "nc", "simd128")
|
||||
|
||||
BUILTIN(__builtin_wasm_bitselect, "V4iV4iV4iV4i", "nc")
|
||||
TARGET_BUILTIN(__builtin_wasm_bitselect, "V4iV4iV4iV4i", "nc", "simd128")
|
||||
|
||||
BUILTIN(__builtin_wasm_any_true_i8x16, "iV16c", "nc")
|
||||
BUILTIN(__builtin_wasm_any_true_i16x8, "iV8s", "nc")
|
||||
BUILTIN(__builtin_wasm_any_true_i32x4, "iV4i", "nc")
|
||||
BUILTIN(__builtin_wasm_any_true_i64x2, "iV2LLi", "nc")
|
||||
BUILTIN(__builtin_wasm_all_true_i8x16, "iV16c", "nc")
|
||||
BUILTIN(__builtin_wasm_all_true_i16x8, "iV8s", "nc")
|
||||
BUILTIN(__builtin_wasm_all_true_i32x4, "iV4i", "nc")
|
||||
BUILTIN(__builtin_wasm_all_true_i64x2, "iV2LLi", "nc")
|
||||
TARGET_BUILTIN(__builtin_wasm_any_true_i8x16, "iV16c", "nc", "simd128")
|
||||
TARGET_BUILTIN(__builtin_wasm_any_true_i16x8, "iV8s", "nc", "simd128")
|
||||
TARGET_BUILTIN(__builtin_wasm_any_true_i32x4, "iV4i", "nc", "simd128")
|
||||
TARGET_BUILTIN(__builtin_wasm_any_true_i64x2, "iV2LLi", "nc", "unimplemented-simd128")
|
||||
TARGET_BUILTIN(__builtin_wasm_all_true_i8x16, "iV16c", "nc", "simd128")
|
||||
TARGET_BUILTIN(__builtin_wasm_all_true_i16x8, "iV8s", "nc", "simd128")
|
||||
TARGET_BUILTIN(__builtin_wasm_all_true_i32x4, "iV4i", "nc", "simd128")
|
||||
TARGET_BUILTIN(__builtin_wasm_all_true_i64x2, "iV2LLi", "nc", "unimplemented-simd128")
|
||||
|
||||
BUILTIN(__builtin_wasm_abs_f32x4, "V4fV4f", "nc")
|
||||
BUILTIN(__builtin_wasm_abs_f64x2, "V2dV2d", "nc")
|
||||
TARGET_BUILTIN(__builtin_wasm_abs_f32x4, "V4fV4f", "nc", "simd128")
|
||||
TARGET_BUILTIN(__builtin_wasm_abs_f64x2, "V2dV2d", "nc", "unimplemented-simd128")
|
||||
|
||||
BUILTIN(__builtin_wasm_min_f32x4, "V4fV4fV4f", "nc")
|
||||
BUILTIN(__builtin_wasm_max_f32x4, "V4fV4fV4f", "nc")
|
||||
BUILTIN(__builtin_wasm_min_f64x2, "V2dV2dV2d", "nc")
|
||||
BUILTIN(__builtin_wasm_max_f64x2, "V2dV2dV2d", "nc")
|
||||
TARGET_BUILTIN(__builtin_wasm_min_f32x4, "V4fV4fV4f", "nc", "simd128")
|
||||
TARGET_BUILTIN(__builtin_wasm_max_f32x4, "V4fV4fV4f", "nc", "simd128")
|
||||
TARGET_BUILTIN(__builtin_wasm_min_f64x2, "V2dV2dV2d", "nc", "unimplemented-simd128")
|
||||
TARGET_BUILTIN(__builtin_wasm_max_f64x2, "V2dV2dV2d", "nc", "unimplemented-simd128")
|
||||
|
||||
BUILTIN(__builtin_wasm_sqrt_f32x4, "V4fV4f", "nc")
|
||||
BUILTIN(__builtin_wasm_sqrt_f64x2, "V2dV2d", "nc")
|
||||
TARGET_BUILTIN(__builtin_wasm_sqrt_f32x4, "V4fV4f", "nc", "unimplemented-simd128")
|
||||
TARGET_BUILTIN(__builtin_wasm_sqrt_f64x2, "V2dV2d", "nc", "unimplemented-simd128")
|
||||
|
||||
BUILTIN(__builtin_wasm_trunc_saturate_s_i32x4_f32x4, "V4iV4f", "nc")
|
||||
BUILTIN(__builtin_wasm_trunc_saturate_u_i32x4_f32x4, "V4iV4f", "nc")
|
||||
BUILTIN(__builtin_wasm_trunc_saturate_s_i64x2_f64x2, "V2LLiV2d", "nc")
|
||||
BUILTIN(__builtin_wasm_trunc_saturate_u_i64x2_f64x2, "V2LLiV2d", "nc")
|
||||
TARGET_BUILTIN(__builtin_wasm_trunc_saturate_s_i32x4_f32x4, "V4iV4f", "nc", "simd128")
|
||||
TARGET_BUILTIN(__builtin_wasm_trunc_saturate_u_i32x4_f32x4, "V4iV4f", "nc", "simd128")
|
||||
TARGET_BUILTIN(__builtin_wasm_trunc_saturate_s_i64x2_f64x2, "V2LLiV2d", "nc", "unimplemented-simd128")
|
||||
TARGET_BUILTIN(__builtin_wasm_trunc_saturate_u_i64x2_f64x2, "V2LLiV2d", "nc", "unimplemented-simd128")
|
||||
|
||||
#undef BUILTIN
|
||||
#undef TARGET_BUILTIN
|
||||
|
|
|
@ -2141,6 +2141,8 @@ def mbranch_protection_EQ : Joined<["-"], "mbranch-protection=">,
|
|||
HelpText<"Enforce targets of indirect branches and function returns">;
|
||||
|
||||
def msimd128 : Flag<["-"], "msimd128">, Group<m_wasm_Features_Group>;
|
||||
def munimplemented_simd128 : Flag<["-"], "munimplemented-simd128">, Group<m_wasm_Features_Group>;
|
||||
def mno_unimplemented_simd128 : Flag<["-"], "mno-unimplemented-simd128">, Group<m_wasm_Features_Group>;
|
||||
def mno_simd128 : Flag<["-"], "mno-simd128">, Group<m_wasm_Features_Group>;
|
||||
def mnontrapping_fptoint : Flag<["-"], "mnontrapping-fptoint">, Group<m_wasm_Features_Group>;
|
||||
def mno_nontrapping_fptoint : Flag<["-"], "mno-nontrapping-fptoint">, Group<m_wasm_Features_Group>;
|
||||
|
|
|
@ -24,6 +24,8 @@ using namespace clang::targets;
|
|||
const Builtin::Info WebAssemblyTargetInfo::BuiltinInfo[] = {
|
||||
#define BUILTIN(ID, TYPE, ATTRS) \
|
||||
{#ID, TYPE, ATTRS, nullptr, ALL_LANGUAGES, nullptr},
|
||||
#define TARGET_BUILTIN(ID, TYPE, ATTRS, FEATURE) \
|
||||
{#ID, TYPE, ATTRS, nullptr, ALL_LANGUAGES, FEATURE},
|
||||
#define LIBBUILTIN(ID, TYPE, ATTRS, HEADER) \
|
||||
{#ID, TYPE, ATTRS, HEADER, ALL_LANGUAGES, nullptr},
|
||||
#include "clang/Basic/BuiltinsWebAssembly.def"
|
||||
|
@ -35,6 +37,7 @@ static constexpr llvm::StringLiteral ValidCPUNames[] = {
|
|||
bool WebAssemblyTargetInfo::hasFeature(StringRef Feature) const {
|
||||
return llvm::StringSwitch<bool>(Feature)
|
||||
.Case("simd128", SIMDLevel >= SIMD128)
|
||||
.Case("unimplemented-simd128", SIMDLevel >= UnimplementedSIMD128)
|
||||
.Case("nontrapping-fptoint", HasNontrappingFPToInt)
|
||||
.Case("sign-ext", HasSignExt)
|
||||
.Case("exception-handling", HasExceptionHandling)
|
||||
|
@ -55,6 +58,44 @@ void WebAssemblyTargetInfo::getTargetDefines(const LangOptions &Opts,
|
|||
defineCPUMacros(Builder, "wasm", /*Tuning=*/false);
|
||||
if (SIMDLevel >= SIMD128)
|
||||
Builder.defineMacro("__wasm_simd128__");
|
||||
if (SIMDLevel >= UnimplementedSIMD128)
|
||||
Builder.defineMacro("__wasm_unimplemented_simd128__");
|
||||
}
|
||||
|
||||
void WebAssemblyTargetInfo::setSIMDLevel(llvm::StringMap<bool> &Features,
|
||||
SIMDEnum Level) {
|
||||
switch (Level) {
|
||||
case UnimplementedSIMD128:
|
||||
Features["unimplemented-simd128"] = true;
|
||||
LLVM_FALLTHROUGH;
|
||||
case SIMD128:
|
||||
Features["simd128"] = true;
|
||||
LLVM_FALLTHROUGH;
|
||||
case NoSIMD:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool WebAssemblyTargetInfo::initFeatureMap(
|
||||
llvm::StringMap<bool> &Features, DiagnosticsEngine &Diags, StringRef CPU,
|
||||
const std::vector<std::string> &FeaturesVec) const {
|
||||
if (CPU == "bleeding-edge") {
|
||||
Features["nontrapping-fptoint"] = true;
|
||||
Features["sign-ext"] = true;
|
||||
setSIMDLevel(Features, SIMD128);
|
||||
}
|
||||
// Other targets do not consider user-configured features here, but while we
|
||||
// are actively developing new features it is useful to let user-configured
|
||||
// features control availability of builtins
|
||||
setSIMDLevel(Features, SIMDLevel);
|
||||
if (HasNontrappingFPToInt)
|
||||
Features["nontrapping-fptoint"] = true;
|
||||
if (HasSignExt)
|
||||
Features["sign-ext"] = true;
|
||||
if (HasExceptionHandling)
|
||||
Features["exception-handling"] = true;
|
||||
|
||||
return TargetInfo::initFeatureMap(Features, Diags, CPU, FeaturesVec);
|
||||
}
|
||||
|
||||
bool WebAssemblyTargetInfo::handleTargetFeatures(
|
||||
|
@ -68,6 +109,14 @@ bool WebAssemblyTargetInfo::handleTargetFeatures(
|
|||
SIMDLevel = std::min(SIMDLevel, SIMDEnum(SIMD128 - 1));
|
||||
continue;
|
||||
}
|
||||
if (Feature == "+unimplemented-simd128") {
|
||||
SIMDLevel = std::max(SIMDLevel, SIMDEnum(UnimplementedSIMD128));
|
||||
continue;
|
||||
}
|
||||
if (Feature == "-unimplemented-simd128") {
|
||||
SIMDLevel = std::min(SIMDLevel, SIMDEnum(UnimplementedSIMD128 - 1));
|
||||
continue;
|
||||
}
|
||||
if (Feature == "+nontrapping-fptoint") {
|
||||
HasNontrappingFPToInt = true;
|
||||
continue;
|
||||
|
|
|
@ -28,7 +28,8 @@ class LLVM_LIBRARY_VISIBILITY WebAssemblyTargetInfo : public TargetInfo {
|
|||
enum SIMDEnum {
|
||||
NoSIMD,
|
||||
SIMD128,
|
||||
} SIMDLevel;
|
||||
UnimplementedSIMD128,
|
||||
} SIMDLevel = NoSIMD;
|
||||
|
||||
bool HasNontrappingFPToInt;
|
||||
bool HasSignExt;
|
||||
|
@ -59,18 +60,12 @@ protected:
|
|||
MacroBuilder &Builder) const override;
|
||||
|
||||
private:
|
||||
static void setSIMDLevel(llvm::StringMap<bool> &Features, SIMDEnum Level);
|
||||
|
||||
bool
|
||||
initFeatureMap(llvm::StringMap<bool> &Features, DiagnosticsEngine &Diags,
|
||||
StringRef CPU,
|
||||
const std::vector<std::string> &FeaturesVec) const override {
|
||||
if (CPU == "bleeding-edge") {
|
||||
Features["simd128"] = true;
|
||||
Features["nontrapping-fptoint"] = true;
|
||||
Features["sign-ext"] = true;
|
||||
}
|
||||
return TargetInfo::initFeatureMap(Features, Diags, CPU, FeaturesVec);
|
||||
}
|
||||
|
||||
const std::vector<std::string> &FeaturesVec) const override;
|
||||
bool hasFeature(StringRef Feature) const final;
|
||||
|
||||
bool handleTargetFeatures(std::vector<std::string> &Features,
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
// RUN: %clang_cc1 -triple wasm32-unknown-unknown -fno-lax-vector-conversions \
|
||||
// RUN: -O3 -emit-llvm -o - %s \
|
||||
// RUN: | FileCheck %s -check-prefixes WEBASSEMBLY,WEBASSEMBLY32
|
||||
// RUN: %clang_cc1 -triple wasm64-unknown-unknown -fno-lax-vector-conversions \
|
||||
// RUN: -O3 -emit-llvm -o - %s \
|
||||
// RUN: | FileCheck %s -check-prefixes WEBASSEMBLY,WEBASSEMBLY64
|
||||
// RUN: %clang_cc1 -triple wasm32-unknown-unknown -target-feature +unimplemented-simd128 -target-feature +nontrapping-fptoint -target-feature +exception-handling -fno-lax-vector-conversions -O3 -emit-llvm -o - %s | FileCheck %s -check-prefixes WEBASSEMBLY,WEBASSEMBLY32
|
||||
// RUN: %clang_cc1 -triple wasm64-unknown-unknown -target-feature +unimplemented-simd128 -target-feature +nontrapping-fptoint -target-feature +exception-handling -fno-lax-vector-conversions -O3 -emit-llvm -o - %s | FileCheck %s -check-prefixes WEBASSEMBLY,WEBASSEMBLY64
|
||||
// RUN: not %clang_cc1 -triple wasm64-unknown-unknown -target-feature +nontrapping-fptoint -target-feature +exception-handling -fno-lax-vector-conversions -O3 -emit-llvm -o - %s 2>&1 | FileCheck %s -check-prefixes MISSING-SIMD
|
||||
|
||||
// SIMD convenience types
|
||||
typedef char i8x16 __attribute((vector_size(16)));
|
||||
|
@ -158,6 +155,7 @@ double max_f64(double x, double y) {
|
|||
|
||||
int extract_lane_s_i8x16(i8x16 v) {
|
||||
return __builtin_wasm_extract_lane_s_i8x16(v, 13);
|
||||
// MISSING-SIMD: error: '__builtin_wasm_extract_lane_s_i8x16' needs target feature simd128
|
||||
// WEBASSEMBLY: extractelement <16 x i8> %v, i32 13
|
||||
// WEBASSEMBLY-NEXT: sext
|
||||
// WEBASSEMBLY-NEXT: ret
|
||||
|
|
|
@ -8,6 +8,15 @@
|
|||
// SIMD128:#define __wasm_simd128__ 1{{$}}
|
||||
//
|
||||
// RUN: %clang -E -dM %s -o - 2>&1 \
|
||||
// RUN: -target wasm32-unknown-unknown -munimplemented-simd128 \
|
||||
// RUN: | FileCheck %s -check-prefix=SIMD128-UNIMPLEMENTED
|
||||
// RUN: %clang -E -dM %s -o - 2>&1 \
|
||||
// RUN: -target wasm64-unknown-unknown -munimplemented-simd128 \
|
||||
// RUN: | FileCheck %s -check-prefix=SIMD128-UNIMPLEMENTED
|
||||
//
|
||||
// SIMD128-UNIMPLEMENTED:#define __wasm_unimplemented_simd128__ 1{{$}}
|
||||
//
|
||||
// RUN: %clang -E -dM %s -o - 2>&1 \
|
||||
// RUN: -target wasm32-unknown-unknown -mcpu=mvp \
|
||||
// RUN: | FileCheck %s -check-prefix=MVP
|
||||
// RUN: %clang -E -dM %s -o - 2>&1 \
|
||||
|
|
Loading…
Reference in New Issue