Consider Supporting Clang Language Extensions

Open
#299 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
30/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Quiet
Tech stack
cpp, wasm

Research direction

No source file or test is named. Start by running the supplied clang++/wasm-ld command with the cited Clang extensions, then inspect the output with wasm2wat; done would require a concrete feasibility result and a defined DirectXMath support scope.

Written by the indexing model from the issue text.

Description

enhancement

Given that you can compile your project using DirectXMath with clang++ and wasm-ld on Ubuntu (WSL):

clang++ -std=c++17 --target=wasm32 -nostdlib -Wl,--no-entry -Wl,--export-all -D_XM_NO_INTRINSICS_ -I. -isystem ./external/ -isystem
 ./external/DirectXMath/Inc/ -o demo.wasm demo.cc math.cc

And given that Clang supports these extensions among other extensions:

Supports the GCC, OpenCL, AltiVec, NEON, SVE and RVV vector extensions.

typedef float m4x4_t __attribute__((matrix_type(4, 4)));

m4x4_t f(m4x4_t a, m4x4_t b, m4x4_t c) {
  return a + b * c;
}

I wonder if those extensions work for Clang's wasm32 target and if it is worthwhile to support those very language extensions within DirectXMath.
If all those compiler extensions result in the use of SIMD types and functions inside the WebAssembly binary file (you can use wasm2wat to inspect your binary file), I think it is worthwhile to support those compiler extensions.

Also, consider: https://v8.dev/features/simd

I will build my WebAssembly binary with -D_XM_NO_INTRINSICS_ for now.

Source:

Dominant language
C++
Stars
1.8k
Forks
262
Avg merge
3d 12h
Merged PRs (30d)
5

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/DirectXMath

All issues in microsoft/DirectXMath

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.