Giter Site home page Giter Site logo

Comments (12)

BartmanAbyss avatar BartmanAbyss commented on May 2, 2024

I think these warnings are just from the IntelliSense. Microsoft's IntelliSense only officially supports Intel x86/x64 and ARM.
You should probably just wrap your inline assembly in #ifndef __INTELLISENSE__ #endif.

from vscode-amiga-debug.

rjobling avatar rjobling commented on May 2, 2024

Okay, well I'm still getting issues with the specified register being ignored, this leads to movem doing the wrong thing. Do you have any idea what might cause that? I'll see if I can come up with an example, but I suspect it only happens when the code starts to get a little bigger than the small examples in the sample.

from vscode-amiga-debug.

BartmanAbyss avatar BartmanAbyss commented on May 2, 2024

Are you using too many registers? Had some issues with that, then I just stored/restored all registers in inline assembly...
Can you post the problematic code?

from vscode-amiga-debug.

rjobling avatar rjobling commented on May 2, 2024

If you copy this block of code right at the start of main in the sample and look at the output assembly then you should see what I mean.

short vecbuf[300];
short resultbuf[200];
int numVecs = 100;
short* vecs = vecbuf;
short* results = resultbuf;
for (int i = 0; i < numVecs; i++)
{
	vecs[i * 3 + 0] = i;
	vecs[i * 3 + 1] = i * 2;
	vecs[i * 3 + 2] = i * 3;
}
int tx = 10;
int ty = 11;
int tz = 12;
register short vx asm("d1");	// Need to specify these so the movem is ordered correctly.
register short vy asm("d2");
register short vz asm("d3");
asm volatile(
"		subq.w	#1,%[num]						\n"
"loop%=:										\n"
"		movem.w	(%[vecs])+,%[vx]/%[vy]/%[vz]	\n"
"		add.l	%[tx],%[vx]						\n"
"		add.l	%[ty],%[vy]						\n"
"		add.l	%[tz],%[vz]						\n"
"		asr.l	#8,%[vz]						\n"
"		divs	%[vz],%[vx]						\n"
"		divs	%[vz],%[vy]						\n"
"		move.w	%[vx],(%[results])+				\n"
"		move.w	%[vy],(%[results])+				\n"
"		dbra	%[num],loop%=					\n"
:
[results]	"+a"	(results),	// "result" pointer gets incremented.
[num]		"+d"	(numVecs),	// "num" count gets decremented.
[vecs]		"+a"	(vecs),		// "vecs" pointers gets incremented.
[vx]		"=&d"	(vx),		// "vx, vy, vz" holds current vector.
[vy]		"=&d"	(vy),
[vz]		"=&d"	(vz)
:
[tx]		"d"		(tx),		// "tx, ty, tz" holds the translation.
[ty]		"d"		(ty),
[tz]		"d"		(tz)
:
"cc",
"memory"
);

from vscode-amiga-debug.

rjobling avatar rjobling commented on May 2, 2024

One work around is to specify tx/ty/tz as input/outputs. That seems to trick the compiler into doing what is expected, but I have little confidence that such a hack will hold up over time.

from vscode-amiga-debug.

BartmanAbyss avatar BartmanAbyss commented on May 2, 2024

Hmm.. given that's a rather large loop, maybe the safer route would be to move that as a function call to a .s file?

from vscode-amiga-debug.

rjobling avatar rjobling commented on May 2, 2024

I've been persisting with the inline stuff just because I quite like having all the code in the c file and being able to name registers. I know I can work around the problem in several ways, but it seems a shame.

from vscode-amiga-debug.

BartmanAbyss avatar BartmanAbyss commented on May 2, 2024

I admire your perserverance ;) I'm no inline assembly expert...

from vscode-amiga-debug.

rjobling avatar rjobling commented on May 2, 2024

It feels like there's a bug with how gcc understands the registers. Is there some part within your control that specs out the registers for gcc?

from vscode-amiga-debug.

BartmanAbyss avatar BartmanAbyss commented on May 2, 2024

Not really, the sum of all my GCC patches is about 20 lines

from vscode-amiga-debug.

rjobling avatar rjobling commented on May 2, 2024

That's all alien to me. I seem to be able to work around it consistently by promoting inputs so they are input/outputs. This avoids the need to specify some things as early clobbers, which is a confusing at the best of times. Maybe gcc just gets confused when mixing early clobbers with specified registers. The whole early clobber thing seems sketchy. But I don't know where do go to check if something could be done about it.

from vscode-amiga-debug.

BartmanAbyss avatar BartmanAbyss commented on May 2, 2024

See, I don't even know about early clobbers ^_^

from vscode-amiga-debug.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.