x86 intrinsics for sale cheap

Cecil Ward cecil at cecilward.com
Wed May 31 17:09:38 UTC 2023


On Wednesday, 31 May 2023 at 16:51:42 UTC, Cecil Ward wrote:
> On Wednesday, 31 May 2023 at 16:45:35 UTC, max haughton wrote:
>> On Wednesday, 31 May 2023 at 16:33:47 UTC, Cecil Ward wrote:
>>> [...]
>
> Ah, I was indeed misunderstanding. And no harm done as this was 
> a D learning project until I started to think that I might be 
> of some use to someone. Thanks for giving me that link !

Ah, just followed that link. No that’s (solely?) SIMD, something 
I was aware of and so I’m not duplicating that as I haven’t gone 
near SIMD. The pext instruction would be one instruction that I 
attacked some time ago, and that would already be fine with ARM 
as there’s a pure D fallback, but maybe I can find some native 
ARM equivalent if I study AArch64.

So no, this would be something new. Non-SIMD insns for general 
use. The smallest instructions might be something like andn if I 
can keep to zero-overhead obviously, seeing as the benefit in the 
instruction is so tiny anyway. But mind you I could have done 
with it for graphics bit twiddling manipulation code.

Because I have zero familiarity with the tools, and am very 
unwell, I would just give the .d files with their inline asm and 
pure D code to someone experienced who is sufficiently motivated 
to help out. I wouldn’t be able to do anything on my own.

I would also like some help with some problems with unittest. To 
test that a native insn conforms to the spec, in respect of its 
mating up of register passing and the like, I would ideally want 
to use static asserts. Since I’m testing with x86 boxes on 
godbolt.org, If the compiler doesn’t mind doing ctfe with asm 
then all will be well. I I avoid a problem by using static if ( 
__ctfe ) (or whatever) then I’m not would not be doing a test 
against the native instruction but against the pure-D 
replacement. Thus defeating the whole point, as that’s a separate 
test, albeit one that very much needs doing anyway, but there I 
would compare the native instruction with the D replacement 
rather than comparing both against hand-calculated values. The 
problem with hand-calculated values is that you are just testing 
against your own understanding of the algorithm, testing your own 
self against your own ideas, although that has some value in 
anti-regression testing later on but that’s a different thing.


More information about the Digitalmars-d mailing list