__asm LDC2: Attribute 'elementtype' type does not match parameter!

realhet real_het at hotmail.com
Tue Jun 25 19:18:20 UTC 2024


Hi,
I'm switching from LDC2 1.28 to 1.35, and trying to solve some 
problems on the way.

Target: 64bit Windows.
The problematic code:
```
const tmp = __asm!size_t(
	"pcmpestri $5,$3,$1"
	//   0    1  2     3  4    5
	, "={RCX},x,{RAX},*p,{RDX},i,~{flags}",
	charSetVector, charSet.length, p, remaining, 0
);
```

It works on LDC2 1.28 but fails on LDC2 1.35 with the following 
message:
```
Attribute 'elementtype' type does not match parameter!
   %19 = call i64 asm sideeffect "pcmpestri $5,$3,$1", 
"={RCX},x,{RAX},*p,{RDX},i,~{flags}"(<16 x i8> %16, i64 14, i8* 
elementtype(i64) %17, i64 %18, i32 0), !dbg !22596, !srcloc !22598
LLVM ERROR: Broken module found, compilation aborted!
```

I played with changing some types, but no luck.

The word 'elementtype' it at the point where I pass a pointer 
there.  Is it changed in LDC2?
Or is there a new way to inline asm in LDC2?

This was the perfect way to do this two years ago, I only 
injected the important stuff, and the compiler did the rest.

Anyone please help! :D



More information about the Digitalmars-d-learn mailing list