How do I pass a u8x32 to inline ASM?



I’m trying to get explicit SIMD working in base100 with inline ASM, but I’m having LLVM-related problems passing my vector types (from stdsimd) into the inline asm.

The ASM block can be found here

Compiling it yields:

Unknown type!
UNREACHABLE executed at /checkout/src/llvm/lib/IR/ValueTypes.cpp:285!

I want all of the inputs to reside in ymm*, so I’m not sure if that requires me to do anything special.


If I am not mistaken you are using arguments incorrectly, "={x1}"(lo) means that you want to place result to register x1, which obviously does not exists. So one solution will be to use explicit registers, like:

: "={ymm0}"(lo), "={ymm1}"(hi)
: "{ymm2}"(a_dirty), "{ymm3}"(b_dirty), "{ymm4}"(c_dirty),
"{ymm5}"(d_dirty), "{ymm6}"(dirty_mask), "{ymm0}"(hi_mask)

Or you could use constraint x and enumerate registers using $0, $1, $2, etc. I don’t know if it’s currently possible to define and use convenient custom mnemonics for registers.

P.S.: Do not forget to enable AVX while calling rustc, e.g. by using target_feature=+avx, otherwise you’ll again get “unreachable” error.