summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorDan Gohman <dan433584@gmail.com>2015-09-03 22:51:53 +0000
committerDan Gohman <dan433584@gmail.com>2015-09-03 22:51:53 +0000
commitc285307e1457c4db2346443a4336e672d7487111 (patch)
treec802922c6e228f80d4ca3cfd6fbdfd16c6179f0f /clang/test
parente6702ca0e24fd6674770f3cac7e2b0e590e095bb (diff)
downloadbcm5719-llvm-c285307e1457c4db2346443a4336e672d7487111.tar.gz
bcm5719-llvm-c285307e1457c4db2346443a4336e672d7487111.zip
[WebAssembly] Initial WebAssembly support in clang
This implements basic support for compiling (though not yet assembling or linking) for a WebAssembly target. Note that ABI details are not yet finalized, and may change. Differential Revision: http://reviews.llvm.org/D12002 llvm-svn: 246814
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/CodeGen/align-wasm.c13
-rw-r--r--clang/test/CodeGen/builtins-wasm.c10
-rw-r--r--clang/test/CodeGen/target-data.c8
-rw-r--r--clang/test/CodeGen/wasm-arguments.c93
-rw-r--r--clang/test/CodeGen/wasm-regparm.c4
-rw-r--r--clang/test/CodeGenCXX/constructor-destructor-return-this.cpp2
-rw-r--r--clang/test/CodeGenCXX/member-alignment.cpp15
-rw-r--r--clang/test/CodeGenCXX/member-function-pointers.cpp2
-rw-r--r--clang/test/CodeGenCXX/static-init-wasm.cpp54
-rw-r--r--clang/test/CodeGenCXX/wasm-args-returns.cpp100
-rw-r--r--clang/test/Driver/thread-model.c16
-rw-r--r--clang/test/Driver/wasm32-unknown-unknown.cpp119
-rw-r--r--clang/test/Driver/wasm64-unknown-unknown.cpp119
-rw-r--r--clang/test/Preprocessor/init.c632
-rw-r--r--clang/test/Preprocessor/wasm-target-features.c35
15 files changed, 1219 insertions, 3 deletions
diff --git a/clang/test/CodeGen/align-wasm.c b/clang/test/CodeGen/align-wasm.c
new file mode 100644
index 00000000000..ff0c213acdd
--- /dev/null
+++ b/clang/test/CodeGen/align-wasm.c
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -triple wasm32-unknown-unknown -emit-llvm %s -o - \
+// RUN: | FileCheck %s
+// RUN: %clang_cc1 -triple wasm64-unknown-unknown -emit-llvm %s -o - \
+// RUN: | FileCheck %s
+
+void test1_f(void *);
+
+void test1_g(void) {
+ float x[4];
+ test1_f(x);
+}
+// CHECK: @test1_g
+// CHECK: alloca [4 x float], align 16
diff --git a/clang/test/CodeGen/builtins-wasm.c b/clang/test/CodeGen/builtins-wasm.c
new file mode 100644
index 00000000000..93a66d0a337
--- /dev/null
+++ b/clang/test/CodeGen/builtins-wasm.c
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -triple wasm32-unknown-unknown -O3 -emit-llvm -o - %s \
+// RUN: | FileCheck %s -check-prefix=WEBASSEMBLY32
+// RUN: %clang_cc1 -triple wasm64-unknown-unknown -O3 -emit-llvm -o - %s \
+// RUN: | FileCheck %s -check-prefix=WEBASSEMBLY64
+
+__SIZE_TYPE__ f0(void) {
+ return __builtin_wasm_page_size();
+// WEBASSEMBLY32: call {{i.*}} @llvm.wasm.page.size.i32()
+// WEBASSEMBLY64: call {{i.*}} @llvm.wasm.page.size.i64()
+}
diff --git a/clang/test/CodeGen/target-data.c b/clang/test/CodeGen/target-data.c
index 3c3ea040078..049e4d105e6 100644
--- a/clang/test/CodeGen/target-data.c
+++ b/clang/test/CodeGen/target-data.c
@@ -78,6 +78,14 @@
// RUN: FileCheck %s -check-prefix=LE32-NACL
// LE32-NACL: target datalayout = "e-p:32:32-i64:64"
+// RUN: %clang_cc1 -triple wasm32-unknown-unknown -o - -emit-llvm %s | \
+// RUN: FileCheck %s -check-prefix=WEBASSEMBLY32
+// WEBASSEMBLY32: target datalayout = "e-p:32:32-i64:64-n32:64-S128"
+
+// RUN: %clang_cc1 -triple wasm64-unknown-unknown -o - -emit-llvm %s | \
+// RUN: FileCheck %s -check-prefix=WEBASSEMBLY64
+// WEBASSEMBLY64: target datalayout = "e-p:64:64-i64:64-n32:64-S128"
+
// RUN: %clang_cc1 -triple powerpc-unknown -o - -emit-llvm %s | \
// RUN: FileCheck %s -check-prefix=PPC
// PPC: target datalayout = "E-m:e-p:32:32-i64:64-n32"
diff --git a/clang/test/CodeGen/wasm-arguments.c b/clang/test/CodeGen/wasm-arguments.c
new file mode 100644
index 00000000000..52388046f93
--- /dev/null
+++ b/clang/test/CodeGen/wasm-arguments.c
@@ -0,0 +1,93 @@
+// RUN: %clang_cc1 -triple wasm32-unknown-unknown %s -emit-llvm -o - \
+// RUN: | FileCheck %s -check-prefix=WEBASSEMBLY32
+// RUN: %clang_cc1 -triple wasm64-unknown-unknown %s -emit-llvm -o - \
+// RUN: | FileCheck %s -check-prefix=WEBASSEMBLY64
+
+// Basic argument/attribute tests for WebAssembly
+
+// WEBASSEMBLY32: define void @f0(i32 %i, i32 %j, i64 %k, double %l, double %m)
+// WEBASSEMBLY64: define void @f0(i32 %i, i64 %j, i64 %k, double %l, double %m)
+void f0(int i, long j, long long k, double l, long double m) {}
+
+typedef struct {
+ int aa;
+ int bb;
+} s1;
+// Structs should be passed byval and not split up.
+// WEBASSEMBLY32: define void @f1(%struct.s1* byval align 4 %i)
+// WEBASSEMBLY64: define void @f1(%struct.s1* byval align 4 %i)
+void f1(s1 i) {}
+
+typedef struct {
+ int cc;
+} s2;
+// Single-element structs should be returned as the one element.
+// WEBASSEMBLY32: define i32 @f2()
+// WEBASSEMBLY64: define i32 @f2()
+s2 f2() {
+ s2 foo;
+ return foo;
+}
+
+typedef struct {
+ int cc;
+ int dd;
+} s3;
+// Structs should be returned sret and not simplified by the frontend.
+// WEBASSEMBLY32: define void @f3(%struct.s3* noalias sret %agg.result)
+// WEBASSEMBLY64: define void @f3(%struct.s3* noalias sret %agg.result)
+s3 f3() {
+ s3 foo;
+ return foo;
+}
+
+// WEBASSEMBLY32: define void @f4(i64 %i)
+// WEBASSEMBLY64: define void @f4(i64 %i)
+void f4(long long i) {}
+
+// i8/i16 should be signext, i32 and higher should not.
+// WEBASSEMBLY32: define void @f5(i8 signext %a, i16 signext %b)
+// WEBASSEMBLY64: define void @f5(i8 signext %a, i16 signext %b)
+void f5(char a, short b) {}
+
+// WEBASSEMBLY32: define void @f6(i8 zeroext %a, i16 zeroext %b)
+// WEBASSEMBLY64: define void @f6(i8 zeroext %a, i16 zeroext %b)
+void f6(unsigned char a, unsigned short b) {}
+
+
+enum my_enum {
+ ENUM1,
+ ENUM2,
+ ENUM3,
+};
+// Enums should be treated as the underlying i32.
+// WEBASSEMBLY32: define void @f7(i32 %a)
+// WEBASSEMBLY64: define void @f7(i32 %a)
+void f7(enum my_enum a) {}
+
+enum my_big_enum {
+ ENUM4 = 0xFFFFFFFFFFFFFFFF,
+};
+// Big enums should be treated as the underlying i64.
+// WEBASSEMBLY32: define void @f8(i64 %a)
+// WEBASSEMBLY64: define void @f8(i64 %a)
+void f8(enum my_big_enum a) {}
+
+union simple_union {
+ int a;
+ char b;
+};
+// Unions should be passed as byval structs.
+// WEBASSEMBLY32: define void @f9(%union.simple_union* byval align 4 %s)
+// WEBASSEMBLY64: define void @f9(%union.simple_union* byval align 4 %s)
+void f9(union simple_union s) {}
+
+typedef struct {
+ int b4 : 4;
+ int b3 : 3;
+ int b8 : 8;
+} bitfield1;
+// Bitfields should be passed as byval structs.
+// WEBASSEMBLY32: define void @f10(%struct.bitfield1* byval align 4 %bf1)
+// WEBASSEMBLY64: define void @f10(%struct.bitfield1* byval align 4 %bf1)
+void f10(bitfield1 bf1) {}
diff --git a/clang/test/CodeGen/wasm-regparm.c b/clang/test/CodeGen/wasm-regparm.c
new file mode 100644
index 00000000000..66037d92b4f
--- /dev/null
+++ b/clang/test/CodeGen/wasm-regparm.c
@@ -0,0 +1,4 @@
+// RUN: %clang_cc1 -triple wasm32-unknown-unknown %s -fsyntax-only -verify
+// RUN: %clang_cc1 -triple wasm64-unknown-unknown %s -fsyntax-only -verify
+
+void __attribute__((regparm(2))) fc_f1(int i, int j, int k) {} // expected-error{{'regparm' is not valid on this platform}}
diff --git a/clang/test/CodeGenCXX/constructor-destructor-return-this.cpp b/clang/test/CodeGenCXX/constructor-destructor-return-this.cpp
index 893e3a079ff..9d47d1706bb 100644
--- a/clang/test/CodeGenCXX/constructor-destructor-return-this.cpp
+++ b/clang/test/CodeGenCXX/constructor-destructor-return-this.cpp
@@ -1,6 +1,8 @@
//RUN: %clang_cc1 %s -emit-llvm -o - -triple=i686-unknown-linux | FileCheck --check-prefix=CHECKGEN %s
//RUN: %clang_cc1 %s -emit-llvm -o - -triple=thumbv7-apple-ios6.0 -target-abi apcs-gnu | FileCheck --check-prefix=CHECKARM %s
//RUN: %clang_cc1 %s -emit-llvm -o - -triple=thumbv7-apple-ios5.0 -target-abi apcs-gnu | FileCheck --check-prefix=CHECKIOS5 %s
+//RUN: %clang_cc1 %s -emit-llvm -o - -triple=wasm32-unknown-unknown \
+//RUN: | FileCheck --check-prefix=CHECKARM %s
//RUN: %clang_cc1 %s -emit-llvm -o - -triple=i386-pc-win32 -fno-rtti | FileCheck --check-prefix=CHECKMS %s
// FIXME: these tests crash on the bots when run with -triple=x86_64-pc-win32
diff --git a/clang/test/CodeGenCXX/member-alignment.cpp b/clang/test/CodeGenCXX/member-alignment.cpp
index 43ed5e28e88..ff6bb442b84 100644
--- a/clang/test/CodeGenCXX/member-alignment.cpp
+++ b/clang/test/CodeGenCXX/member-alignment.cpp
@@ -1,4 +1,9 @@
-// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple %s -o - | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple %s -o - | \
+// RUN: FileCheck -check-prefix CHECK-ITANIUM %s
+// RUN: %clang_cc1 -emit-llvm -triple wasm32-unknown-unknown %s -o - | \
+// RUN: FileCheck -check-prefix CHECK-WEBASSEMBLY32 %s
+// RUN: %clang_cc1 -emit-llvm -triple wasm64-unknown-unknown %s -o - | \
+// RUN: FileCheck -check-prefix CHECK-WEBASSEMBLY64 %s
// rdar://7268289
@@ -10,10 +15,14 @@ public:
void
t::bar(void) {
-// CHECK: _ZN1t3barEv{{.*}} align 2
+// CHECK-ITANIUM: @_ZN1t3barEv({{.*}}) #0 align 2 {
+// CHECK-WEBASSEMBLY32: @_ZN1t3barEv({{.*}}) #0 {
+// CHECK-WEBASSEMBLY64: @_ZN1t3barEv({{.*}}) #0 {
}
void
t::foo(void) {
-// CHECK: _ZN1t3fooEv{{.*}} align 2
+// CHECK-ITANIUM: @_ZN1t3fooEv({{.*}}) unnamed_addr #0 align 2 {
+// CHECK-WEBASSEMBLY32: @_ZN1t3fooEv({{.*}}) unnamed_addr #0 {
+// CHECK-WEBASSEMBLY64: @_ZN1t3fooEv({{.*}}) unnamed_addr #0 {
}
diff --git a/clang/test/CodeGenCXX/member-function-pointers.cpp b/clang/test/CodeGenCXX/member-function-pointers.cpp
index 7ffe4cd9d28..faeb8550c3c 100644
--- a/clang/test/CodeGenCXX/member-function-pointers.cpp
+++ b/clang/test/CodeGenCXX/member-function-pointers.cpp
@@ -8,6 +8,8 @@
// RUN: %clang_cc1 %s -emit-llvm -o - -triple=le32-unknown-nacl | FileCheck -check-prefix GLOBAL-ARM %s
// MIPS uses the same representation of method pointers as ARM.
// RUN: %clang_cc1 %s -emit-llvm -o - -triple=mips-unknown-linux-gnu | FileCheck -check-prefix GLOBAL-ARM %s
+// WebAssembly uses the same representation of method pointers as ARM.
+// RUN: %clang_cc1 %s -emit-llvm -o - -triple=wasm32-unknown-unknown | FileCheck -check-prefix GLOBAL-ARM %s
struct A { int a; void f(); virtual void vf1(); virtual void vf2(); };
struct B { int b; virtual void g(); };
diff --git a/clang/test/CodeGenCXX/static-init-wasm.cpp b/clang/test/CodeGenCXX/static-init-wasm.cpp
new file mode 100644
index 00000000000..e842509af48
--- /dev/null
+++ b/clang/test/CodeGenCXX/static-init-wasm.cpp
@@ -0,0 +1,54 @@
+// RUN: %clang_cc1 -emit-llvm -triple=wasm32-unknown-unknown -o - %s \
+// RUN: | FileCheck %s -check-prefix=WEBASSEMBLY32
+// RUN: %clang_cc1 -emit-llvm -triple=wasm64-unknown-unknown -o - %s \
+// RUN: | FileCheck %s -check-prefix=WEBASSEMBLY64
+
+// Test that we don't create common blocks.
+int tentative;
+// WEBASSEMBLY32: @tentative = global i32 0, align 4
+// WEBASSEMBLY64: @tentative = global i32 0, align 4
+
+// Test that WebAssembly uses the ARM-style ABI in which the static
+// variable's guard variable is tested via "load i8 and test the
+// bottom bit" rather than the Itanium/x86 ABI which uses "load i8
+// and compare with zero".
+int f();
+void g() {
+ static int a = f();
+}
+// WEBASSEMBLY32-LABEL: @_Z1gv()
+// WEBASSEMBLY32: %[[R0:.+]] = load atomic i8, i8* bitcast (i32* @_ZGVZ1gvE1a to i8*) acquire, align 1
+// WEBASSEMBLY32-NEXT: %[[R1:.+]] = and i8 %[[R0]], 1
+// WEBASSEMBLY32-NEXT: %[[R2:.+]] = icmp eq i8 %[[R1]], 0
+// WEBASSEMBLY32-NEXT: br i1 %[[R2]], label %[[CHECK:.+]], label %[[END:.+]]
+// WEBASSEMBLY32: [[CHECK]]
+// WEBASSEMBLY32: call i32 @__cxa_guard_acquire
+// WEBASSEMBLY32: [[END]]
+// WEBASSEMBLY32: call void @__cxa_guard_release
+//
+// WEBASSEMBLY64-LABEL: @_Z1gv()
+// WEBASSEMBLY64: %[[R0:.+]] = load atomic i8, i8* bitcast (i64* @_ZGVZ1gvE1a to i8*) acquire, align 1
+// WEBASSEMBLY64-NEXT: %[[R1:.+]] = and i8 %[[R0]], 1
+// WEBASSEMBLY64-NEXT: %[[R2:.+]] = icmp eq i8 %[[R1]], 0
+// WEBASSEMBLY64-NEXT: br i1 %[[R2]], label %[[CHECK:.+]], label %[[END:.+]]
+// WEBASSEMBLY64: [[CHECK]]
+// WEBASSEMBLY64: call i32 @__cxa_guard_acquire
+// WEBASSEMBLY64: [[END]]
+// WEBASSEMBLY64: call void @__cxa_guard_release
+
+// Test various aspects of static constructor calls.
+struct A {
+ A();
+};
+
+A theA;
+
+// WEBASSEMBLY32: define internal void @__cxx_global_var_init() #0 section ".text.__startup" {
+// WEBASSEMBLY32: call %struct.A* @_ZN1AC1Ev(%struct.A* @theA)
+// WEBASSEMBLY32: define internal void @_GLOBAL__sub_I_static_init_wasm.cpp() #0 section ".text.__startup" {
+// WEBASSEMBLY32: call void @__cxx_global_var_init()
+//
+// WEBASSEMBLY64: define internal void @__cxx_global_var_init() #0 section ".text.__startup" {
+// WEBASSEMBLY64: call %struct.A* @_ZN1AC1Ev(%struct.A* @theA)
+// WEBASSEMBLY64: define internal void @_GLOBAL__sub_I_static_init_wasm.cpp() #0 section ".text.__startup" {
+// WEBASSEMBLY64: call void @__cxx_global_var_init()
diff --git a/clang/test/CodeGenCXX/wasm-args-returns.cpp b/clang/test/CodeGenCXX/wasm-args-returns.cpp
new file mode 100644
index 00000000000..4ef085f6baa
--- /dev/null
+++ b/clang/test/CodeGenCXX/wasm-args-returns.cpp
@@ -0,0 +1,100 @@
+// RUN: %clang_cc1 -O1 -triple wasm32-unknown-unknown -emit-llvm -o - %s \
+// RUN: | FileCheck %s
+// RUN: %clang_cc1 -O1 -triple wasm64-unknown-unknown -emit-llvm -o - %s \
+// RUN: | FileCheck %s
+
+#define concat_(x, y) x ## y
+#define concat(x, y) concat_(x, y)
+
+#define test(T) \
+ T forward(T x) { return x; } \
+ void use(T x); \
+ T concat(def_, T)(void); \
+ void concat(test_, T)(void) { use(concat(def_, T)()); }
+
+struct one_field { double d; };
+test(one_field);
+// CHECK: define double @_Z7forward9one_field(double %{{.*}})
+//
+// CHECK: define void @_Z14test_one_fieldv()
+// CHECK: %[[call:.*]] = tail call double @_Z13def_one_fieldv()
+// CHECK: tail call void @_Z3use9one_field(double %[[call]])
+// CHECK: ret void
+//
+// CHECK: declare void @_Z3use9one_field(double)
+// CHECK: declare double @_Z13def_one_fieldv()
+
+struct two_fields { double d, e; };
+test(two_fields);
+// CHECK: define void @_Z7forward10two_fields(%struct.two_fields* noalias nocapture sret %{{.*}}, %struct.two_fields* byval nocapture readonly align 8 %{{.*}})
+//
+// CHECK: define void @_Z15test_two_fieldsv()
+// CHECK: %[[tmp:.*]] = alloca %struct.two_fields, align 8
+// CHECK: call void @_Z14def_two_fieldsv(%struct.two_fields* nonnull sret %[[tmp]])
+// CHECK: call void @_Z3use10two_fields(%struct.two_fields* byval nonnull align 8 %[[tmp]])
+// CHECK: ret void
+//
+// CHECK: declare void @_Z3use10two_fields(%struct.two_fields* byval align 8)
+// CHECK: declare void @_Z14def_two_fieldsv(%struct.two_fields* sret)
+
+struct copy_ctor {
+ double d;
+ copy_ctor(copy_ctor const&);
+};
+test(copy_ctor);
+// CHECK: define void @_Z7forward9copy_ctor(%struct.copy_ctor* noalias sret %{{.*}}, %struct.copy_ctor* align 8 %{{.*}})
+//
+// CHECK: declare %struct.copy_ctor* @_ZN9copy_ctorC1ERKS_(%struct.copy_ctor* returned, %struct.copy_ctor* dereferenceable(8))
+//
+// CHECK: define void @_Z14test_copy_ctorv()
+// CHECK: %[[tmp:.*]] = alloca %struct.copy_ctor, align 8
+// CHECK: call void @_Z13def_copy_ctorv(%struct.copy_ctor* nonnull sret %[[tmp]])
+// CHECK: call void @_Z3use9copy_ctor(%struct.copy_ctor* nonnull align 8 %[[tmp]])
+// CHECK: ret void
+//
+// CHECK: declare void @_Z3use9copy_ctor(%struct.copy_ctor* align 8)
+// CHECK: declare void @_Z13def_copy_ctorv(%struct.copy_ctor* sret)
+
+struct __attribute__((aligned(16))) aligned_copy_ctor {
+ double d, e;
+ aligned_copy_ctor(aligned_copy_ctor const&);
+};
+test(aligned_copy_ctor);
+// CHECK: define void @_Z7forward17aligned_copy_ctor(%struct.aligned_copy_ctor* noalias sret %{{.*}}, %struct.aligned_copy_ctor* align 16 %{{.*}})
+//
+// CHECK: declare %struct.aligned_copy_ctor* @_ZN17aligned_copy_ctorC1ERKS_(%struct.aligned_copy_ctor* returned, %struct.aligned_copy_ctor* dereferenceable(16))
+//
+// CHECK: define void @_Z22test_aligned_copy_ctorv()
+// CHECK: %[[tmp:.*]] = alloca %struct.aligned_copy_ctor, align 16
+// CHECK: call void @_Z21def_aligned_copy_ctorv(%struct.aligned_copy_ctor* nonnull sret %[[tmp]])
+// CHECK: call void @_Z3use17aligned_copy_ctor(%struct.aligned_copy_ctor* nonnull align 16 %[[tmp]])
+// CHECK: ret void
+//
+// CHECK: declare void @_Z3use17aligned_copy_ctor(%struct.aligned_copy_ctor* align 16)
+// CHECK: declare void @_Z21def_aligned_copy_ctorv(%struct.aligned_copy_ctor* sret)
+
+struct empty {};
+test(empty);
+// CHECK: define void @_Z7forward5empty()
+//
+// CHECK: define void @_Z10test_emptyv()
+// CHECK: tail call void @_Z9def_emptyv()
+// CHECK: tail call void @_Z3use5empty()
+// CHECK: ret void
+//
+// CHECK: declare void @_Z3use5empty()
+// CHECK: declare void @_Z9def_emptyv()
+
+struct one_bitfield {
+ int d:3;
+};
+test(one_bitfield);
+// CHECK: define i32 @_Z7forward12one_bitfield(i32 %{{.*}})
+//
+// CHECK: define void @_Z17test_one_bitfieldv()
+// CHECK: %[[call:.*]] = tail call i32 @_Z16def_one_bitfieldv()
+// CHECK: tail call void @_Z3use12one_bitfield(i32 %[[call]])
+// CHECK: ret void
+//
+// CHECK: declare void @_Z3use12one_bitfield(i32)
+// CHECK: declare i32 @_Z16def_one_bitfieldv()
diff --git a/clang/test/Driver/thread-model.c b/clang/test/Driver/thread-model.c
index 9702c2231a2..d01ef1c1a47 100644
--- a/clang/test/Driver/thread-model.c
+++ b/clang/test/Driver/thread-model.c
@@ -13,3 +13,19 @@
// CHECK-LINUX-SINGLE: Thread model: single
// CHECK-LINUX-SINGLE: "-mthread-model" "single"
// CHECK-LINUX-INVALID-NOT: Thread model:
+
+// RUN: %clang -### -target wasm32-unknown-linux-gnu -c %s -v 2>&1 | FileCheck -check-prefix=CHECK-WEBASSEMBLY-DEFAULT %s
+// RUN: %clang -### -target wasm32-unknown-linux-gnu -c %s -v -mthread-model single 2>&1 | FileCheck -check-prefix=CHECK-WEBASSEMBLY-SINGLE %s
+// RUN: %clang -### -target wasm32-unknown-linux-gnu -c %s -v -mthread-model posix 2>&1 | FileCheck -check-prefix=CHECK-WEBASSEMBLY-POSIX %s
+// RUN: %clang -### -target wasm32-unknown-linux-gnu -c %s -v -mthread-model silly 2>&1 | FileCheck -check-prefix=CHECK-WEBASSEMBLY-INVALID %s
+// RUN: %clang -### -target wasm64-unknown-linux-gnu -c %s -v 2>&1 | FileCheck -check-prefix=CHECK-WEBASSEMBLY-DEFAULT %s
+// RUN: %clang -### -target wasm64-unknown-linux-gnu -c %s -v -mthread-model single 2>&1 | FileCheck -check-prefix=CHECK-WEBASSEMBLY-SINGLE %s
+// RUN: %clang -### -target wasm64-unknown-linux-gnu -c %s -v -mthread-model posix 2>&1 | FileCheck -check-prefix=CHECK-WEBASSEMBLY-POSIX %s
+// RUN: %clang -### -target wasm64-unknown-linux-gnu -c %s -v -mthread-model silly 2>&1 | FileCheck -check-prefix=CHECK-WEBASSEMBLY-INVALID %s
+// CHECK-WEBASSEMBLY-DEFAULT: Thread model: posix
+// CHECK-WEBASSEMBLY-DEFAULT: "-mthread-model" "posix"
+// CHECK-WEBASSEMBLY-SINGLE: Thread model: single
+// CHECK-WEBASSEMBLY-SINGLE: "-mthread-model" "single"
+// CHECK-WEBASSEMBLY-POSIX: Thread model: posix
+// CHECK-WEBASSEMBLY-POSIX: "-mthread-model" "posix"
+// CHECK-WEBASSEMBLY-INVALID-NOT: Thread model:
diff --git a/clang/test/Driver/wasm32-unknown-unknown.cpp b/clang/test/Driver/wasm32-unknown-unknown.cpp
new file mode 100644
index 00000000000..e6fbb62a805
--- /dev/null
+++ b/clang/test/Driver/wasm32-unknown-unknown.cpp
@@ -0,0 +1,119 @@
+// RUN: %clang -target wasm32-unknown-unknown -### %s -emit-llvm-only -c 2>&1 \
+// RUN: | FileCheck %s -check-prefix=ECHO
+// RUN: %clang -target wasm32-unknown-unknown %s -emit-llvm -S -o - \
+// RUN: | FileCheck %s
+// RUN: %clang -target wasm32-unknown-unknown %s -emit-llvm -S -pthread -o - \
+// RUN: | FileCheck %s -check-prefix=THREADS
+
+// ECHO: {{.*}} "-cc1" {{.*}}wasm32-unknown-unknown.c
+
+typedef __builtin_va_list va_list;
+typedef __SIZE_TYPE__ size_t;
+typedef __PTRDIFF_TYPE__ ptrdiff_t;
+
+extern "C" {
+
+// CHECK: @align_c = global i32 1
+int align_c = __alignof(char);
+
+// CHECK: @align_s = global i32 2
+int align_s = __alignof(short);
+
+// CHECK: @align_i = global i32 4
+int align_i = __alignof(int);
+
+// CHECK: @align_l = global i32 4
+int align_l = __alignof(long);
+
+// CHECK: @align_ll = global i32 8
+int align_ll = __alignof(long long);
+
+// CHECK: @align_p = global i32 4
+int align_p = __alignof(void*);
+
+// CHECK: @align_f = global i32 4
+int align_f = __alignof(float);
+
+// CHECK: @align_d = global i32 8
+int align_d = __alignof(double);
+
+// CHECK: @align_ld = global i32 8
+int align_ld = __alignof(long double);
+
+// CHECK: @align_vl = global i32 4
+int align_vl = __alignof(va_list);
+
+// CHECK: _GNU_SOURCEdefined
+#ifdef _GNU_SOURCE
+void _GNU_SOURCEdefined() {}
+#endif
+
+// THREADS: _REENTRANTdefined
+// CHECK: _REENTRANTundefined
+#ifdef _REENTRANT
+void _REENTRANTdefined() {}
+#else
+void _REENTRANTundefined() {}
+#endif
+
+// Check types
+
+// CHECK: signext i8 @check_char()
+char check_char() { return 0; }
+
+// CHECK: signext i16 @check_short()
+short check_short() { return 0; }
+
+// CHECK: i32 @check_int()
+int check_int() { return 0; }
+
+// CHECK: i32 @check_long()
+long check_long() { return 0; }
+
+// CHECK: i64 @check_longlong()
+long long check_longlong() { return 0; }
+
+// CHECK: zeroext i8 @check_uchar()
+unsigned char check_uchar() { return 0; }
+
+// CHECK: zeroext i16 @check_ushort()
+unsigned short check_ushort() { return 0; }
+
+// CHECK: i32 @check_uint()
+unsigned int check_uint() { return 0; }
+
+// CHECK: i32 @check_ulong()
+unsigned long check_ulong() { return 0; }
+
+// CHECK: i64 @check_ulonglong()
+unsigned long long check_ulonglong() { return 0; }
+
+// CHECK: i32 @check_size_t()
+size_t check_size_t() { return 0; }
+
+// CHECK: float @check_float()
+float check_float() { return 0; }
+
+// CHECK: double @check_double()
+double check_double() { return 0; }
+
+// CHECK: double @check_longdouble()
+long double check_longdouble() { return 0; }
+
+}
+
+template<int> void Switch();
+template<> void Switch<4>();
+template<> void Switch<8>();
+template<> void Switch<16>();
+
+void check_pointer_size() {
+ // CHECK: SwitchILi4
+ Switch<sizeof(void*)>();
+
+ // CHECK: SwitchILi8
+ Switch<sizeof(long long)>();
+
+ // CHECK: SwitchILi4
+ Switch<sizeof(va_list)>();
+}
diff --git a/clang/test/Driver/wasm64-unknown-unknown.cpp b/clang/test/Driver/wasm64-unknown-unknown.cpp
new file mode 100644
index 00000000000..78b8c767188
--- /dev/null
+++ b/clang/test/Driver/wasm64-unknown-unknown.cpp
@@ -0,0 +1,119 @@
+// RUN: %clang -target wasm64-unknown-unknown -### %s -emit-llvm-only -c 2>&1 \
+// RUN: | FileCheck %s -check-prefix=ECHO
+// RUN: %clang -target wasm64-unknown-unknown %s -emit-llvm -S -o - \
+// RUN: | FileCheck %s
+// RUN: %clang -target wasm64-unknown-unknown %s -emit-llvm -S -pthread -o - \
+// RUN: | FileCheck %s -check-prefix=THREADS
+
+// ECHO: {{.*}} "-cc1" {{.*}}wasm64-unknown-unknown.c
+
+typedef __builtin_va_list va_list;
+typedef __SIZE_TYPE__ size_t;
+typedef __PTRDIFF_TYPE__ ptrdiff_t;
+
+extern "C" {
+
+// CHECK: @align_c = global i32 1
+int align_c = __alignof(char);
+
+// CHECK: @align_s = global i32 2
+int align_s = __alignof(short);
+
+// CHECK: @align_i = global i32 4
+int align_i = __alignof(int);
+
+// CHECK: @align_l = global i32 8
+int align_l = __alignof(long);
+
+// CHECK: @align_ll = global i32 8
+int align_ll = __alignof(long long);
+
+// CHECK: @align_p = global i32 8
+int align_p = __alignof(void*);
+
+// CHECK: @align_f = global i32 4
+int align_f = __alignof(float);
+
+// CHECK: @align_d = global i32 8
+int align_d = __alignof(double);
+
+// CHECK: @align_ld = global i32 8
+int align_ld = __alignof(long double);
+
+// CHECK: @align_vl = global i32 8
+int align_vl = __alignof(va_list);
+
+// CHECK: _GNU_SOURCEdefined
+#ifdef _GNU_SOURCE
+void _GNU_SOURCEdefined() {}
+#endif
+
+// THREADS: _REENTRANTdefined
+// CHECK: _REENTRANTundefined
+#ifdef _REENTRANT
+void _REENTRANTdefined() {}
+#else
+void _REENTRANTundefined() {}
+#endif
+
+// Check types
+
+// CHECK: signext i8 @check_char()
+char check_char() { return 0; }
+
+// CHECK: signext i16 @check_short()
+short check_short() { return 0; }
+
+// CHECK: i32 @check_int()
+int check_int() { return 0; }
+
+// CHECK: i64 @check_long()
+long check_long() { return 0; }
+
+// CHECK: i64 @check_longlong()
+long long check_longlong() { return 0; }
+
+// CHECK: zeroext i8 @check_uchar()
+unsigned char check_uchar() { return 0; }
+
+// CHECK: zeroext i16 @check_ushort()
+unsigned short check_ushort() { return 0; }
+
+// CHECK: i32 @check_uint()
+unsigned int check_uint() { return 0; }
+
+// CHECK: i64 @check_ulong()
+unsigned long check_ulong() { return 0; }
+
+// CHECK: i64 @check_ulonglong()
+unsigned long long check_ulonglong() { return 0; }
+
+// CHECK: i64 @check_size_t()
+size_t check_size_t() { return 0; }
+
+// CHECK: float @check_float()
+float check_float() { return 0; }
+
+// CHECK: double @check_double()
+double check_double() { return 0; }
+
+// CHECK: double @check_longdouble()
+long double check_longdouble() { return 0; }
+
+}
+
+template<int> void Switch();
+template<> void Switch<4>();
+template<> void Switch<8>();
+template<> void Switch<16>();
+
+void check_pointer_size() {
+ // CHECK: SwitchILi8
+ Switch<sizeof(void*)>();
+
+ // CHECK: SwitchILi8
+ Switch<sizeof(long long)>();
+
+ // CHECK: SwitchILi8
+ Switch<sizeof(va_list)>();
+}
diff --git a/clang/test/Preprocessor/init.c b/clang/test/Preprocessor/init.c
index 75230124a37..dcc2ef00470 100644
--- a/clang/test/Preprocessor/init.c
+++ b/clang/test/Preprocessor/init.c
@@ -8419,3 +8419,635 @@
// XCORE:#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
// XCORE:#define __LITTLE_ENDIAN__ 1
// XCORE:#define __XS1B__ 1
+//
+// RUN: %clang_cc1 -E -dM -ffreestanding -triple=wasm32-unknown-unknown \
+// RUN: < /dev/null \
+// RUN: | FileCheck -check-prefix=WEBASSEMBLY32 %s
+//
+// WEBASSEMBLY32:#define _ILP32 1{{$}}
+// WEBASSEMBLY32-NOT:#define _LP64
+// WEBASSEMBLY32-NEXT:#define __ATOMIC_ACQUIRE 2{{$}}
+// WEBASSEMBLY32-NEXT:#define __ATOMIC_ACQ_REL 4{{$}}
+// WEBASSEMBLY32-NEXT:#define __ATOMIC_CONSUME 1{{$}}
+// WEBASSEMBLY32-NEXT:#define __ATOMIC_RELAXED 0{{$}}
+// WEBASSEMBLY32-NEXT:#define __ATOMIC_RELEASE 3{{$}}
+// WEBASSEMBLY32-NEXT:#define __ATOMIC_SEQ_CST 5{{$}}
+// WEBASSEMBLY32-NEXT:#define __BIGGEST_ALIGNMENT__ 16{{$}}
+// WEBASSEMBLY32-NEXT:#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__{{$}}
+// WEBASSEMBLY32-NEXT:#define __CHAR16_TYPE__ unsigned short{{$}}
+// WEBASSEMBLY32-NEXT:#define __CHAR32_TYPE__ unsigned int{{$}}
+// WEBASSEMBLY32-NEXT:#define __CHAR_BIT__ 8{{$}}
+// WEBASSEMBLY32-NOT:#define __CHAR_UNSIGNED__
+// WEBASSEMBLY32-NEXT:#define __CONSTANT_CFSTRINGS__ 1{{$}}
+// WEBASSEMBLY32-NEXT:#define __DBL_DECIMAL_DIG__ 17{{$}}
+// WEBASSEMBLY32-NEXT:#define __DBL_DENORM_MIN__ 4.9406564584124654e-324{{$}}
+// WEBASSEMBLY32-NEXT:#define __DBL_DIG__ 15{{$}}
+// WEBASSEMBLY32-NEXT:#define __DBL_EPSILON__ 2.2204460492503131e-16{{$}}
+// WEBASSEMBLY32-NEXT:#define __DBL_HAS_DENORM__ 1{{$}}
+// WEBASSEMBLY32-NEXT:#define __DBL_HAS_INFINITY__ 1{{$}}
+// WEBASSEMBLY32-NEXT:#define __DBL_HAS_QUIET_NAN__ 1{{$}}
+// WEBASSEMBLY32-NEXT:#define __DBL_MANT_DIG__ 53{{$}}
+// WEBASSEMBLY32-NEXT:#define __DBL_MAX_10_EXP__ 308{{$}}
+// WEBASSEMBLY32-NEXT:#define __DBL_MAX_EXP__ 1024{{$}}
+// WEBASSEMBLY32-NEXT:#define __DBL_MAX__ 1.7976931348623157e+308{{$}}
+// WEBASSEMBLY32-NEXT:#define __DBL_MIN_10_EXP__ (-307){{$}}
+// WEBASSEMBLY32-NEXT:#define __DBL_MIN_EXP__ (-1021){{$}}
+// WEBASSEMBLY32-NEXT:#define __DBL_MIN__ 2.2250738585072014e-308{{$}}
+// WEBASSEMBLY32-NEXT:#define __DECIMAL_DIG__ __LDBL_DECIMAL_DIG__{{$}}
+// WEBASSEMBLY32-NOT:#define __ELF__
+// WEBASSEMBLY32-NEXT:#define __FINITE_MATH_ONLY__ 0{{$}}
+// WEBASSEMBLY32-NEXT:#define __FLT_DECIMAL_DIG__ 9{{$}}
+// WEBASSEMBLY32-NEXT:#define __FLT_DENORM_MIN__ 1.40129846e-45F{{$}}
+// WEBASSEMBLY32-NEXT:#define __FLT_DIG__ 6{{$}}
+// WEBASSEMBLY32-NEXT:#define __FLT_EPSILON__ 1.19209290e-7F{{$}}
+// WEBASSEMBLY32-NEXT:#define __FLT_EVAL_METHOD__ 0{{$}}
+// WEBASSEMBLY32-NEXT:#define __FLT_HAS_DENORM__ 1{{$}}
+// WEBASSEMBLY32-NEXT:#define __FLT_HAS_INFINITY__ 1{{$}}
+// WEBASSEMBLY32-NEXT:#define __FLT_HAS_QUIET_NAN__ 1{{$}}
+// WEBASSEMBLY32-NEXT:#define __FLT_MANT_DIG__ 24{{$}}
+// WEBASSEMBLY32-NEXT:#define __FLT_MAX_10_EXP__ 38{{$}}
+// WEBASSEMBLY32-NEXT:#define __FLT_MAX_EXP__ 128{{$}}
+// WEBASSEMBLY32-NEXT:#define __FLT_MAX__ 3.40282347e+38F{{$}}
+// WEBASSEMBLY32-NEXT:#define __FLT_MIN_10_EXP__ (-37){{$}}
+// WEBASSEMBLY32-NEXT:#define __FLT_MIN_EXP__ (-125){{$}}
+// WEBASSEMBLY32-NEXT:#define __FLT_MIN__ 1.17549435e-38F{{$}}
+// WEBASSEMBLY32-NEXT:#define __FLT_RADIX__ 2{{$}}
+// WEBASSEMBLY32-NEXT:#define __GCC_ATOMIC_BOOL_LOCK_FREE 1{{$}}
+// WEBASSEMBLY32-NEXT:#define __GCC_ATOMIC_CHAR16_T_LOCK_FREE 1{{$}}
+// WEBASSEMBLY32-NEXT:#define __GCC_ATOMIC_CHAR32_T_LOCK_FREE 1{{$}}
+// WEBASSEMBLY32-NEXT:#define __GCC_ATOMIC_CHAR_LOCK_FREE 1{{$}}
+// WEBASSEMBLY32-NEXT:#define __GCC_ATOMIC_INT_LOCK_FREE 1{{$}}
+// WEBASSEMBLY32-NEXT:#define __GCC_ATOMIC_LLONG_LOCK_FREE 1{{$}}
+// WEBASSEMBLY32-NEXT:#define __GCC_ATOMIC_LONG_LOCK_FREE 1{{$}}
+// WEBASSEMBLY32-NEXT:#define __GCC_ATOMIC_POINTER_LOCK_FREE 1{{$}}
+// WEBASSEMBLY32-NEXT:#define __GCC_ATOMIC_SHORT_LOCK_FREE 1{{$}}
+// WEBASSEMBLY32-NEXT:#define __GCC_ATOMIC_TEST_AND_SET_TRUEVAL 1{{$}}
+// WEBASSEMBLY32-NEXT:#define __GCC_ATOMIC_WCHAR_T_LOCK_FREE 1{{$}}
+// WEBASSEMBLY32-NEXT:#define __GNUC_MINOR__ {{.}}
+// WEBASSEMBLY32-NEXT:#define __GNUC_PATCHLEVEL__ {{.}}
+// WEBASSEMBLY32-NEXT:#define __GNUC_STDC_INLINE__ 1{{$}}
+// WEBASSEMBLY32-NEXT:#define __GNUC__ {{.}}
+// WEBASSEMBLY32-NEXT:#define __GXX_ABI_VERSION 1002{{$}}
+// WEBASSEMBLY32-NEXT:#define __GXX_RTTI 1{{$}}
+// WEBASSEMBLY32-NEXT:#define __ILP32__ 1{{$}}
+// WEBASSEMBLY32-NEXT:#define __INT16_C_SUFFIX__ {{$}}
+// WEBASSEMBLY32-NEXT:#define __INT16_FMTd__ "hd"{{$}}
+// WEBASSEMBLY32-NEXT:#define __INT16_FMTi__ "hi"{{$}}
+// WEBASSEMBLY32-NEXT:#define __INT16_MAX__ 32767{{$}}
+// WEBASSEMBLY32-NEXT:#define __INT16_TYPE__ short{{$}}
+// WEBASSEMBLY32-NEXT:#define __INT32_C_SUFFIX__ {{$}}
+// WEBASSEMBLY32-NEXT:#define __INT32_FMTd__ "d"{{$}}
+// WEBASSEMBLY32-NEXT:#define __INT32_FMTi__ "i"{{$}}
+// WEBASSEMBLY32-NEXT:#define __INT32_MAX__ 2147483647{{$}}
+// WEBASSEMBLY32-NEXT:#define __INT32_TYPE__ int{{$}}
+// WEBASSEMBLY32-NEXT:#define __INT64_C_SUFFIX__ LL{{$}}
+// WEBASSEMBLY32-NEXT:#define __INT64_FMTd__ "lld"{{$}}
+// WEBASSEMBLY32-NEXT:#define __INT64_FMTi__ "lli"{{$}}
+// WEBASSEMBLY32-NEXT:#define __INT64_MAX__ 9223372036854775807LL{{$}}
+// WEBASSEMBLY32-NEXT:#define __INT64_TYPE__ long long int{{$}}
+// WEBASSEMBLY32-NEXT:#define __INT8_C_SUFFIX__ {{$}}
+// WEBASSEMBLY32-NEXT:#define __INT8_FMTd__ "hhd"{{$}}
+// WEBASSEMBLY32-NEXT:#define __INT8_FMTi__ "hhi"{{$}}
+// WEBASSEMBLY32-NEXT:#define __INT8_MAX__ 127{{$}}
+// WEBASSEMBLY32-NEXT:#define __INT8_TYPE__ signed char{{$}}
+// WEBASSEMBLY32-NEXT:#define __INTMAX_C_SUFFIX__ LL{{$}}
+// WEBASSEMBLY32-NEXT:#define __INTMAX_FMTd__ "lld"{{$}}
+// WEBASSEMBLY32-NEXT:#define __INTMAX_FMTi__ "lli"{{$}}
+// WEBASSEMBLY32-NEXT:#define __INTMAX_MAX__ 9223372036854775807LL{{$}}
+// WEBASSEMBLY32-NEXT:#define __INTMAX_TYPE__ long long int{{$}}
+// WEBASSEMBLY32-NEXT:#define __INTMAX_WIDTH__ 64{{$}}
+// WEBASSEMBLY32-NEXT:#define __INTPTR_FMTd__ "ld"{{$}}
+// WEBASSEMBLY32-NEXT:#define __INTPTR_FMTi__ "li"{{$}}
+// WEBASSEMBLY32-NEXT:#define __INTPTR_MAX__ 2147483647L{{$}}
+// WEBASSEMBLY32-NEXT:#define __INTPTR_TYPE__ long int{{$}}
+// WEBASSEMBLY32-NEXT:#define __INTPTR_WIDTH__ 32{{$}}
+// WEBASSEMBLY32-NEXT:#define __INT_FAST16_FMTd__ "hd"{{$}}
+// WEBASSEMBLY32-NEXT:#define __INT_FAST16_FMTi__ "hi"{{$}}
+// WEBASSEMBLY32-NEXT:#define __INT_FAST16_MAX__ 32767{{$}}
+// WEBASSEMBLY32-NEXT:#define __INT_FAST16_TYPE__ short{{$}}
+// WEBASSEMBLY32-NEXT:#define __INT_FAST32_FMTd__ "d"{{$}}
+// WEBASSEMBLY32-NEXT:#define __INT_FAST32_FMTi__ "i"{{$}}
+// WEBASSEMBLY32-NEXT:#define __INT_FAST32_MAX__ 2147483647{{$}}
+// WEBASSEMBLY32-NEXT:#define __INT_FAST32_TYPE__ int{{$}}
+// WEBASSEMBLY32-NEXT:#define __INT_FAST64_FMTd__ "lld"{{$}}
+// WEBASSEMBLY32-NEXT:#define __INT_FAST64_FMTi__ "lli"{{$}}
+// WEBASSEMBLY32-NEXT:#define __INT_FAST64_MAX__ 9223372036854775807LL{{$}}
+// WEBASSEMBLY32-NEXT:#define __INT_FAST64_TYPE__ long long int{{$}}
+// WEBASSEMBLY32-NEXT:#define __INT_FAST8_FMTd__ "hhd"{{$}}
+// WEBASSEMBLY32-NEXT:#define __INT_FAST8_FMTi__ "hhi"{{$}}
+// WEBASSEMBLY32-NEXT:#define __INT_FAST8_MAX__ 127{{$}}
+// WEBASSEMBLY32-NEXT:#define __INT_FAST8_TYPE__ signed char{{$}}
+// WEBASSEMBLY32-NEXT:#define __INT_LEAST16_FMTd__ "hd"{{$}}
+// WEBASSEMBLY32-NEXT:#define __INT_LEAST16_FMTi__ "hi"{{$}}
+// WEBASSEMBLY32-NEXT:#define __INT_LEAST16_MAX__ 32767{{$}}
+// WEBASSEMBLY32-NEXT:#define __INT_LEAST16_TYPE__ short{{$}}
+// WEBASSEMBLY32-NEXT:#define __INT_LEAST32_FMTd__ "d"{{$}}
+// WEBASSEMBLY32-NEXT:#define __INT_LEAST32_FMTi__ "i"{{$}}
+// WEBASSEMBLY32-NEXT:#define __INT_LEAST32_MAX__ 2147483647{{$}}
+// WEBASSEMBLY32-NEXT:#define __INT_LEAST32_TYPE__ int{{$}}
+// WEBASSEMBLY32-NEXT:#define __INT_LEAST64_FMTd__ "lld"{{$}}
+// WEBASSEMBLY32-NEXT:#define __INT_LEAST64_FMTi__ "lli"{{$}}
+// WEBASSEMBLY32-NEXT:#define __INT_LEAST64_MAX__ 9223372036854775807LL{{$}}
+// WEBASSEMBLY32-NEXT:#define __INT_LEAST64_TYPE__ long long int{{$}}
+// WEBASSEMBLY32-NEXT:#define __INT_LEAST8_FMTd__ "hhd"{{$}}
+// WEBASSEMBLY32-NEXT:#define __INT_LEAST8_FMTi__ "hhi"{{$}}
+// WEBASSEMBLY32-NEXT:#define __INT_LEAST8_MAX__ 127{{$}}
+// WEBASSEMBLY32-NEXT:#define __INT_LEAST8_TYPE__ signed char{{$}}
+// WEBASSEMBLY32-NEXT:#define __INT_MAX__ 2147483647{{$}}
+// WEBASSEMBLY32-NEXT:#define __LDBL_DECIMAL_DIG__ 17{{$}}
+// WEBASSEMBLY32-NEXT:#define __LDBL_DENORM_MIN__ 4.9406564584124654e-324L{{$}}
+// WEBASSEMBLY32-NEXT:#define __LDBL_DIG__ 15{{$}}
+// WEBASSEMBLY32-NEXT:#define __LDBL_EPSILON__ 2.2204460492503131e-16L{{$}}
+// WEBASSEMBLY32-NEXT:#define __LDBL_HAS_DENORM__ 1{{$}}
+// WEBASSEMBLY32-NEXT:#define __LDBL_HAS_INFINITY__ 1{{$}}
+// WEBASSEMBLY32-NEXT:#define __LDBL_HAS_QUIET_NAN__ 1{{$}}
+// WEBASSEMBLY32-NEXT:#define __LDBL_MANT_DIG__ 53{{$}}
+// WEBASSEMBLY32-NEXT:#define __LDBL_MAX_10_EXP__ 308{{$}}
+// WEBASSEMBLY32-NEXT:#define __LDBL_MAX_EXP__ 1024{{$}}
+// WEBASSEMBLY32-NEXT:#define __LDBL_MAX__ 1.7976931348623157e+308L{{$}}
+// WEBASSEMBLY32-NEXT:#define __LDBL_MIN_10_EXP__ (-307){{$}}
+// WEBASSEMBLY32-NEXT:#define __LDBL_MIN_EXP__ (-1021){{$}}
+// WEBASSEMBLY32-NEXT:#define __LDBL_MIN__ 2.2250738585072014e-308L{{$}}
+// WEBASSEMBLY32-NEXT:#define __LITTLE_ENDIAN__ 1{{$}}
+// WEBASSEMBLY32-NEXT:#define __LONG_LONG_MAX__ 9223372036854775807LL{{$}}
+// WEBASSEMBLY32-NEXT:#define __LONG_MAX__ 2147483647L{{$}}
+// WEBASSEMBLY32-NOT:#define __LP64__
+// WEBASSEMBLY32-NEXT:#define __NO_INLINE__ 1{{$}}
+// WEBASSEMBLY32-NEXT:#define __ORDER_BIG_ENDIAN__ 4321{{$}}
+// WEBASSEMBLY32-NEXT:#define __ORDER_LITTLE_ENDIAN__ 1234{{$}}
+// WEBASSEMBLY32-NEXT:#define __ORDER_PDP_ENDIAN__ 3412{{$}}
+// WEBASSEMBLY32-NEXT:#define __POINTER_WIDTH__ 32{{$}}
+// WEBASSEMBLY32-NEXT:#define __PRAGMA_REDEFINE_EXTNAME 1{{$}}
+// WEBASSEMBLY32-NEXT:#define __PTRDIFF_FMTd__ "ld"{{$}}
+// WEBASSEMBLY32-NEXT:#define __PTRDIFF_FMTi__ "li"{{$}}
+// WEBASSEMBLY32-NEXT:#define __PTRDIFF_MAX__ 2147483647L{{$}}
+// WEBASSEMBLY32-NEXT:#define __PTRDIFF_TYPE__ long int{{$}}
+// WEBASSEMBLY32-NEXT:#define __PTRDIFF_WIDTH__ 32{{$}}
+// WEBASSEMBLY32-NOT:#define __REGISTER_PREFIX__
+// WEBASSEMBLY32-NEXT:#define __SCHAR_MAX__ 127{{$}}
+// WEBASSEMBLY32-NEXT:#define __SHRT_MAX__ 32767{{$}}
+// WEBASSEMBLY32-NEXT:#define __SIG_ATOMIC_MAX__ 2147483647{{$}}
+// WEBASSEMBLY32-NEXT:#define __SIG_ATOMIC_WIDTH__ 32{{$}}
+// WEBASSEMBLY32-NEXT:#define __SIZEOF_DOUBLE__ 8{{$}}
+// WEBASSEMBLY32-NEXT:#define __SIZEOF_FLOAT__ 4{{$}}
+// WEBASSEMBLY32-NEXT:#define __SIZEOF_INT128__ 16{{$}}
+// WEBASSEMBLY32-NEXT:#define __SIZEOF_INT__ 4{{$}}
+// WEBASSEMBLY32-NEXT:#define __SIZEOF_LONG_DOUBLE__ 8{{$}}
+// WEBASSEMBLY32-NEXT:#define __SIZEOF_LONG_LONG__ 8{{$}}
+// WEBASSEMBLY32-NEXT:#define __SIZEOF_LONG__ 4{{$}}
+// WEBASSEMBLY32-NEXT:#define __SIZEOF_POINTER__ 4{{$}}
+// WEBASSEMBLY32-NEXT:#define __SIZEOF_PTRDIFF_T__ 4{{$}}
+// WEBASSEMBLY32-NEXT:#define __SIZEOF_SHORT__ 2{{$}}
+// WEBASSEMBLY32-NEXT:#define __SIZEOF_SIZE_T__ 4{{$}}
+// WEBASSEMBLY32-NEXT:#define __SIZEOF_WCHAR_T__ 4{{$}}
+// WEBASSEMBLY32-NEXT:#define __SIZEOF_WINT_T__ 4{{$}}
+// WEBASSEMBLY32-NEXT:#define __SIZE_FMTX__ "lX"{{$}}
+// WEBASSEMBLY32-NEXT:#define __SIZE_FMTo__ "lo"{{$}}
+// WEBASSEMBLY32-NEXT:#define __SIZE_FMTu__ "lu"{{$}}
+// WEBASSEMBLY32-NEXT:#define __SIZE_FMTx__ "lx"{{$}}
+// WEBASSEMBLY32-NEXT:#define __SIZE_MAX__ 4294967295UL{{$}}
+// WEBASSEMBLY32-NEXT:#define __SIZE_TYPE__ long unsigned int{{$}}
+// WEBASSEMBLY32-NEXT:#define __SIZE_WIDTH__ 32{{$}}
+// WEBASSEMBLY32-NEXT:#define __STDC_HOSTED__ 0{{$}}
+// WEBASSEMBLY32-NOT:#define __STDC_MB_MIGHT_NEQ_WC__
+// WEBASSEMBLY32-NOT:#define __STDC_NO_ATOMICS__
+// WEBASSEMBLY32-NOT:#define __STDC_NO_COMPLEX__
+// WEBASSEMBLY32-NOT:#define __STDC_NO_VLA__
+// WEBASSEMBLY32-NOT:#define __STDC_NO_THREADS__
+// WEBASSEMBLY32-NEXT:#define __STDC_UTF_16__ 1{{$}}
+// WEBASSEMBLY32-NEXT:#define __STDC_UTF_32__ 1{{$}}
+// WEBASSEMBLY32-NEXT:#define __STDC_VERSION__ 201112L{{$}}
+// WEBASSEMBLY32-NEXT:#define __STDC__ 1{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT16_C_SUFFIX__ {{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT16_FMTX__ "hX"{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT16_FMTo__ "ho"{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT16_FMTu__ "hu"{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT16_FMTx__ "hx"{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT16_MAX__ 65535{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT16_TYPE__ unsigned short{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT32_C_SUFFIX__ U{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT32_FMTX__ "X"{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT32_FMTo__ "o"{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT32_FMTu__ "u"{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT32_FMTx__ "x"{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT32_MAX__ 4294967295U{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT32_TYPE__ unsigned int{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT64_C_SUFFIX__ ULL{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT64_FMTX__ "llX"{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT64_FMTo__ "llo"{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT64_FMTu__ "llu"{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT64_FMTx__ "llx"{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT64_MAX__ 18446744073709551615ULL{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT64_TYPE__ long long unsigned int{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT8_C_SUFFIX__ {{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT8_FMTX__ "hhX"{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT8_FMTo__ "hho"{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT8_FMTu__ "hhu"{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT8_FMTx__ "hhx"{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT8_MAX__ 255{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT8_TYPE__ unsigned char{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINTMAX_C_SUFFIX__ ULL{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINTMAX_FMTX__ "llX"{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINTMAX_FMTo__ "llo"{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINTMAX_FMTu__ "llu"{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINTMAX_FMTx__ "llx"{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINTMAX_MAX__ 18446744073709551615ULL{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINTMAX_TYPE__ long long unsigned int{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINTMAX_WIDTH__ 64{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINTPTR_FMTX__ "lX"{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINTPTR_FMTo__ "lo"{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINTPTR_FMTu__ "lu"{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINTPTR_FMTx__ "lx"{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINTPTR_MAX__ 4294967295UL{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINTPTR_TYPE__ long unsigned int{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINTPTR_WIDTH__ 32{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT_FAST16_FMTX__ "hX"{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT_FAST16_FMTo__ "ho"{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT_FAST16_FMTu__ "hu"{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT_FAST16_FMTx__ "hx"{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT_FAST16_MAX__ 65535{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT_FAST16_TYPE__ unsigned short{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT_FAST32_FMTX__ "X"{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT_FAST32_FMTo__ "o"{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT_FAST32_FMTu__ "u"{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT_FAST32_FMTx__ "x"{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT_FAST32_MAX__ 4294967295U{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT_FAST32_TYPE__ unsigned int{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT_FAST64_FMTX__ "llX"{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT_FAST64_FMTo__ "llo"{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT_FAST64_FMTu__ "llu"{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT_FAST64_FMTx__ "llx"{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT_FAST64_MAX__ 18446744073709551615ULL{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT_FAST64_TYPE__ long long unsigned int{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT_FAST8_FMTX__ "hhX"{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT_FAST8_FMTo__ "hho"{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT_FAST8_FMTu__ "hhu"{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT_FAST8_FMTx__ "hhx"{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT_FAST8_MAX__ 255{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT_FAST8_TYPE__ unsigned char{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT_LEAST16_FMTX__ "hX"{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT_LEAST16_FMTo__ "ho"{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT_LEAST16_FMTu__ "hu"{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT_LEAST16_FMTx__ "hx"{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT_LEAST16_MAX__ 65535{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT_LEAST16_TYPE__ unsigned short{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT_LEAST32_FMTX__ "X"{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT_LEAST32_FMTo__ "o"{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT_LEAST32_FMTu__ "u"{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT_LEAST32_FMTx__ "x"{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT_LEAST32_MAX__ 4294967295U{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT_LEAST32_TYPE__ unsigned int{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT_LEAST64_FMTX__ "llX"{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT_LEAST64_FMTo__ "llo"{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT_LEAST64_FMTu__ "llu"{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT_LEAST64_FMTx__ "llx"{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT_LEAST64_MAX__ 18446744073709551615ULL{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT_LEAST64_TYPE__ long long unsigned int{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT_LEAST8_FMTX__ "hhX"{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT_LEAST8_FMTo__ "hho"{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT_LEAST8_FMTu__ "hhu"{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT_LEAST8_FMTx__ "hhx"{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT_LEAST8_MAX__ 255{{$}}
+// WEBASSEMBLY32-NEXT:#define __UINT_LEAST8_TYPE__ unsigned char{{$}}
+// WEBASSEMBLY32-NEXT:#define __USER_LABEL_PREFIX__ {{$}}
+// WEBASSEMBLY32-NEXT:#define __VERSION__ "{{.*}}"{{$}}
+// WEBASSEMBLY32-NEXT:#define __WCHAR_MAX__ 2147483647{{$}}
+// WEBASSEMBLY32-NEXT:#define __WCHAR_TYPE__ int{{$}}
+// WEBASSEMBLY32-NOT:#define __WCHAR_UNSIGNED__
+// WEBASSEMBLY32-NEXT:#define __WCHAR_WIDTH__ 32{{$}}
+// WEBASSEMBLY32-NEXT:#define __WINT_TYPE__ int{{$}}
+// WEBASSEMBLY32-NOT:#define __WINT_UNSIGNED__
+// WEBASSEMBLY32-NEXT:#define __WINT_WIDTH__ 32{{$}}
+// WEBASSEMBLY32-NEXT:#define __clang__ 1{{$}}
+// WEBASSEMBLY32-NEXT:#define __clang_major__ {{.}}
+// WEBASSEMBLY32-NEXT:#define __clang_minor__ {{.}}
+// WEBASSEMBLY32-NEXT:#define __clang_patchlevel__ {{.}}
+// WEBASSEMBLY32-NEXT:#define __clang_version__ "{{.*}}"{{$}}
+// WEBASSEMBLY32-NEXT:#define __llvm__ 1{{$}}
+// WEBASSEMBLY32-NOT:#define __wasm_simd128__
+// WEBASSEMBLY32-NOT:#define __wasm_simd256__
+// WEBASSEMBLY32-NOT:#define __wasm_simd512__
+// WEBASSEMBLY32-NOT:#define __unix
+// WEBASSEMBLY32-NOT:#define __unix__
+// WEBASSEMBLY32-NEXT:#define __wasm 1{{$}}
+// WEBASSEMBLY32-NEXT:#define __wasm32 1{{$}}
+// WEBASSEMBLY32-NEXT:#define __wasm32__ 1{{$}}
+// WEBASSEMBLY32-NOT:#define __wasm64
+// WEBASSEMBLY32-NOT:#define __wasm64__
+// WEBASSEMBLY32-NEXT:#define __wasm__ 1{{$}}
+//
+// RUN: %clang_cc1 -E -dM -ffreestanding -triple=wasm64-unknown-unknown \
+// RUN: < /dev/null \
+// RUN: | FileCheck -check-prefix=WEBASSEMBLY64 %s
+//
+// WEBASSEMBLY64-NOT:#define _ILP32
+// WEBASSEMBLY64:#define _LP64 1{{$}}
+// WEBASSEMBLY64-NEXT:#define __ATOMIC_ACQUIRE 2{{$}}
+// WEBASSEMBLY64-NEXT:#define __ATOMIC_ACQ_REL 4{{$}}
+// WEBASSEMBLY64-NEXT:#define __ATOMIC_CONSUME 1{{$}}
+// WEBASSEMBLY64-NEXT:#define __ATOMIC_RELAXED 0{{$}}
+// WEBASSEMBLY64-NEXT:#define __ATOMIC_RELEASE 3{{$}}
+// WEBASSEMBLY64-NEXT:#define __ATOMIC_SEQ_CST 5{{$}}
+// WEBASSEMBLY64-NEXT:#define __BIGGEST_ALIGNMENT__ 16{{$}}
+// WEBASSEMBLY64-NEXT:#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__{{$}}
+// WEBASSEMBLY64-NEXT:#define __CHAR16_TYPE__ unsigned short{{$}}
+// WEBASSEMBLY64-NEXT:#define __CHAR32_TYPE__ unsigned int{{$}}
+// WEBASSEMBLY64-NEXT:#define __CHAR_BIT__ 8{{$}}
+// WEBASSEMBLY64-NOT:#define __CHAR_UNSIGNED__
+// WEBASSEMBLY64-NEXT:#define __CONSTANT_CFSTRINGS__ 1{{$}}
+// WEBASSEMBLY64-NEXT:#define __DBL_DECIMAL_DIG__ 17{{$}}
+// WEBASSEMBLY64-NEXT:#define __DBL_DENORM_MIN__ 4.9406564584124654e-324{{$}}
+// WEBASSEMBLY64-NEXT:#define __DBL_DIG__ 15{{$}}
+// WEBASSEMBLY64-NEXT:#define __DBL_EPSILON__ 2.2204460492503131e-16{{$}}
+// WEBASSEMBLY64-NEXT:#define __DBL_HAS_DENORM__ 1{{$}}
+// WEBASSEMBLY64-NEXT:#define __DBL_HAS_INFINITY__ 1{{$}}
+// WEBASSEMBLY64-NEXT:#define __DBL_HAS_QUIET_NAN__ 1{{$}}
+// WEBASSEMBLY64-NEXT:#define __DBL_MANT_DIG__ 53{{$}}
+// WEBASSEMBLY64-NEXT:#define __DBL_MAX_10_EXP__ 308{{$}}
+// WEBASSEMBLY64-NEXT:#define __DBL_MAX_EXP__ 1024{{$}}
+// WEBASSEMBLY64-NEXT:#define __DBL_MAX__ 1.7976931348623157e+308{{$}}
+// WEBASSEMBLY64-NEXT:#define __DBL_MIN_10_EXP__ (-307){{$}}
+// WEBASSEMBLY64-NEXT:#define __DBL_MIN_EXP__ (-1021){{$}}
+// WEBASSEMBLY64-NEXT:#define __DBL_MIN__ 2.2250738585072014e-308{{$}}
+// WEBASSEMBLY64-NEXT:#define __DECIMAL_DIG__ __LDBL_DECIMAL_DIG__{{$}}
+// WEBASSEMBLY64-NOT:#define __ELF__
+// WEBASSEMBLY64-NEXT:#define __FINITE_MATH_ONLY__ 0{{$}}
+// WEBASSEMBLY64-NEXT:#define __FLT_DECIMAL_DIG__ 9{{$}}
+// WEBASSEMBLY64-NEXT:#define __FLT_DENORM_MIN__ 1.40129846e-45F{{$}}
+// WEBASSEMBLY64-NEXT:#define __FLT_DIG__ 6{{$}}
+// WEBASSEMBLY64-NEXT:#define __FLT_EPSILON__ 1.19209290e-7F{{$}}
+// WEBASSEMBLY64-NEXT:#define __FLT_EVAL_METHOD__ 0{{$}}
+// WEBASSEMBLY64-NEXT:#define __FLT_HAS_DENORM__ 1{{$}}
+// WEBASSEMBLY64-NEXT:#define __FLT_HAS_INFINITY__ 1{{$}}
+// WEBASSEMBLY64-NEXT:#define __FLT_HAS_QUIET_NAN__ 1{{$}}
+// WEBASSEMBLY64-NEXT:#define __FLT_MANT_DIG__ 24{{$}}
+// WEBASSEMBLY64-NEXT:#define __FLT_MAX_10_EXP__ 38{{$}}
+// WEBASSEMBLY64-NEXT:#define __FLT_MAX_EXP__ 128{{$}}
+// WEBASSEMBLY64-NEXT:#define __FLT_MAX__ 3.40282347e+38F{{$}}
+// WEBASSEMBLY64-NEXT:#define __FLT_MIN_10_EXP__ (-37){{$}}
+// WEBASSEMBLY64-NEXT:#define __FLT_MIN_EXP__ (-125){{$}}
+// WEBASSEMBLY64-NEXT:#define __FLT_MIN__ 1.17549435e-38F{{$}}
+// WEBASSEMBLY64-NEXT:#define __FLT_RADIX__ 2{{$}}
+// WEBASSEMBLY64-NEXT:#define __GCC_ATOMIC_BOOL_LOCK_FREE 1{{$}}
+// WEBASSEMBLY64-NEXT:#define __GCC_ATOMIC_CHAR16_T_LOCK_FREE 1{{$}}
+// WEBASSEMBLY64-NEXT:#define __GCC_ATOMIC_CHAR32_T_LOCK_FREE 1{{$}}
+// WEBASSEMBLY64-NEXT:#define __GCC_ATOMIC_CHAR_LOCK_FREE 1{{$}}
+// WEBASSEMBLY64-NEXT:#define __GCC_ATOMIC_INT_LOCK_FREE 1{{$}}
+// WEBASSEMBLY64-NEXT:#define __GCC_ATOMIC_LLONG_LOCK_FREE 1{{$}}
+// WEBASSEMBLY64-NEXT:#define __GCC_ATOMIC_LONG_LOCK_FREE 1{{$}}
+// WEBASSEMBLY64-NEXT:#define __GCC_ATOMIC_POINTER_LOCK_FREE 1{{$}}
+// WEBASSEMBLY64-NEXT:#define __GCC_ATOMIC_SHORT_LOCK_FREE 1{{$}}
+// WEBASSEMBLY64-NEXT:#define __GCC_ATOMIC_TEST_AND_SET_TRUEVAL 1{{$}}
+// WEBASSEMBLY64-NEXT:#define __GCC_ATOMIC_WCHAR_T_LOCK_FREE 1{{$}}
+// WEBASSEMBLY64-NEXT:#define __GNUC_MINOR__ {{.}}
+// WEBASSEMBLY64-NEXT:#define __GNUC_PATCHLEVEL__ {{.}}
+// WEBASSEMBLY64-NEXT:#define __GNUC_STDC_INLINE__ 1{{$}}
+// WEBASSEMBLY64-NEXT:#define __GNUC__ {{.}}
+// WEBASSEMBLY64-NEXT:#define __GXX_ABI_VERSION 1002{{$}}
+// WEBASSEMBLY64-NEXT:#define __GXX_RTTI 1{{$}}
+// WEBASSEMBLY64-NOT:#define __ILP32__
+// WEBASSEMBLY64-NEXT:#define __INT16_C_SUFFIX__ {{$}}
+// WEBASSEMBLY64-NEXT:#define __INT16_FMTd__ "hd"{{$}}
+// WEBASSEMBLY64-NEXT:#define __INT16_FMTi__ "hi"{{$}}
+// WEBASSEMBLY64-NEXT:#define __INT16_MAX__ 32767{{$}}
+// WEBASSEMBLY64-NEXT:#define __INT16_TYPE__ short{{$}}
+// WEBASSEMBLY64-NEXT:#define __INT32_C_SUFFIX__ {{$}}
+// WEBASSEMBLY64-NEXT:#define __INT32_FMTd__ "d"{{$}}
+// WEBASSEMBLY64-NEXT:#define __INT32_FMTi__ "i"{{$}}
+// WEBASSEMBLY64-NEXT:#define __INT32_MAX__ 2147483647{{$}}
+// WEBASSEMBLY64-NEXT:#define __INT32_TYPE__ int{{$}}
+// WEBASSEMBLY64-NEXT:#define __INT64_C_SUFFIX__ LL{{$}}
+// WEBASSEMBLY64-NEXT:#define __INT64_FMTd__ "lld"{{$}}
+// WEBASSEMBLY64-NEXT:#define __INT64_FMTi__ "lli"{{$}}
+// WEBASSEMBLY64-NEXT:#define __INT64_MAX__ 9223372036854775807LL{{$}}
+// WEBASSEMBLY64-NEXT:#define __INT64_TYPE__ long long int{{$}}
+// WEBASSEMBLY64-NEXT:#define __INT8_C_SUFFIX__ {{$}}
+// WEBASSEMBLY64-NEXT:#define __INT8_FMTd__ "hhd"{{$}}
+// WEBASSEMBLY64-NEXT:#define __INT8_FMTi__ "hhi"{{$}}
+// WEBASSEMBLY64-NEXT:#define __INT8_MAX__ 127{{$}}
+// WEBASSEMBLY64-NEXT:#define __INT8_TYPE__ signed char{{$}}
+// WEBASSEMBLY64-NEXT:#define __INTMAX_C_SUFFIX__ LL{{$}}
+// WEBASSEMBLY64-NEXT:#define __INTMAX_FMTd__ "lld"{{$}}
+// WEBASSEMBLY64-NEXT:#define __INTMAX_FMTi__ "lli"{{$}}
+// WEBASSEMBLY64-NEXT:#define __INTMAX_MAX__ 9223372036854775807LL{{$}}
+// WEBASSEMBLY64-NEXT:#define __INTMAX_TYPE__ long long int{{$}}
+// WEBASSEMBLY64-NEXT:#define __INTMAX_WIDTH__ 64{{$}}
+// WEBASSEMBLY64-NEXT:#define __INTPTR_FMTd__ "ld"{{$}}
+// WEBASSEMBLY64-NEXT:#define __INTPTR_FMTi__ "li"{{$}}
+// WEBASSEMBLY64-NEXT:#define __INTPTR_MAX__ 9223372036854775807L{{$}}
+// WEBASSEMBLY64-NEXT:#define __INTPTR_TYPE__ long int{{$}}
+// WEBASSEMBLY64-NEXT:#define __INTPTR_WIDTH__ 64{{$}}
+// WEBASSEMBLY64-NEXT:#define __INT_FAST16_FMTd__ "hd"{{$}}
+// WEBASSEMBLY64-NEXT:#define __INT_FAST16_FMTi__ "hi"{{$}}
+// WEBASSEMBLY64-NEXT:#define __INT_FAST16_MAX__ 32767{{$}}
+// WEBASSEMBLY64-NEXT:#define __INT_FAST16_TYPE__ short{{$}}
+// WEBASSEMBLY64-NEXT:#define __INT_FAST32_FMTd__ "d"{{$}}
+// WEBASSEMBLY64-NEXT:#define __INT_FAST32_FMTi__ "i"{{$}}
+// WEBASSEMBLY64-NEXT:#define __INT_FAST32_MAX__ 2147483647{{$}}
+// WEBASSEMBLY64-NEXT:#define __INT_FAST32_TYPE__ int{{$}}
+// WEBASSEMBLY64-NEXT:#define __INT_FAST64_FMTd__ "ld"{{$}}
+// WEBASSEMBLY64-NEXT:#define __INT_FAST64_FMTi__ "li"{{$}}
+// WEBASSEMBLY64-NEXT:#define __INT_FAST64_MAX__ 9223372036854775807L{{$}}
+// WEBASSEMBLY64-NEXT:#define __INT_FAST64_TYPE__ long int{{$}}
+// WEBASSEMBLY64-NEXT:#define __INT_FAST8_FMTd__ "hhd"{{$}}
+// WEBASSEMBLY64-NEXT:#define __INT_FAST8_FMTi__ "hhi"{{$}}
+// WEBASSEMBLY64-NEXT:#define __INT_FAST8_MAX__ 127{{$}}
+// WEBASSEMBLY64-NEXT:#define __INT_FAST8_TYPE__ signed char{{$}}
+// WEBASSEMBLY64-NEXT:#define __INT_LEAST16_FMTd__ "hd"{{$}}
+// WEBASSEMBLY64-NEXT:#define __INT_LEAST16_FMTi__ "hi"{{$}}
+// WEBASSEMBLY64-NEXT:#define __INT_LEAST16_MAX__ 32767{{$}}
+// WEBASSEMBLY64-NEXT:#define __INT_LEAST16_TYPE__ short{{$}}
+// WEBASSEMBLY64-NEXT:#define __INT_LEAST32_FMTd__ "d"{{$}}
+// WEBASSEMBLY64-NEXT:#define __INT_LEAST32_FMTi__ "i"{{$}}
+// WEBASSEMBLY64-NEXT:#define __INT_LEAST32_MAX__ 2147483647{{$}}
+// WEBASSEMBLY64-NEXT:#define __INT_LEAST32_TYPE__ int{{$}}
+// WEBASSEMBLY64-NEXT:#define __INT_LEAST64_FMTd__ "ld"{{$}}
+// WEBASSEMBLY64-NEXT:#define __INT_LEAST64_FMTi__ "li"{{$}}
+// WEBASSEMBLY64-NEXT:#define __INT_LEAST64_MAX__ 9223372036854775807L{{$}}
+// WEBASSEMBLY64-NEXT:#define __INT_LEAST64_TYPE__ long int{{$}}
+// WEBASSEMBLY64-NEXT:#define __INT_LEAST8_FMTd__ "hhd"{{$}}
+// WEBASSEMBLY64-NEXT:#define __INT_LEAST8_FMTi__ "hhi"{{$}}
+// WEBASSEMBLY64-NEXT:#define __INT_LEAST8_MAX__ 127{{$}}
+// WEBASSEMBLY64-NEXT:#define __INT_LEAST8_TYPE__ signed char{{$}}
+// WEBASSEMBLY64-NEXT:#define __INT_MAX__ 2147483647{{$}}
+// WEBASSEMBLY64-NEXT:#define __LDBL_DECIMAL_DIG__ 17{{$}}
+// WEBASSEMBLY64-NEXT:#define __LDBL_DENORM_MIN__ 4.9406564584124654e-324L{{$}}
+// WEBASSEMBLY64-NEXT:#define __LDBL_DIG__ 15{{$}}
+// WEBASSEMBLY64-NEXT:#define __LDBL_EPSILON__ 2.2204460492503131e-16L{{$}}
+// WEBASSEMBLY64-NEXT:#define __LDBL_HAS_DENORM__ 1{{$}}
+// WEBASSEMBLY64-NEXT:#define __LDBL_HAS_INFINITY__ 1{{$}}
+// WEBASSEMBLY64-NEXT:#define __LDBL_HAS_QUIET_NAN__ 1{{$}}
+// WEBASSEMBLY64-NEXT:#define __LDBL_MANT_DIG__ 53{{$}}
+// WEBASSEMBLY64-NEXT:#define __LDBL_MAX_10_EXP__ 308{{$}}
+// WEBASSEMBLY64-NEXT:#define __LDBL_MAX_EXP__ 1024{{$}}
+// WEBASSEMBLY64-NEXT:#define __LDBL_MAX__ 1.7976931348623157e+308L{{$}}
+// WEBASSEMBLY64-NEXT:#define __LDBL_MIN_10_EXP__ (-307){{$}}
+// WEBASSEMBLY64-NEXT:#define __LDBL_MIN_EXP__ (-1021){{$}}
+// WEBASSEMBLY64-NEXT:#define __LDBL_MIN__ 2.2250738585072014e-308L{{$}}
+// WEBASSEMBLY64-NEXT:#define __LITTLE_ENDIAN__ 1{{$}}
+// WEBASSEMBLY64-NEXT:#define __LONG_LONG_MAX__ 9223372036854775807LL{{$}}
+// WEBASSEMBLY64-NEXT:#define __LONG_MAX__ 9223372036854775807L{{$}}
+// WEBASSEMBLY64-NEXT:#define __LP64__ 1{{$}}
+// WEBASSEMBLY64-NEXT:#define __NO_INLINE__ 1{{$}}
+// WEBASSEMBLY64-NEXT:#define __ORDER_BIG_ENDIAN__ 4321{{$}}
+// WEBASSEMBLY64-NEXT:#define __ORDER_LITTLE_ENDIAN__ 1234{{$}}
+// WEBASSEMBLY64-NEXT:#define __ORDER_PDP_ENDIAN__ 3412{{$}}
+// WEBASSEMBLY64-NEXT:#define __POINTER_WIDTH__ 64{{$}}
+// WEBASSEMBLY64-NEXT:#define __PRAGMA_REDEFINE_EXTNAME 1{{$}}
+// WEBASSEMBLY64-NEXT:#define __PTRDIFF_FMTd__ "ld"{{$}}
+// WEBASSEMBLY64-NEXT:#define __PTRDIFF_FMTi__ "li"{{$}}
+// WEBASSEMBLY64-NEXT:#define __PTRDIFF_MAX__ 9223372036854775807L{{$}}
+// WEBASSEMBLY64-NEXT:#define __PTRDIFF_TYPE__ long int{{$}}
+// WEBASSEMBLY64-NEXT:#define __PTRDIFF_WIDTH__ 64{{$}}
+// WEBASSEMBLY64-NOT:#define __REGISTER_PREFIX__
+// WEBASSEMBLY64-NEXT:#define __SCHAR_MAX__ 127{{$}}
+// WEBASSEMBLY64-NEXT:#define __SHRT_MAX__ 32767{{$}}
+// WEBASSEMBLY64-NEXT:#define __SIG_ATOMIC_MAX__ 2147483647{{$}}
+// WEBASSEMBLY64-NEXT:#define __SIG_ATOMIC_WIDTH__ 32{{$}}
+// WEBASSEMBLY64-NEXT:#define __SIZEOF_DOUBLE__ 8{{$}}
+// WEBASSEMBLY64-NEXT:#define __SIZEOF_FLOAT__ 4{{$}}
+// WEBASSEMBLY64-NEXT:#define __SIZEOF_INT128__ 16{{$}}
+// WEBASSEMBLY64-NEXT:#define __SIZEOF_INT__ 4{{$}}
+// WEBASSEMBLY64-NEXT:#define __SIZEOF_LONG_DOUBLE__ 8{{$}}
+// WEBASSEMBLY64-NEXT:#define __SIZEOF_LONG_LONG__ 8{{$}}
+// WEBASSEMBLY64-NEXT:#define __SIZEOF_LONG__ 8{{$}}
+// WEBASSEMBLY64-NEXT:#define __SIZEOF_POINTER__ 8{{$}}
+// WEBASSEMBLY64-NEXT:#define __SIZEOF_PTRDIFF_T__ 8{{$}}
+// WEBASSEMBLY64-NEXT:#define __SIZEOF_SHORT__ 2{{$}}
+// WEBASSEMBLY64-NEXT:#define __SIZEOF_SIZE_T__ 8{{$}}
+// WEBASSEMBLY64-NEXT:#define __SIZEOF_WCHAR_T__ 4{{$}}
+// WEBASSEMBLY64-NEXT:#define __SIZEOF_WINT_T__ 4{{$}}
+// WEBASSEMBLY64-NEXT:#define __SIZE_FMTX__ "lX"{{$}}
+// WEBASSEMBLY64-NEXT:#define __SIZE_FMTo__ "lo"{{$}}
+// WEBASSEMBLY64-NEXT:#define __SIZE_FMTu__ "lu"{{$}}
+// WEBASSEMBLY64-NEXT:#define __SIZE_FMTx__ "lx"{{$}}
+// WEBASSEMBLY64-NEXT:#define __SIZE_MAX__ 18446744073709551615UL{{$}}
+// WEBASSEMBLY64-NEXT:#define __SIZE_TYPE__ long unsigned int{{$}}
+// WEBASSEMBLY64-NEXT:#define __SIZE_WIDTH__ 64{{$}}
+// WEBASSEMBLY64-NEXT:#define __STDC_HOSTED__ 0{{$}}
+// WEBASSEMBLY64-NOT:#define __STDC_MB_MIGHT_NEQ_WC__
+// WEBASSEMBLY64-NOT:#define __STDC_NO_ATOMICS__
+// WEBASSEMBLY64-NOT:#define __STDC_NO_COMPLEX__
+// WEBASSEMBLY64-NOT:#define __STDC_NO_VLA__
+// WEBASSEMBLY64-NOT:#define __STDC_NO_THREADS__
+// WEBASSEMBLY64-NEXT:#define __STDC_UTF_16__ 1{{$}}
+// WEBASSEMBLY64-NEXT:#define __STDC_UTF_32__ 1{{$}}
+// WEBASSEMBLY64-NEXT:#define __STDC_VERSION__ 201112L{{$}}
+// WEBASSEMBLY64-NEXT:#define __STDC__ 1{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT16_C_SUFFIX__ {{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT16_FMTX__ "hX"{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT16_FMTo__ "ho"{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT16_FMTu__ "hu"{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT16_FMTx__ "hx"{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT16_MAX__ 65535{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT16_TYPE__ unsigned short{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT32_C_SUFFIX__ U{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT32_FMTX__ "X"{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT32_FMTo__ "o"{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT32_FMTu__ "u"{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT32_FMTx__ "x"{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT32_MAX__ 4294967295U{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT32_TYPE__ unsigned int{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT64_C_SUFFIX__ ULL{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT64_FMTX__ "llX"{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT64_FMTo__ "llo"{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT64_FMTu__ "llu"{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT64_FMTx__ "llx"{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT64_MAX__ 18446744073709551615ULL{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT64_TYPE__ long long unsigned int{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT8_C_SUFFIX__ {{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT8_FMTX__ "hhX"{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT8_FMTo__ "hho"{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT8_FMTu__ "hhu"{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT8_FMTx__ "hhx"{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT8_MAX__ 255{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT8_TYPE__ unsigned char{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINTMAX_C_SUFFIX__ ULL{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINTMAX_FMTX__ "llX"{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINTMAX_FMTo__ "llo"{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINTMAX_FMTu__ "llu"{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINTMAX_FMTx__ "llx"{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINTMAX_MAX__ 18446744073709551615ULL{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINTMAX_TYPE__ long long unsigned int{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINTMAX_WIDTH__ 64{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINTPTR_FMTX__ "lX"{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINTPTR_FMTo__ "lo"{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINTPTR_FMTu__ "lu"{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINTPTR_FMTx__ "lx"{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINTPTR_MAX__ 18446744073709551615UL{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINTPTR_TYPE__ long unsigned int{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINTPTR_WIDTH__ 64{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT_FAST16_FMTX__ "hX"{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT_FAST16_FMTo__ "ho"{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT_FAST16_FMTu__ "hu"{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT_FAST16_FMTx__ "hx"{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT_FAST16_MAX__ 65535{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT_FAST16_TYPE__ unsigned short{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT_FAST32_FMTX__ "X"{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT_FAST32_FMTo__ "o"{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT_FAST32_FMTu__ "u"{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT_FAST32_FMTx__ "x"{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT_FAST32_MAX__ 4294967295U{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT_FAST32_TYPE__ unsigned int{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT_FAST64_FMTX__ "lX"{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT_FAST64_FMTo__ "lo"{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT_FAST64_FMTu__ "lu"{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT_FAST64_FMTx__ "lx"{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT_FAST64_MAX__ 18446744073709551615UL{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT_FAST64_TYPE__ long unsigned int{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT_FAST8_FMTX__ "hhX"{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT_FAST8_FMTo__ "hho"{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT_FAST8_FMTu__ "hhu"{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT_FAST8_FMTx__ "hhx"{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT_FAST8_MAX__ 255{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT_FAST8_TYPE__ unsigned char{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT_LEAST16_FMTX__ "hX"{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT_LEAST16_FMTo__ "ho"{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT_LEAST16_FMTu__ "hu"{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT_LEAST16_FMTx__ "hx"{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT_LEAST16_MAX__ 65535{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT_LEAST16_TYPE__ unsigned short{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT_LEAST32_FMTX__ "X"{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT_LEAST32_FMTo__ "o"{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT_LEAST32_FMTu__ "u"{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT_LEAST32_FMTx__ "x"{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT_LEAST32_MAX__ 4294967295U{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT_LEAST32_TYPE__ unsigned int{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT_LEAST64_FMTX__ "lX"{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT_LEAST64_FMTo__ "lo"{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT_LEAST64_FMTu__ "lu"{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT_LEAST64_FMTx__ "lx"{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT_LEAST64_MAX__ 18446744073709551615UL{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT_LEAST64_TYPE__ long unsigned int{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT_LEAST8_FMTX__ "hhX"{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT_LEAST8_FMTo__ "hho"{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT_LEAST8_FMTu__ "hhu"{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT_LEAST8_FMTx__ "hhx"{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT_LEAST8_MAX__ 255{{$}}
+// WEBASSEMBLY64-NEXT:#define __UINT_LEAST8_TYPE__ unsigned char{{$}}
+// WEBASSEMBLY64-NEXT:#define __USER_LABEL_PREFIX__ {{$}}
+// WEBASSEMBLY64-NEXT:#define __VERSION__ "{{.*}}"{{$}}
+// WEBASSEMBLY64-NEXT:#define __WCHAR_MAX__ 2147483647{{$}}
+// WEBASSEMBLY64-NEXT:#define __WCHAR_TYPE__ int{{$}}
+// WEBASSEMBLY64-NOT:#define __WCHAR_UNSIGNED__
+// WEBASSEMBLY64-NEXT:#define __WCHAR_WIDTH__ 32{{$}}
+// WEBASSEMBLY64-NEXT:#define __WINT_TYPE__ int{{$}}
+// WEBASSEMBLY64-NOT:#define __WINT_UNSIGNED__
+// WEBASSEMBLY64-NEXT:#define __WINT_WIDTH__ 32{{$}}
+// WEBASSEMBLY64-NEXT:#define __clang__ 1{{$}}
+// WEBASSEMBLY64-NEXT:#define __clang_major__ {{.}}
+// WEBASSEMBLY64-NEXT:#define __clang_minor__ {{.}}
+// WEBASSEMBLY64-NEXT:#define __clang_patchlevel__ {{.}}
+// WEBASSEMBLY64-NEXT:#define __clang_version__ "{{.*}}"{{$}}
+// WEBASSEMBLY64-NEXT:#define __llvm__ 1{{$}}
+// WEBASSEMBLY64-NOT:#define __wasm_simd128__
+// WEBASSEMBLY64-NOT:#define __wasm_simd256__
+// WEBASSEMBLY64-NOT:#define __wasm_simd512__
+// WEBASSEMBLY64-NOT:#define __unix
+// WEBASSEMBLY64-NOT:#define __unix__
+// WEBASSEMBLY64-NEXT:#define __wasm 1{{$}}
+// WEBASSEMBLY64-NOT:#define __wasm32
+// WEBASSEMBLY64-NOT:#define __wasm32__
+// WEBASSEMBLY64-NEXT:#define __wasm64 1{{$}}
+// WEBASSEMBLY64-NEXT:#define __wasm64__ 1{{$}}
+// WEBASSEMBLY64-NEXT:#define __wasm__ 1{{$}}
diff --git a/clang/test/Preprocessor/wasm-target-features.c b/clang/test/Preprocessor/wasm-target-features.c
new file mode 100644
index 00000000000..f4d40b1774a
--- /dev/null
+++ b/clang/test/Preprocessor/wasm-target-features.c
@@ -0,0 +1,35 @@
+// RUN: %clang -E -dM %s -o - 2>&1 \
+// RUN: -target wasm32-unknown-unknown -msimd128 \
+// RUN: | FileCheck %s -check-prefix=SIMD128
+// RUN: %clang -E -dM %s -o - 2>&1 \
+// RUN: -target wasm64-unknown-unknown -msimd128 \
+// RUN: | FileCheck %s -check-prefix=SIMD128
+//
+// SIMD128:#define __wasm_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 \
+// RUN: -target wasm64-unknown-unknown -mcpu=mvp \
+// RUN: | FileCheck %s -check-prefix=MVP
+//
+// MVP-NOT:#define __wasm_simd128__
+//
+// RUN: %clang -E -dM %s -o - 2>&1 \
+// RUN: -target wasm32-unknown-unknown -mcpu=bleeding-edge \
+// RUN: | FileCheck %s -check-prefix=BLEEDING_EDGE
+// RUN: %clang -E -dM %s -o - 2>&1 \
+// RUN: -target wasm64-unknown-unknown -mcpu=bleeding-edge \
+// RUN: | FileCheck %s -check-prefix=BLEEDING_EDGE
+//
+// BLEEDING_EDGE:#define __wasm_simd128__ 1{{$}}
+//
+// RUN: %clang -E -dM %s -o - 2>&1 \
+// RUN: -target wasm32-unknown-unknown -mcpu=bleeding-edge -mno-simd128 \
+// RUN: | FileCheck %s -check-prefix=BLEEDING_EDGE_NO_SIMD128
+// RUN: %clang -E -dM %s -o - 2>&1 \
+// RUN: -target wasm64-unknown-unknown -mcpu=bleeding-edge -mno-simd128 \
+// RUN: | FileCheck %s -check-prefix=BLEEDING_EDGE_NO_SIMD128
+//
+// BLEEDING_EDGE_NO_SIMD128-NOT:#define __wasm_simd128__
OpenPOWER on IntegriCloud