www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - __asm LDC2: Attribute 'elementtype' type does not match parameter!

reply realhet <real_het hotmail.com> writes:
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
Jun 25
parent realhet <real_het hotmail.com> writes:
Update: I downloaded the latest LDC. (I waited with this version 
catch up long ago.)

The above __asm inlining works fine on version LDC2 1.38.
Jun 25