[PATCH] D125728: [WebAssembly] Update supported features in -mcpu=generic

Dan Gohman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 25 11:45:55 PDT 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1e4e2433bcd1: [WebAssembly] Update supported features in the generic CPU configuration (authored by sunfish).

Changed prior to commit:
  https://reviews.llvm.org/D125728?vs=431067&id=470584#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125728/new/

https://reviews.llvm.org/D125728

Files:
  clang/docs/ReleaseNotes.rst
  clang/lib/Basic/Targets/WebAssembly.cpp
  clang/test/Driver/wasm-features.c


Index: clang/test/Driver/wasm-features.c
===================================================================
--- /dev/null
+++ clang/test/Driver/wasm-features.c
@@ -0,0 +1,43 @@
+// RUN: %clang --target=wasm32-unknown-unknown -### %s -fsyntax-only 2>&1 | FileCheck %s
+
+// CHECK: "-fvisibility=hidden"
+
+// RUN: %clang --target=wasm32-unknown-unknown -### %s 2>&1 | FileCheck %s -check-prefix=DEFAULT
+// RUN: %clang --target=wasm32-unknown-unknown -### %s -mcpu=mvp 2>&1 | FileCheck %s -check-prefix=MVP
+// RUN: %clang --target=wasm32-unknown-unknown -### %s -mcpu=bleeding-edge 2>&1 | FileCheck %s -check-prefix=BLEEDING-EDGE
+
+// RUN: %clang --target=wasm32-unknown-unknown -### %s -mbulk-memory 2>&1 | FileCheck %s -check-prefix=BULK-MEMORY
+// RUN: %clang --target=wasm32-unknown-unknown -### %s -mno-bulk-memory 2>&1 | FileCheck %s -check-prefix=NO-BULK-MEMORY
+
+// BULK-MEMORY: "-target-feature" "+bulk-memory"
+// NO-BULK-MEMORY: "-target-feature" "-bulk-memory"
+// DEFAULT-NOT: "-target-feature" "-bulk-memory"
+// MVP-NOT: "-target-feature" "+bulk-memory"
+// BLEEDING-EDGE-NOT: "-target-feature" "-bulk-memory"
+
+// RUN: %clang --target=wasm32-unknown-unknown -### %s -mmutable-globals 2>&1 | FileCheck %s -check-prefix=MUTABLE-GLOBALS
+// RUN: %clang --target=wasm32-unknown-unknown -### %s -mno-mutable-globals 2>&1 | FileCheck %s -check-prefix=NO-MUTABLE-GLOBALS
+
+// MUTABLE-GLOBALS: "-target-feature" "+mutable-globals"
+// NO-MUTABLE-GLOBALS: "-target-feature" "-mutable-globals"
+// DEFAULT-NOT: "-target-feature" "-mutable-globals"
+// MVP-NOT: "-target-feature" "+mutable-globals"
+// BLEEDING-EDGE-NOT: "-target-feature" "-mutable-globals"
+
+// RUN: %clang --target=wasm32-unknown-unknown -### %s -msign-ext 2>&1 | FileCheck %s -check-prefix=SIGN-EXT
+// RUN: %clang --target=wasm32-unknown-unknown -### %s -mno-sign-ext 2>&1 | FileCheck %s -check-prefix=NO-SIGN-EXT
+
+// SIGN-EXT: "-target-feature" "+sign-ext"
+// NO-SIGN-EXT: "-target-feature" "-sign-ext"
+// DEFAULT-NOT: "-target-feature" "-sign-ext"
+// MVP-NOT: "-target-feature" "+sign-ext"
+// BLEEDING-EDGE-NOT: "-target-feature" "-sign-ext"
+
+// RUN: %clang --target=wasm32-unknown-unknown -### %s -mnontrapping-fptoint 2>&1 | FileCheck %s -check-prefix=NONTRAPPING-FPTOINT
+// RUN: %clang --target=wasm32-unknown-unknown -### %s -mno-nontrapping-fptoint 2>&1 | FileCheck %s -check-prefix=NO-NONTRAPPING-FPTOINT
+
+// NONTRAPPING-FPTOINT: "-target-feature" "+nontrapping-fptoint"
+// NO-NONTRAPPING-FPTOINT: "-target-feature" "-nontrapping-fptoint"
+// DEFAULT-NOT: "-target-feature" "-nontrapping-fptoint"
+// MVP-NOT: "-target-feature" "+nontrapping-fptoint"
+// BLEEDING-EDGE-NOT: "-target-feature" "-nontrapping-fptoint"
Index: clang/lib/Basic/Targets/WebAssembly.cpp
===================================================================
--- clang/lib/Basic/Targets/WebAssembly.cpp
+++ clang/lib/Basic/Targets/WebAssembly.cpp
@@ -147,6 +147,9 @@
     Features["mutable-globals"] = true;
     Features["tail-call"] = true;
     setSIMDLevel(Features, SIMD128, true);
+  } else if (CPU == "generic") {
+    Features["sign-ext"] = true;
+    Features["mutable-globals"] = true;
   }
 
   return TargetInfo::initFeatureMap(Features, Diags, CPU, FeaturesVec);
Index: clang/docs/ReleaseNotes.rst
===================================================================
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -607,6 +607,12 @@
   * Support intrinsic of ``__cmpccxadd_epi32``.
   * Support intrinsic of ``__cmpccxadd_epi64``.
 
+WebAssembly Support in Clang
+----------------------------
+
+The -mcpu=generic configuration now enables sign-ext and mutable-globals. These
+proposals are standardized and available in all major engines.
+
 DWARF Support in Clang
 ----------------------
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125728.470584.patch
Type: text/x-patch
Size: 3797 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221025/314d475a/attachment-0001.bin>


More information about the cfe-commits mailing list