Skip to content

Consider Supporting Clang Language Extensions #299

@JoltWorksIO

Description

@JoltWorksIO

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:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions